blob: 754ff87c34b66aa547917ea7ff7959f13286b8f7 [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-Pehrson56f63962008-10-06 10:16:17 -050010PNGMAJ = 14
Glenn Randers-Pehrsond6d80752008-12-02 09:49:43 -060011PNGMIN = 1.4.0beta43
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-Pehrson79084212008-08-04 13:31:41 -050044CFLAGS=-I$(ZLIBINC) -W -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-Pehrsonbeb572e2006-08-19 13:59:24 -050079all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config pngconf.h pngdefs.h
Guy Schalnat4ee97b01996-01-16 01:51:56 -060080
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -050081pngdefs.h:
82 echo "/* pngdefs.h was built by makefile.solaris */" > pngdefs.h
83 echo "#define PNG_NO_MMX_CODE" >> pngdefs.h
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -050084
Guy Schalnat4ee97b01996-01-16 01:51:56 -060085libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060086 $(AR_RC) $@ $(OBJS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060087 $(RANLIB) $@
88
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050089libpng.pc:
90 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
91
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050092libpng-config:
93 ( cat scripts/libpng-config-head.in; \
94 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050095 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -050096 echo cppflags=\"\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050097 echo L_opts=\"-L$(LIBPATH)\"; \
98 echo R_opts=\"-R$(LIBPATH)\"; \
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050099 echo libs=\"-lpng14 -lz -lm\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500100 cat scripts/libpng-config-body.in ) > libpng-config
101 chmod +x libpng-config
102
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600103$(LIBSO): $(LIBSOMAJ)
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500104 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600105
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600106$(LIBSOMAJ): $(LIBSOVER)
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500107 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600108
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600109$(LIBSOVER): $(OBJSDLL)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600110 @case "`type ld`" in *ucb*) \
111 echo; \
112 echo '## WARNING:'; \
113 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
114 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
115 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
116 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
117 echo '## at all. If it is, things are likely to break because of'; \
118 echo '## the libucb dependency that is created.'; \
119 echo; \
120 ;; \
121 esac
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600122 $(LD) -G -h $(LIBSOMAJ) \
123 -o $(LIBSOVER) $(OBJSDLL)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600124
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600125pngtest: pngtest.o $(LIBSO)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600126 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600127
128test: pngtest
129 ./pngtest
130
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500131install-headers: png.h pngconf.h pngdefs.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600132 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
133 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500134 cp png.h pngconf.h pngdefs.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500135 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500136 chmod 644 $(DI)/$(LIBNAME)/pngdefs.h
137 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pngdefs.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600138 -@$(RM_F) $(DI)/libpng
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500139 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600140
141install-static: install-headers libpng.a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600142 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500143 cp libpng.a $(DL)/$(LIBNAME).a
144 chmod 644 $(DL)/$(LIBNAME).a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600145 -@$(RM_F) $(DL)/libpng.a
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500146 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600147
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500148install-shared: install-headers $(LIBSOVER) libpng.pc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600149 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600150 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
151 -@$(RM_F) $(DL)/$(LIBSOMAJ)
152 -@$(RM_F) $(DL)/$(OLDSO)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600153 cp $(LIBSOVER) $(DL)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600154 chmod 755 $(DL)/$(LIBSOVER)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500155 (cd $(DL); \
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500156 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
157 $(LN_SF) $(LIBSOMAJ) $(LIBSO); \
158 $(LN_SF) $(OLDSO) $(LIBSO))
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600159 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
160 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
161 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500162 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
163 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500164 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600165
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500166install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600167 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
168 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
169 -@$(RM_F) $(DM)/man3/libpng.3
170 -@$(RM_F) $(DM)/man3/libpngpf.3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500171 cp libpng.3 $(DM)/man3
172 cp libpngpf.3 $(DM)/man3
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600173 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
174 -@$(RM_F) $(DM)/man5/png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500175 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500176
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500177install-config: libpng-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600178 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
179 -@$(RM_F) $(DB)/libpng-config
180 -@$(RM_F) $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500181 cp libpng-config $(DB)/$(LIBNAME)-config
182 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500183 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500184
185install: install-static install-shared install-man install-config
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600186
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500187# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500188# move the library to its final location. Use test-dd to test it
189# before then.
190
191test-dd:
192 echo
193 echo Testing installed dynamic shared library in $(DL).
194 $(CC) -I$(DI) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600195 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
196 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500197 -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
198 ./pngtestd pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500199
200test-installed:
201 echo
202 echo Testing installed dynamic shared library.
203 $(CC) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600204 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
205 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500206 -L$(ZLIBLIB) -R$(ZLIBLIB)
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500207 ./pngtesti pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500208
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600209clean:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600210 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600211 libpng-config $(LIBSO) $(LIBSOMAJ)* \
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500212 libpng.pc pngdefs.h
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600213
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600214DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
215writelock:
216 chmod a-w *.[ch35] $(DOCS) scripts/*
217
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600218# DO NOT DELETE THIS LINE -- make depend depends on it.
219
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500220png.o png.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
221pngerror.o pngerror.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
222pngrio.o pngrio.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
223pngwio.o pngwio.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
224pngmem.o pngmem.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
225pngset.o pngset.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
226pnggccrd.o pnggccrd.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
227pngget.o pngget.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500228pngread.o pngread.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
229pngrtran.o pngrtran.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
230pngrutil.o pngrutil.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
231pngtrans.o pngtrans.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
232pngwrite.o pngwrite.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
233pngwtran.o pngwtran.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
234pngwutil.o pngwutil.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
235pngpread.o pngpread.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600236
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500237pngtest.o: png.h pngconf.h pngdefs.h