blob: efac8e18ac9aed516f84bae82bb75d7d117fad42 [file] [log] [blame]
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001# makefile for libpng.a and libpng14.so, SGI IRIX with 'cc'
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -06002# Copyright (C) 2001-2002, 2006 Glenn Randers-Pehrson
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -06003# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
4# For conditions of distribution and use, see copyright notice in png.h
5
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -06006# Library name:
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05007LIBNAME=libpng14
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -05008PNGMAJ = 0
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -05009PNGMIN = 1.4.0beta4
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -050010PNGVER = $(PNGMAJ).$(PNGMIN)
11
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060012# Shared library names:
13LIBSO=$(LIBNAME).so
14LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
15LIBSOVER=$(LIBNAME).so.$(PNGVER)
16OLDSO=libpng.so
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060017
18# Utilities:
19AR_RC=ar rc
20CC=cc
21MKDIR_P=mkdir -p
22LN_SF=ln -sf
23RANLIB=echo
24RM_F=/bin/rm -f
25
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050026# Where make install puts libpng.a, libpng14.so, and libpng14/png.h
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -050027# Prefix must be a full pathname.
28
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
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060032# Where the zlib library and include files are located
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -060033#ZLIBLIB=/usr/local/lib32
34#ZLIBINC=/usr/local/include
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060035#ZLIBLIB=/usr/local/lib
36#ZLIBINC=/usr/local/include
37ZLIBLIB=../zlib
38ZLIBINC=../zlib
39
Glenn Randers-Pehrsonb1828932001-06-23 08:03:17 -050040# ABI can be blank to use default for your system, -32, -o32, -n32, or -64
41# See "man abi". zlib must be built with the same ABI.
42ABI=
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -060043
Glenn Randers-Pehrsonb1828932001-06-23 08:03:17 -050044WARNMORE=-fullwarn
45# Note: -KPIC is the default anyhow
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -050046#CFLAGS= $(ABI) -I$(ZLIBINC) -O $(WARNMORE) -KPIC # -g -DPNG_DEBUG=5
47CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE)
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050048LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng14 -lz -lm
Glenn Randers-Pehrsonb1828932001-06-23 08:03:17 -050049LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060050LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -050051 -set_version sgi$(PNGMAJ).0
Glenn Randers-Pehrsonb1828932001-06-23 08:03:17 -050052# See "man dso" for info about shared objects
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050053
Glenn Randers-Pehrsonae498dc2001-11-24 14:53:31 -060054INCPATH=$(prefix)/include
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060055LIBPATH=$(exec_prefix)/lib
56#LIBPATH=$(exec_prefix)/lib32
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050057MANPATH=$(prefix)/man
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060058BINPATH=$(exec_prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050059
60# override DESTDIR= on the make install command line to easily support
61# installing into a temporary location. Example:
62#
63# make install DESTDIR=/tmp/build/libpng
64#
65# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050066# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050067# you execute make install.
68DESTDIR=
Glenn Randers-Pehrsonae498dc2001-11-24 14:53:31 -060069
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050070DB=$(DESTDIR)$(BINPATH)
71DI=$(DESTDIR)$(INCPATH)
72DL=$(DESTDIR)$(LIBPATH)
73DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050074
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060075OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060076 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
77 pngwtran.o pngmem.o pngerror.o pngpread.o
78
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050079all: libpng.a pngtest shared libpng.pc libpng-config
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -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
87 /* if you don't want to use the intel MMX code, uncomment this */
88 # echo "#define PNG_NO_MMX_CODE" >> pngconf.h
89
90 /* if you don't need thread safety you can uncomment this */
91 # echo "#define PNG_THREAD_UNSAFE_OK" >> pngconf.h
92
93 sed "1,/Makefile-supplied defines go here:/d" pngconf.h.in >> pngconf.h
94
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -050095libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060096 $(AR_RC) $@ $(OBJS)
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -050097 $(RANLIB) $@
98
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060099shared: $(LIBSOVER)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500100
101libpng.pc:
102 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600103
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500104libpng-config:
105 ( cat scripts/libpng-config-head.in; \
106 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -0500107 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500108 echo cppflags=\"-DPNG_USE_PNGGCCRD -DPNG_NO_MMX_CODE\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -0500109 echo ccopts=\"$(ABI)\"; \
110 echo ldopts=\"$(ABI)\"; \
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -0500111 echo L_opts=\"-L$(LIBPATH)\"; \
112 echo libdir=\"$(LIBPATH)\"; \
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500113 echo libs=\"-lpng14 -lz -lm\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500114 cat scripts/libpng-config-body.in ) > libpng-config
115 chmod +x libpng-config
116
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600117$(LIBSO): $(LIBSOMAJ)
118 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -0500119
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600120$(LIBSOMAJ): $(LIBSOVER)
121 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600122
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600123$(LIBSOVER): $(OBJS)
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -0600124 $(LDSHARED) -o $@ $(OBJS)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600125 $(RM_F) $(LIBSO) $(LIBSOMAJ)
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -0600126
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600127pngtest: pngtest.o libpng.a
Glenn Randers-Pehrsonea3bcd71998-03-07 14:33:00 -0600128 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600129
130test: pngtest
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -0500131 echo
132 echo Testing local static library.
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600133 ./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-Pehrsond1e8c862002-06-20 06:54:34 -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
142 (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
149 (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-Pehrson4deeb792006-03-22 16:21:59 -0600159 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500160 $(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-Pehrson5c60b232006-03-07 07:09:22 -0600167 (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-Pehrson5c60b232006-03-07 07:09:22 -0600186 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500187
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500188install: install-static install-shared install-man install-config
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -0600189
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -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 \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500199 -L$(DL) -L$(ZLIBLIB) \
200 -rpath $(ZLIBLIB):$(DL) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600201 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500202 ./pngtestd pngtest.png
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -0500203
204test-installed:
205 echo
206 echo Testing installed dynamic shared library.
207 $(CC) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600208 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500209 -L$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600210 -rpath $(ZLIBLIB):`$(BINPATH)/$(LIBNAME)-config --libdir` \
211 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500212 ./pngtesti pngtest.png
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -0500213
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600214clean:
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500215 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png libpng.pc
216 libpng-config $(LIBSO) $(LIBSOMAJ)* so_locations
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600217
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600218DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
219writelock:
220 chmod a-w *.[ch35] $(DOCS) scripts/*
221
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600222# DO NOT DELETE THIS LINE -- make depend depends on it.
223
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500224png.o: png.h pngconf.h pngintrn.h
225pngerror.o: png.h pngconf.h pngintrn.h
226pngrio.o: png.h pngconf.h pngintrn.h
227pngwio.o: png.h pngconf.h pngintrn.h
228pngmem.o: png.h pngconf.h pngintrn.h
229pngset.o: png.h pngconf.h pngintrn.h
230pngget.o: png.h pngconf.h pngintrn.h
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -0500231pnggccrd.o: png.h pngconf.h pngintrn.h
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500232pngread.o: png.h pngconf.h pngintrn.h
233pngrtran.o: png.h pngconf.h pngintrn.h
234pngrutil.o: png.h pngconf.h pngintrn.h
235pngtest.o: png.h pngconf.h pngintrn.h
236pngtrans.o: png.h pngconf.h pngintrn.h
237pngwrite.o: png.h pngconf.h pngintrn.h
238pngwtran.o: png.h pngconf.h pngintrn.h
239pngwutil.o: png.h pngconf.h pngintrn.h
240pngpread.o: png.h pngconf.h pngintrn.h
241pnggccrd.o: png.h pngconf.h pngintrn.h
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600242