blob: eb1fa99a6603ca478bfc148a16cce333871e4894 [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-Pehrson56f63962008-10-06 10:16:17 -05008PNGMAJ = 14
Glenn Randers-Pehrsona93c9422009-04-13 11:41:33 -05009PNGMIN = 1.4.0beta54
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-Pehrsonbeb572e2006-08-19 13:59:24 -050079all: libpng.a pngtest shared libpng.pc libpng-config pngconf.h pngdefs.h
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -060080
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -050081pngdefs.h:
82 echo "/* pngdefs.h was built by makefile.sgi */" > pngdefs.h
83 echo "#define PNG_NO_MMX_CODE" >> pngdefs.h
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -050084
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -050085libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060086 $(AR_RC) $@ $(OBJS)
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -050087 $(RANLIB) $@
88
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060089shared: $(LIBSOVER)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050090
91libpng.pc:
92 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060093
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050094libpng-config:
95 ( cat scripts/libpng-config-head.in; \
96 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050097 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
Glenn Randers-Pehrsone826d7e2006-07-03 00:21:58 -050098 echo cppflags=\""; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050099 echo ccopts=\"$(ABI)\"; \
100 echo ldopts=\"$(ABI)\"; \
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -0500101 echo L_opts=\"-L$(LIBPATH)\"; \
102 echo libdir=\"$(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)
108 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -0500109
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600110$(LIBSOMAJ): $(LIBSOVER)
111 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600112
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600113$(LIBSOVER): $(OBJS)
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -0600114 $(LDSHARED) -o $@ $(OBJS)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600115 $(RM_F) $(LIBSO) $(LIBSOMAJ)
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -0600116
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600117pngtest: pngtest.o libpng.a
Glenn Randers-Pehrsonea3bcd71998-03-07 14:33:00 -0600118 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600119
120test: pngtest
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -0500121 echo
122 echo Testing local static library.
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600123 ./pngtest
124
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500125install-headers: png.h pngconf.h pngdefs.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600126 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
127 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500128 cp png.h pngconf.h pngdefs.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -0500129 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500130 chmod 644 $(DI)/$(LIBNAME)/pngdefs.h
131 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pngdefs.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600132 -@$(RM_F) $(DI)/libpng
133 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600134
135install-static: install-headers libpng.a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600136 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500137 cp libpng.a $(DL)/$(LIBNAME).a
138 chmod 644 $(DL)/$(LIBNAME).a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600139 -@$(RM_F) $(DL)/libpng.a
140 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600141
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500142install-shared: install-headers $(LIBSOVER) libpng.pc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600143 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600144 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
145 -@$(RM_F) $(DL)/$(LIBSOMAJ)
146 -@$(RM_F) $(DL)/$(OLDSO)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600147 cp $(LIBSOVER) $(DL)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600148 chmod 755 $(DL)/$(LIBSOVER)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500149 (cd $(DL); \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600150 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500151 $(LN_SF) $(LIBSOMAJ) $(LIBSO); \
152 $(LN_SF) $(OLDSO) $(LIBSO))
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600153 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
154 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
155 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500156 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
157 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600158 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600159
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500160install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600161 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
162 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
163 -@$(RM_F) $(DM)/man3/libpng.3
164 -@$(RM_F) $(DM)/man3/libpngpf.3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500165 cp libpng.3 $(DM)/man3
166 cp libpngpf.3 $(DM)/man3
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600167 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
168 -@$(RM_F) $(DM)/man5/png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500169 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500170
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500171install-config: libpng-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600172 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
173 -@$(RM_F) $(DB)/libpng-config
174 -@$(RM_F) $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500175 cp libpng-config $(DB)/$(LIBNAME)-config
176 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600177 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500178
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500179install: install-static install-shared install-man install-config
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -0600180
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -0500181# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500182# move the library to its final location. Use test-dd to test it
183# before then.
184
185test-dd:
186 echo
187 echo Testing installed dynamic shared library in $(DL).
188 $(CC) -I$(DI) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600189 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500190 -L$(DL) -L$(ZLIBLIB) \
191 -rpath $(ZLIBLIB):$(DL) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600192 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500193 ./pngtestd pngtest.png
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -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 \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500200 -L$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600201 -rpath $(ZLIBLIB):`$(BINPATH)/$(LIBNAME)-config --libdir` \
202 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500203 ./pngtesti pngtest.png
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -0500204
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600205clean:
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500206 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png libpng.pc
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500207 libpng-config $(LIBSO) $(LIBSOMAJ)* so_locations pngdefs.h
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -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
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600213# DO NOT DELETE THIS LINE -- make depend depends on it.
214
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500215png.o: png.h pngconf.h pngdefs.h pngpriv.h
216pngerror.o: png.h pngconf.h pngdefs.h pngpriv.h
217pngrio.o: png.h pngconf.h pngdefs.h pngpriv.h
218pngwio.o: png.h pngconf.h pngdefs.h pngpriv.h
219pngmem.o: png.h pngconf.h pngdefs.h pngpriv.h
220pngset.o: png.h pngconf.h pngdefs.h pngpriv.h
221pngget.o: png.h pngconf.h pngdefs.h pngpriv.h
222pnggccrd.o: png.h pngconf.h pngdefs.h pngpriv.h
223pngread.o: png.h pngconf.h pngdefs.h pngpriv.h
224pngrtran.o: png.h pngconf.h pngdefs.h pngpriv.h
225pngrutil.o: png.h pngconf.h pngdefs.h pngpriv.h
226pngtrans.o: png.h pngconf.h pngdefs.h pngpriv.h
227pngwrite.o: png.h pngconf.h pngdefs.h pngpriv.h
228pngwtran.o: png.h pngconf.h pngdefs.h pngpriv.h
229pngwutil.o: png.h pngconf.h pngdefs.h pngpriv.h
230pngpread.o: png.h pngconf.h pngdefs.h pngpriv.h
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600231
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500232pngtest.o: png.h pngconf.h pngdefs.h