blob: b34d8b5e7576f85e1a575ba82e00e24d5896c226 [file] [log] [blame]
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -06001# makefile for libpng on Solaris 2.x with gcc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -06002# Copyright (C) 2004, 2006 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
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -06008# Library name:
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05009LIBNAME = libpng14
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060010PNGMAJ = 0
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050011PNGMIN = 1.4.0beta1
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060012PNGVER = $(PNGMAJ).$(PNGMIN)
13
14# Shared library names:
15LIBSO=$(LIBNAME).so
16LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
17LIBSOVER=$(LIBNAME).so.$(PNGVER)
18OLDSO=libpng.so
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050019OLDSOMAJ=libpng.so.14
20OLDSOVER=libpng.so.14.$(PNGMIN)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060021
22# Utilities:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060023AR_RC=ar rc
Guy Schalnat4ee97b01996-01-16 01:51:56 -060024CC=gcc
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -060025MKDIR_P=mkdir -p
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060026LN_SF=ln -f -s
27RANLIB=echo
28RM_F=/bin/rm -f
Andreas Dilger47a0c421997-05-16 02:46:07 -050029
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050030# Where make install puts libpng.a, libpng14.so*, and png.h
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060031prefix=/usr/local
Glenn Randers-Pehrsonad310542006-04-18 05:31:20 -050032exec_prefix=$(prefix)
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060033
Andreas Dilger47a0c421997-05-16 02:46:07 -050034# Where the zlib library and include files are located
Glenn Randers-Pehrsonf9f2fe01998-03-15 18:20:23 -060035# Changing these to ../zlib poses a security risk. If you want
36# to have zlib in an adjacent directory, specify the full path instead of "..".
37#ZLIBLIB=../zlib
38#ZLIBINC=../zlib
39
40ZLIBLIB=/usr/local/lib
41ZLIBINC=/usr/local/include
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -060042
Andreas Dilger47a0c421997-05-16 02:46:07 -050043WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050044 -Wmissing-declarations -Wtraditional -Wcast-align \
45 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
Glenn Randers-Pehrsondff799e2004-08-07 21:42:49 -050046CFLAGS=-I$(ZLIBINC) -Wall -O \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050047 # $(WARNMORE) -g -DPNG_DEBUG=5
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050048LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng14 -lz -lm
Guy Schalnat4ee97b01996-01-16 01:51:56 -060049
Andreas Dilger47a0c421997-05-16 02:46:07 -050050INCPATH=$(prefix)/include
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060051LIBPATH=$(exec_prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050052MANPATH=$(prefix)/man
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060053BINPATH=$(exec_prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050054
55# override DESTDIR= on the make install command line to easily support
56# installing into a temporary location. Example:
57#
58# make install DESTDIR=/tmp/build/libpng
59#
60# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050061# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050062# you execute make install.
63DESTDIR=
Guy Schalnat4ee97b01996-01-16 01:51:56 -060064
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050065DB=$(DESTDIR)$(BINPATH)
66DI=$(DESTDIR)$(INCPATH)
67DL=$(DESTDIR)$(LIBPATH)
68DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050069
Andreas Dilger47a0c421997-05-16 02:46:07 -050070OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050071 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
72 pngwtran.o pngmem.o pngerror.o pngpread.o
Guy Schalnat4ee97b01996-01-16 01:51:56 -060073
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060074OBJSDLL = $(OBJS:.o=.pic.o)
75
76.SUFFIXES: .c .o .pic.o
77
78.c.pic.o:
79 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
80
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060081all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
Guy Schalnat4ee97b01996-01-16 01:51:56 -060082
83libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060084 $(AR_RC) $@ $(OBJS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060085 $(RANLIB) $@
86
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050087libpng.pc:
88 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
89
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050090libpng-config:
91 ( cat scripts/libpng-config-head.in; \
92 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050093 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050094 echo cppflags=\"-DPNG_USE_PNGGCCRD -DPNG_NO_MMX_CODE\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050095 echo L_opts=\"-L$(LIBPATH)\"; \
96 echo R_opts=\"-R$(LIBPATH)\"; \
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050097 echo libs=\"-lpng14 -lz -lm\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050098 cat scripts/libpng-config-body.in ) > libpng-config
99 chmod +x libpng-config
100
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600101$(LIBSO): $(LIBSOMAJ)
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500102 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600103
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600104$(LIBSOMAJ): $(LIBSOVER)
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500105 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600106
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600107$(LIBSOVER): $(OBJSDLL)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600108 @case "`type ld`" in *ucb*) \
109 echo; \
110 echo '## WARNING:'; \
111 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
112 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
113 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
114 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
115 echo '## at all. If it is, things are likely to break because of'; \
116 echo '## the libucb dependency that is created.'; \
117 echo; \
118 ;; \
119 esac
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600120 $(LD) -G -h $(LIBSOMAJ) \
121 -o $(LIBSOVER) $(OBJSDLL)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600122
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600123$(OLDSOVER): $(OBJS)
124 $(LD) -G -h $(OLDSOMAJ) \
125 -o $(OLDSOVER) $(OBJSDLL)
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500126
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600127pngtest: pngtest.o $(LIBSO)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600128 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600129
130test: pngtest
131 ./pngtest
132
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600133install-headers: png.h pngconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600134 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
135 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500136 cp png.h pngconf.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500137 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600138 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
139 -@$(RM_F) $(DI)/libpng
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500140 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600141
142install-static: install-headers libpng.a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600143 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500144 cp libpng.a $(DL)/$(LIBNAME).a
145 chmod 644 $(DL)/$(LIBNAME).a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600146 -@$(RM_F) $(DL)/libpng.a
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500147 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600148
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600149install-shared: install-headers $(LIBSOVER) libpng.pc \
150 $(OLDSOVER)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600151 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600152 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
153 -@$(RM_F) $(DL)/$(LIBSOMAJ)
154 -@$(RM_F) $(DL)/$(OLDSO)
155 -@$(RM_F) $(DL)/$(OLDSOMAJ)
156 -@$(RM_F) $(DL)/$(OLDSOVER)*
157 cp $(LIBSOVER) $(DL)
158 cp $(OLDSOVER) $(DL)
159 chmod 755 $(DL)/$(LIBSOVER)
160 chmod 755 $(DL)/$(OLDSOVER)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500161 (cd $(DL); \
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500162 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
163 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
164 $(LN_SF) $(LIBSOVER) $(LIBSO); \
165 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ))
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600166 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
167 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
168 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500169 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
170 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500171 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600172
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500173install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600174 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
175 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
176 -@$(RM_F) $(DM)/man3/libpng.3
177 -@$(RM_F) $(DM)/man3/libpngpf.3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500178 cp libpng.3 $(DM)/man3
179 cp libpngpf.3 $(DM)/man3
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600180 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
181 -@$(RM_F) $(DM)/man5/png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500182 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500183
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500184install-config: libpng-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600185 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
186 -@$(RM_F) $(DB)/libpng-config
187 -@$(RM_F) $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500188 cp libpng-config $(DB)/$(LIBNAME)-config
189 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500190 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500191
192install: install-static install-shared install-man install-config
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600193
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500194# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500195# move the library to its final location. Use test-dd to test it
196# before then.
197
198test-dd:
199 echo
200 echo Testing installed dynamic shared library in $(DL).
201 $(CC) -I$(DI) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600202 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
203 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500204 -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
205 ./pngtestd pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500206
207test-installed:
208 echo
209 echo Testing installed dynamic shared library.
210 $(CC) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600211 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
212 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500213 -L$(ZLIBLIB) -R$(ZLIBLIB)
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500214 ./pngtesti pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500215
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600216clean:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600217 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600218 libpng-config $(LIBSO) $(LIBSOMAJ)* \
219 $(OLDSOVER) \
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500220 libpng.pc
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600221
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600222DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
223writelock:
224 chmod a-w *.[ch35] $(DOCS) scripts/*
225
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600226# DO NOT DELETE THIS LINE -- make depend depends on it.
227
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500228png.o png.pic.o: png.h pngconf.h pngintrn.h
229pngerror.o pngerror.pic.o: png.h pngconf.h pngintrn.h
230pngrio.o pngrio.pic.o: png.h pngconf.h pngintrn.h
231pngwio.o pngwio.pic.o: png.h pngconf.h pngintrn.h
232pngmem.o pngmem.pic.o: png.h pngconf.h pngintrn.h
233pngset.o pngset.pic.o: png.h pngconf.h pngintrn.h
234pngget.o pngget.pic.o: png.h pngconf.h pngintrn.h
235pngread.o pngread.pic.o: png.h pngconf.h pngintrn.h
236pngrtran.o pngrtran.pic.o: png.h pngconf.h pngintrn.h
237pngrutil.o pngrutil.pic.o: png.h pngconf.h pngintrn.h
238pngtrans.o pngtrans.pic.o: png.h pngconf.h pngintrn.h
239pngwrite.o pngwrite.pic.o: png.h pngconf.h pngintrn.h
240pngwtran.o pngwtran.pic.o: png.h pngconf.h pngintrn.h
241pngwutil.o pngwutil.pic.o: png.h pngconf.h pngintrn.h
242pngpread.o pngpread.pic.o: png.h pngconf.h pngintrn.h
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600243
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500244pngtest.o: png.h pngconf.h pngintrn.h