blob: 567bd1c04add78ee105dd012f2084df5f7de0e0f [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-Pehrsonf46918d2006-06-02 05:31:20 -050010PNGMAJ = 1
11PNGMIN = 1.4.0beta6
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-Pehrson4deeb792006-03-22 16:21:59 -060019
20# Utilities:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060021AR_RC=ar rc
Guy Schalnat4ee97b01996-01-16 01:51:56 -060022CC=gcc
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -060023MKDIR_P=mkdir -p
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060024LN_SF=ln -f -s
25RANLIB=echo
26RM_F=/bin/rm -f
Andreas Dilger47a0c421997-05-16 02:46:07 -050027
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050028# Where make install puts libpng.a, libpng14.so*, and png.h
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060029prefix=/usr/local
Glenn Randers-Pehrsonad310542006-04-18 05:31:20 -050030exec_prefix=$(prefix)
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060031
Andreas Dilger47a0c421997-05-16 02:46:07 -050032# Where the zlib library and include files are located
Glenn Randers-Pehrsonf9f2fe01998-03-15 18:20:23 -060033# Changing these to ../zlib poses a security risk. If you want
34# to have zlib in an adjacent directory, specify the full path instead of "..".
35#ZLIBLIB=../zlib
36#ZLIBINC=../zlib
37
38ZLIBLIB=/usr/local/lib
39ZLIBINC=/usr/local/include
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -060040
Andreas Dilger47a0c421997-05-16 02:46:07 -050041WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050042 -Wmissing-declarations -Wtraditional -Wcast-align \
43 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
Glenn Randers-Pehrsondff799e2004-08-07 21:42:49 -050044CFLAGS=-I$(ZLIBINC) -Wall -O \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050045 # $(WARNMORE) -g -DPNG_DEBUG=5
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050046LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng14 -lz -lm
Guy Schalnat4ee97b01996-01-16 01:51:56 -060047
Andreas Dilger47a0c421997-05-16 02:46:07 -050048INCPATH=$(prefix)/include
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060049LIBPATH=$(exec_prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050050MANPATH=$(prefix)/man
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060051BINPATH=$(exec_prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050052
53# override DESTDIR= on the make install command line to easily support
54# installing into a temporary location. Example:
55#
56# make install DESTDIR=/tmp/build/libpng
57#
58# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050059# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050060# you execute make install.
61DESTDIR=
Guy Schalnat4ee97b01996-01-16 01:51:56 -060062
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050063DB=$(DESTDIR)$(BINPATH)
64DI=$(DESTDIR)$(INCPATH)
65DL=$(DESTDIR)$(LIBPATH)
66DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050067
Andreas Dilger47a0c421997-05-16 02:46:07 -050068OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050069 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
70 pngwtran.o pngmem.o pngerror.o pngpread.o
Guy Schalnat4ee97b01996-01-16 01:51:56 -060071
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060072OBJSDLL = $(OBJS:.o=.pic.o)
73
74.SUFFIXES: .c .o .pic.o
75
76.c.pic.o:
77 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
78
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060079all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
Guy Schalnat4ee97b01996-01-16 01:51:56 -060080
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -050081pngconf.h.in:
82 cat pngconf.h > pngconf.h.in
83
84pngconf.h: pngconf.h.in
85 sed "/Makefile-supplied defines go here:/q" pngconf.h.in > pngconf.h
86 echo "#define PNG_NO_MMX_CODE" >> pngconf.h
87 sed "1,/Makefile-supplied defines go here:/d" pngconf.h.in >> pngconf.h
88
Guy Schalnat4ee97b01996-01-16 01:51:56 -060089libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060090 $(AR_RC) $@ $(OBJS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060091 $(RANLIB) $@
92
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050093libpng.pc:
94 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
95
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050096libpng-config:
97 ( cat scripts/libpng-config-head.in; \
98 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050099 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -0500100 echo cppflags=\"\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -0500101 echo L_opts=\"-L$(LIBPATH)\"; \
102 echo R_opts=\"-R$(LIBPATH)\"; \
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500103 echo libs=\"-lpng14 -lz -lm\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500104 cat scripts/libpng-config-body.in ) > libpng-config
105 chmod +x libpng-config
106
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600107$(LIBSO): $(LIBSOMAJ)
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500108 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600109
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600110$(LIBSOMAJ): $(LIBSOVER)
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500111 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600112
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600113$(LIBSOVER): $(OBJSDLL)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600114 @case "`type ld`" in *ucb*) \
115 echo; \
116 echo '## WARNING:'; \
117 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
118 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
119 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
120 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
121 echo '## at all. If it is, things are likely to break because of'; \
122 echo '## the libucb dependency that is created.'; \
123 echo; \
124 ;; \
125 esac
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600126 $(LD) -G -h $(LIBSOMAJ) \
127 -o $(LIBSOVER) $(OBJSDLL)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600128
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600129pngtest: pngtest.o $(LIBSO)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600130 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600131
132test: pngtest
133 ./pngtest
134
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600135install-headers: png.h pngconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600136 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
137 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500138 cp png.h pngconf.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500139 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600140 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
141 -@$(RM_F) $(DI)/libpng
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500142 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600143
144install-static: install-headers libpng.a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600145 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500146 cp libpng.a $(DL)/$(LIBNAME).a
147 chmod 644 $(DL)/$(LIBNAME).a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600148 -@$(RM_F) $(DL)/libpng.a
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500149 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600150
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500151install-shared: install-headers $(LIBSOVER) libpng.pc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600152 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600153 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
154 -@$(RM_F) $(DL)/$(LIBSOMAJ)
155 -@$(RM_F) $(DL)/$(OLDSO)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600156 cp $(LIBSOVER) $(DL)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600157 chmod 755 $(DL)/$(LIBSOVER)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500158 (cd $(DL); \
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500159 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
160 $(LN_SF) $(LIBSOMAJ) $(LIBSO); \
161 $(LN_SF) $(OLDSO) $(LIBSO))
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600162 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
163 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
164 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500165 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
166 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500167 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600168
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500169install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600170 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
171 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
172 -@$(RM_F) $(DM)/man3/libpng.3
173 -@$(RM_F) $(DM)/man3/libpngpf.3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500174 cp libpng.3 $(DM)/man3
175 cp libpngpf.3 $(DM)/man3
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600176 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
177 -@$(RM_F) $(DM)/man5/png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500178 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500179
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500180install-config: libpng-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600181 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
182 -@$(RM_F) $(DB)/libpng-config
183 -@$(RM_F) $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500184 cp libpng-config $(DB)/$(LIBNAME)-config
185 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500186 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500187
188install: install-static install-shared install-man install-config
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600189
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500190# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500191# move the library to its final location. Use test-dd to test it
192# before then.
193
194test-dd:
195 echo
196 echo Testing installed dynamic shared library in $(DL).
197 $(CC) -I$(DI) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600198 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
199 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500200 -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
201 ./pngtestd pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500202
203test-installed:
204 echo
205 echo Testing installed dynamic shared library.
206 $(CC) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600207 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
208 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500209 -L$(ZLIBLIB) -R$(ZLIBLIB)
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500210 ./pngtesti pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500211
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600212clean:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600213 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600214 libpng-config $(LIBSO) $(LIBSOMAJ)* \
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500215 libpng.pc
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600216
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600217DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
218writelock:
219 chmod a-w *.[ch35] $(DOCS) scripts/*
220
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600221# DO NOT DELETE THIS LINE -- make depend depends on it.
222
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500223png.o png.pic.o: png.h pngconf.h pngintrn.h
224pngerror.o pngerror.pic.o: png.h pngconf.h pngintrn.h
225pngrio.o pngrio.pic.o: png.h pngconf.h pngintrn.h
226pngwio.o pngwio.pic.o: png.h pngconf.h pngintrn.h
227pngmem.o pngmem.pic.o: png.h pngconf.h pngintrn.h
228pngset.o pngset.pic.o: png.h pngconf.h pngintrn.h
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -0500229pnggccrd.o pnggccrd.pic.o: png.h pngconf.h pngintrn.h
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500230pngget.o pngget.pic.o: png.h pngconf.h pngintrn.h
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -0500231pnggccrd.o pngget.pic.o: png.h pngconf.h pngintrn.h
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500232pngread.o pngread.pic.o: png.h pngconf.h pngintrn.h
233pngrtran.o pngrtran.pic.o: png.h pngconf.h pngintrn.h
234pngrutil.o pngrutil.pic.o: png.h pngconf.h pngintrn.h
235pngtrans.o pngtrans.pic.o: png.h pngconf.h pngintrn.h
236pngwrite.o pngwrite.pic.o: png.h pngconf.h pngintrn.h
237pngwtran.o pngwtran.pic.o: png.h pngconf.h pngintrn.h
238pngwutil.o pngwutil.pic.o: png.h pngconf.h pngintrn.h
239pngpread.o pngpread.pic.o: png.h pngconf.h pngintrn.h
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600240
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500241pngtest.o: png.h pngconf.h pngintrn.h