blob: efffd82461373ab8b9c8f74b2d15624000196e57 [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-Pehrsond60b8fa2006-04-20 21:31:14 -050011PNGMIN = 1.4.0beta2
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
81libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060082 $(AR_RC) $@ $(OBJS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060083 $(RANLIB) $@
84
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050085libpng.pc:
86 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
87
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050088libpng-config:
89 ( cat scripts/libpng-config-head.in; \
90 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050091 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050092 echo cppflags=\"-DPNG_USE_PNGGCCRD -DPNG_NO_MMX_CODE\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050093 echo L_opts=\"-L$(LIBPATH)\"; \
94 echo R_opts=\"-R$(LIBPATH)\"; \
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050095 echo libs=\"-lpng14 -lz -lm\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050096 cat scripts/libpng-config-body.in ) > libpng-config
97 chmod +x libpng-config
98
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060099$(LIBSO): $(LIBSOMAJ)
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500100 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600101
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600102$(LIBSOMAJ): $(LIBSOVER)
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500103 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600104
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600105$(LIBSOVER): $(OBJSDLL)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600106 @case "`type ld`" in *ucb*) \
107 echo; \
108 echo '## WARNING:'; \
109 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
110 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
111 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
112 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
113 echo '## at all. If it is, things are likely to break because of'; \
114 echo '## the libucb dependency that is created.'; \
115 echo; \
116 ;; \
117 esac
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600118 $(LD) -G -h $(LIBSOMAJ) \
119 -o $(LIBSOVER) $(OBJSDLL)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600120
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600121pngtest: pngtest.o $(LIBSO)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600122 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600123
124test: pngtest
125 ./pngtest
126
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600127install-headers: png.h pngconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600128 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
129 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500130 cp png.h pngconf.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500131 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600132 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
133 -@$(RM_F) $(DI)/libpng
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500134 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600135
136install-static: install-headers libpng.a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600137 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500138 cp libpng.a $(DL)/$(LIBNAME).a
139 chmod 644 $(DL)/$(LIBNAME).a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600140 -@$(RM_F) $(DL)/libpng.a
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500141 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600142
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500143install-shared: install-headers $(LIBSOVER) libpng.pc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600144 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600145 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
146 -@$(RM_F) $(DL)/$(LIBSOMAJ)
147 -@$(RM_F) $(DL)/$(OLDSO)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600148 cp $(LIBSOVER) $(DL)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600149 chmod 755 $(DL)/$(LIBSOVER)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500150 (cd $(DL); \
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500151 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
152 $(LN_SF) $(LIBSOMAJ) $(LIBSO); \
153 $(LN_SF) $(OLDSO) $(LIBSO))
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600154 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
155 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
156 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500157 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
158 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500159 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600160
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500161install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600162 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
163 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
164 -@$(RM_F) $(DM)/man3/libpng.3
165 -@$(RM_F) $(DM)/man3/libpngpf.3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500166 cp libpng.3 $(DM)/man3
167 cp libpngpf.3 $(DM)/man3
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600168 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
169 -@$(RM_F) $(DM)/man5/png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500170 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500171
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500172install-config: libpng-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600173 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
174 -@$(RM_F) $(DB)/libpng-config
175 -@$(RM_F) $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500176 cp libpng-config $(DB)/$(LIBNAME)-config
177 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500178 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500179
180install: install-static install-shared install-man install-config
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600181
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500182# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500183# move the library to its final location. Use test-dd to test it
184# before then.
185
186test-dd:
187 echo
188 echo Testing installed dynamic shared library in $(DL).
189 $(CC) -I$(DI) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600190 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
191 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500192 -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
193 ./pngtestd pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500194
195test-installed:
196 echo
197 echo Testing installed dynamic shared library.
198 $(CC) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600199 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
200 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500201 -L$(ZLIBLIB) -R$(ZLIBLIB)
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500202 ./pngtesti pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500203
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600204clean:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600205 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600206 libpng-config $(LIBSO) $(LIBSOMAJ)* \
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-Pehrson17218292006-04-20 07:20:46 -0500215png.o png.pic.o: png.h pngconf.h pngintrn.h
216pngerror.o pngerror.pic.o: png.h pngconf.h pngintrn.h
217pngrio.o pngrio.pic.o: png.h pngconf.h pngintrn.h
218pngwio.o pngwio.pic.o: png.h pngconf.h pngintrn.h
219pngmem.o pngmem.pic.o: png.h pngconf.h pngintrn.h
220pngset.o pngset.pic.o: png.h pngconf.h pngintrn.h
221pngget.o pngget.pic.o: png.h pngconf.h pngintrn.h
222pngread.o pngread.pic.o: png.h pngconf.h pngintrn.h
223pngrtran.o pngrtran.pic.o: png.h pngconf.h pngintrn.h
224pngrutil.o pngrutil.pic.o: png.h pngconf.h pngintrn.h
225pngtrans.o pngtrans.pic.o: png.h pngconf.h pngintrn.h
226pngwrite.o pngwrite.pic.o: png.h pngconf.h pngintrn.h
227pngwtran.o pngwtran.pic.o: png.h pngconf.h pngintrn.h
228pngwutil.o pngwutil.pic.o: png.h pngconf.h pngintrn.h
229pngpread.o pngpread.pic.o: png.h pngconf.h pngintrn.h
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600230
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500231pngtest.o: png.h pngconf.h pngintrn.h