blob: 51e01818ec7ce13fe37ee43b3cf56e1b99c70778 [file] [log] [blame]
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -06001# makefile for libpng on Solaris 2.x with gcc
Glenn Randers-Pehrsondff799e2004-08-07 21:42:49 -05002# Copyright (C) 2004 Glenn Randers-Pehrson
Glenn Randers-Pehrsonbcfd15d1999-10-01 14:22:25 -05003# Contributed by William L. Sebok, based on makefile.linux
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -05004# Copyright (C) 1998 Greg Roelofs
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05005# Copyright (C) 1996, 1997 Andreas Dilger
Guy Schalnat4ee97b01996-01-16 01:51:56 -06006# For conditions of distribution and use, see copyright notice in png.h
7
8CC=gcc
Andreas Dilger47a0c421997-05-16 02:46:07 -05009
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060010# Where make install puts libpng.a, libpng12.so*, and png.h
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060011prefix=/usr/local
12
Andreas Dilger47a0c421997-05-16 02:46:07 -050013# Where the zlib library and include files are located
Glenn Randers-Pehrsonf9f2fe01998-03-15 18:20:23 -060014# Changing these to ../zlib poses a security risk. If you want
15# to have zlib in an adjacent directory, specify the full path instead of "..".
16#ZLIBLIB=../zlib
17#ZLIBINC=../zlib
18
19ZLIBLIB=/usr/local/lib
20ZLIBINC=/usr/local/include
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -060021
Andreas Dilger47a0c421997-05-16 02:46:07 -050022WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050023 -Wmissing-declarations -Wtraditional -Wcast-align \
24 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
Glenn Randers-Pehrsondff799e2004-08-07 21:42:49 -050025CFLAGS=-I$(ZLIBINC) -Wall -O \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050026 # $(WARNMORE) -g -DPNG_DEBUG=5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050027LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm
Guy Schalnat4ee97b01996-01-16 01:51:56 -060028
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -050029#RANLIB=ranlib
30RANLIB=echo
31
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060032PNGMAJ = 0
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -060033PNGMIN = 1.2.9beta1
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060034PNGVER = $(PNGMAJ).$(PNGMIN)
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060035LIBNAME = libpng12
Guy Schalnat4ee97b01996-01-16 01:51:56 -060036
Andreas Dilger47a0c421997-05-16 02:46:07 -050037INCPATH=$(prefix)/include
38LIBPATH=$(prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050039MANPATH=$(prefix)/man
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -050040BINPATH=$(prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050041
42# override DESTDIR= on the make install command line to easily support
43# installing into a temporary location. Example:
44#
45# make install DESTDIR=/tmp/build/libpng
46#
47# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050048# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050049# you execute make install.
50DESTDIR=
Guy Schalnat4ee97b01996-01-16 01:51:56 -060051
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050052DB=$(DESTDIR)$(BINPATH)
53DI=$(DESTDIR)$(INCPATH)
54DL=$(DESTDIR)$(LIBPATH)
55DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050056
Andreas Dilger47a0c421997-05-16 02:46:07 -050057OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050058 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
59 pngwtran.o pngmem.o pngerror.o pngpread.o
Guy Schalnat4ee97b01996-01-16 01:51:56 -060060
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060061OBJSDLL = $(OBJS:.o=.pic.o)
62
63.SUFFIXES: .c .o .pic.o
64
65.c.pic.o:
66 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
67
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050068all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
Guy Schalnat4ee97b01996-01-16 01:51:56 -060069
70libpng.a: $(OBJS)
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -050071 ar rc $@ $(OBJS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060072 $(RANLIB) $@
73
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050074libpng.pc:
75 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
76
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050077libpng-config:
78 ( cat scripts/libpng-config-head.in; \
79 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050080 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
81 echo cppflags=\"-DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE\"; \
82 echo L_opts=\"-L$(LIBPATH)\"; \
83 echo R_opts=\"-R$(LIBPATH)\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050084 echo libs=\"-lpng12 -lz -lm\"; \
85 cat scripts/libpng-config-body.in ) > libpng-config
86 chmod +x libpng-config
87
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060088$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
89 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
Guy Schalnat4ee97b01996-01-16 01:51:56 -060090
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060091$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
92 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060093
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060094$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -060095 @case "`type ld`" in *ucb*) \
96 echo; \
97 echo '## WARNING:'; \
98 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
99 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
100 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
101 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
102 echo '## at all. If it is, things are likely to break because of'; \
103 echo '## the libucb dependency that is created.'; \
104 echo; \
105 ;; \
106 esac
Glenn Randers-Pehrson865f4f02002-09-15 20:30:38 -0500107 $(LD) -G -h $(LIBNAME).so.$(PNGMAJ) \
108 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600109
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600110libpng.so.0.$(PNGMIN): $(OBJS)
111 $(LD) -G -h libpng.so.0 \
112 -o libpng.so.0.$(PNGMIN) $(OBJSDLL)
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500113
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600114pngtest: pngtest.o $(LIBNAME).so
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600115 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600116
117test: pngtest
118 ./pngtest
119
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600120install-headers: png.h pngconf.h
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500121 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
122 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
123 cp png.h pngconf.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500124 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500125 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
126 -@/bin/rm -f $(DI)/libpng
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500127 (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600128
129install-static: install-headers libpng.a
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500130 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
131 cp libpng.a $(DL)/$(LIBNAME).a
132 chmod 644 $(DL)/$(LIBNAME).a
133 -@/bin/rm -f $(DL)/libpng.a
134 (cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600135
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500136install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600137 libpng.so.0.$(PNGMIN)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500138 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500139 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
Glenn Randers-Pehrsondff799e2004-08-07 21:42:49 -0500140 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500141 -@/bin/rm -f $(DL)/libpng.so
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600142 -@/bin/rm -f $(DL)/libpng.so.0
143 -@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500144 cp $(LIBNAME).so.$(PNGVER) $(DL)
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600145 cp libpng.so.0.$(PNGMIN) $(DL)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500146 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600147 chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500148 (cd $(DL); \
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600149 ln -f -s libpng.so.0.$(PNGMIN) libpng.so.0; \
150 ln -f -s libpng.so.0 libpng.so; \
Glenn Randers-Pehrson73d57cb2002-03-25 18:49:08 -0600151 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so; \
152 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ))
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500153 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
154 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
155 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
156 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
157 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
158 (cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600159
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500160install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500161 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
162 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
163 -@/bin/rm -f $(DM)/man3/libpng.3
164 -@/bin/rm -f $(DM)/man3/libpngpf.3
165 cp libpng.3 $(DM)/man3
166 cp libpngpf.3 $(DM)/man3
167 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
168 -@/bin/rm -f $(DM)/man5/png.5
169 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500170
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500171install-config: libpng-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500172 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
173 -@/bin/rm -f $(DB)/libpng-config
174 -@/bin/rm -f $(DB)/$(LIBNAME)-config
175 cp libpng-config $(DB)/$(LIBNAME)-config
176 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsondff799e2004-08-07 21:42:49 -0500177 (cd $(DB); ln -s -f $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500178
179install: install-static install-shared install-man install-config
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600180
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500181# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500182# move the library to its final location. Use test-dd to test it
183# before then.
184
185test-dd:
186 echo
187 echo Testing installed dynamic shared library in $(DL).
188 $(CC) -I$(DI) -I$(ZLIBINC) \
189 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
190 -o pngtestd `$(BINPATH)/libpng12-config --ldflags` \
191 -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
192 ./pngtestd pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500193
194test-installed:
195 echo
196 echo Testing installed dynamic shared library.
197 $(CC) -I$(ZLIBINC) \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -0500198 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
199 -o pngtesti `$(BINPATH)/libpng12-config --ldflags` \
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500200 -L$(ZLIBLIB) -R$(ZLIBLIB)
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500201 ./pngtesti pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500202
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600203clean:
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500204 /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500205 libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600206 libpng.so.0.$(PNGMIN) \
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500207 libpng.pc
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600208
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600209DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
210writelock:
211 chmod a-w *.[ch35] $(DOCS) scripts/*
212
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600213# DO NOT DELETE THIS LINE -- make depend depends on it.
214
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600215png.o png.pic.o: png.h pngconf.h
216pngerror.o pngerror.pic.o: png.h pngconf.h
217pngrio.o pngrio.pic.o: png.h pngconf.h
218pngwio.o pngwio.pic.o: png.h pngconf.h
219pngmem.o pngmem.pic.o: png.h pngconf.h
220pngset.o pngset.pic.o: png.h pngconf.h
221pngget.o pngget.pic.o: png.h pngconf.h
222pngread.o pngread.pic.o: png.h pngconf.h
223pngrtran.o pngrtran.pic.o: png.h pngconf.h
224pngrutil.o pngrutil.pic.o: png.h pngconf.h
225pngtrans.o pngtrans.pic.o: png.h pngconf.h
226pngwrite.o pngwrite.pic.o: png.h pngconf.h
227pngwtran.o pngwtran.pic.o: png.h pngconf.h
228pngwutil.o pngwutil.pic.o: png.h pngconf.h
229pngpread.o pngpread.pic.o: png.h pngconf.h
230
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600231pngtest.o: png.h pngconf.h