blob: d941e64bb8a81c5802c8a0b930c37f5d324b1f91 [file] [log] [blame]
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -06001# makefile for libpng on Solaris 2.x with gcc
Glenn Randers-Pehrsonbcfd15d1999-10-01 14:22:25 -05002# Contributed by William L. Sebok, based on makefile.linux
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06003# Copyright (C) 1996, 1997 Andreas Dilger
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -06004# Copyright (C) 1998 Greg Roelofs
Guy Schalnat4ee97b01996-01-16 01:51:56 -06005# For conditions of distribution and use, see copyright notice in png.h
6
7CC=gcc
Andreas Dilger47a0c421997-05-16 02:46:07 -05008
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -05009# The commands "CC" and "LD" must NOT refer to /usr/ucb/cc and /usr/ucb/ld.
Glenn Randers-Pehrson5379b241999-11-27 10:22:33 -060010# If they do, you need to adjust your PATH environment variable to put
11# /usr/ccs/bin ahead of /usr/ucb. The environment variable LD_LIBRARY_PATH
12# should not be set at all. If it is, things are likely to break because
13# of the libucb dependency that is created.
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050014
15# Where make install puts libpng.a, libpng.so*, and png.h
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060016prefix=/usr/local
17
Andreas Dilger47a0c421997-05-16 02:46:07 -050018# Where the zlib library and include files are located
Glenn Randers-Pehrsonf9f2fe01998-03-15 18:20:23 -060019# Changing these to ../zlib poses a security risk. If you want
20# to have zlib in an adjacent directory, specify the full path instead of "..".
21#ZLIBLIB=../zlib
22#ZLIBINC=../zlib
23
24ZLIBLIB=/usr/local/lib
25ZLIBINC=/usr/local/include
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -060026
Andreas Dilger47a0c421997-05-16 02:46:07 -050027WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050028 -Wmissing-declarations -Wtraditional -Wcast-align \
29 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060030CFLAGS=-I$(ZLIBINC) -Wall -O3 \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050031 # $(WARNMORE) -g -DPNG_DEBUG=5
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060032LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng -lz -lm
Guy Schalnat4ee97b01996-01-16 01:51:56 -060033
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060034#RANLIB=ranlib
35RANLIB=echo
Guy Schalnat4ee97b01996-01-16 01:51:56 -060036
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060037# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
38# have to change it.
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060039PNGMAJ = 2
Glenn Randers-Pehrson5379b241999-11-27 10:22:33 -060040PNGMIN = 1.0.5c
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060041PNGVER = $(PNGMAJ).$(PNGMIN)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060042
Andreas Dilger47a0c421997-05-16 02:46:07 -050043INCPATH=$(prefix)/include
44LIBPATH=$(prefix)/lib
Guy Schalnat4ee97b01996-01-16 01:51:56 -060045
Andreas Dilger47a0c421997-05-16 02:46:07 -050046OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050047 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
48 pngwtran.o pngmem.o pngerror.o pngpread.o
Guy Schalnat4ee97b01996-01-16 01:51:56 -060049
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060050OBJSDLL = $(OBJS:.o=.pic.o)
51
52.SUFFIXES: .c .o .pic.o
53
54.c.pic.o:
55 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
56
57all: libpng.a libpng.so pngtest
Guy Schalnat4ee97b01996-01-16 01:51:56 -060058
59libpng.a: $(OBJS)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060060 ar rc $@ $(OBJS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060061 $(RANLIB) $@
62
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060063libpng.so: libpng.so.$(PNGMAJ)
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050064 ln -f -s libpng.so.$(PNGMAJ) libpng.so
Guy Schalnat4ee97b01996-01-16 01:51:56 -060065
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060066libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050067 ln -f -s libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060068
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060069libpng.so.$(PNGVER): $(OBJSDLL)
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -060070 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.$(PNGMAJ) \
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060071 -o libpng.so.$(PNGVER) $(OBJSDLL) -lz
Guy Schalnat4ee97b01996-01-16 01:51:56 -060072
73pngtest: pngtest.o libpng.so
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060074 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060075
76test: pngtest
77 ./pngtest
78
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060079install: libpng.a libpng.so.$(PNGVER)
Andreas Dilger47a0c421997-05-16 02:46:07 -050080 -@mkdir $(INCPATH) $(LIBPATH)
81 cp png.h pngconf.h $(INCPATH)
82 chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060083 cp libpng.a libpng.so.$(PNGVER) $(LIBPATH)
Andreas Dilger47a0c421997-05-16 02:46:07 -050084 chmod 755 $(LIBPATH)/libpng.so.$(PNGVER)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060085 -@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050086 (cd $(LIBPATH); ln -f -s libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
87 ln -f -s libpng.so.$(PNGMAJ) libpng.so)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060088
89clean:
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060090 /bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
Guy Schalnat4ee97b01996-01-16 01:51:56 -060091
92# DO NOT DELETE THIS LINE -- make depend depends on it.
93
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060094png.o png.pic.o: png.h pngconf.h
95pngerror.o pngerror.pic.o: png.h pngconf.h
96pngrio.o pngrio.pic.o: png.h pngconf.h
97pngwio.o pngwio.pic.o: png.h pngconf.h
98pngmem.o pngmem.pic.o: png.h pngconf.h
99pngset.o pngset.pic.o: png.h pngconf.h
100pngget.o pngget.pic.o: png.h pngconf.h
101pngread.o pngread.pic.o: png.h pngconf.h
102pngrtran.o pngrtran.pic.o: png.h pngconf.h
103pngrutil.o pngrutil.pic.o: png.h pngconf.h
104pngtrans.o pngtrans.pic.o: png.h pngconf.h
105pngwrite.o pngwrite.pic.o: png.h pngconf.h
106pngwtran.o pngwtran.pic.o: png.h pngconf.h
107pngwutil.o pngwutil.pic.o: png.h pngconf.h
108pngpread.o pngpread.pic.o: png.h pngconf.h
109
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600110pngtest.o: png.h pngconf.h