blob: 01bbd09947263ef613e334808c64f623cb8a6f39 [file] [log] [blame]
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -06001# makefile for libpng.a and libpng12.so, SGI IRIX with 'cc'
2# Copyright (C) 2001-2002 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-Pehrsond1e8c862002-06-20 06:54:34 -05006LIBNAME=libpng12
7PNGMAJ = 0
Glenn Randers-Pehrson865f4f02002-09-15 20:30:38 -05008PNGMIN = 1.2.5rc2
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -05009PNGVER = $(PNGMAJ).$(PNGMIN)
10
11# Where make install puts libpng.a, libpng12.so, and libpng12/png.h
12# Prefix must be a full pathname.
13
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060014prefix=/usr/local
15
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060016# Where the zlib library and include files are located
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -060017#ZLIBLIB=/usr/local/lib32
18#ZLIBINC=/usr/local/include
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060019#ZLIBLIB=/usr/local/lib
20#ZLIBINC=/usr/local/include
21ZLIBLIB=../zlib
22ZLIBINC=../zlib
23
24CC=cc
25
Glenn Randers-Pehrsonb1828932001-06-23 08:03:17 -050026# ABI can be blank to use default for your system, -32, -o32, -n32, or -64
27# See "man abi". zlib must be built with the same ABI.
28ABI=
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -060029
Glenn Randers-Pehrsonb1828932001-06-23 08:03:17 -050030WARNMORE=-fullwarn
31# Note: -KPIC is the default anyhow
32#CFLAGS= $(ABI) -I$(ZLIBINC) -O $(WARNMORE) -KPIC -DPNG_USE_PNGGCCRD # -g -DPNG_DEBUG=5
33CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060034LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng12 -lz -lm
Glenn Randers-Pehrsonb1828932001-06-23 08:03:17 -050035LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -050036LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ)
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -050037LDLEGACY=cc $(ABI) -shared -soname libpng.so.3
Glenn Randers-Pehrsonb1828932001-06-23 08:03:17 -050038# See "man dso" for info about shared objects
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050039
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060040RANLIB=echo
41#RANLIB=ranlib
42
Glenn Randers-Pehrsonae498dc2001-11-24 14:53:31 -060043INCPATH=$(prefix)/include
44LIBPATH=$(prefix)/lib
45#LIBPATH=$(prefix)/lib32
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050046MANPATH=$(prefix)/man
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -050047BINPATH=$(prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050048
49# override DESTDIR= on the make install command line to easily support
50# installing into a temporary location. Example:
51#
52# make install DESTDIR=/tmp/build/libpng
53#
54# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050055# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050056# you execute make install.
57DESTDIR=
Glenn Randers-Pehrsonae498dc2001-11-24 14:53:31 -060058
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050059DB=$(DESTDIR)$(BINPATH)
60DI=$(DESTDIR)$(INCPATH)
61DL=$(DESTDIR)$(LIBPATH)
62DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050063
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060064OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060065 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
66 pngwtran.o pngmem.o pngerror.o pngpread.o
67
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050068all: libpng.a pngtest shared libpng.pc libpng-config
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -060069
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -050070libpng.a: $(OBJS)
71 ar rc $@ $(OBJS)
72 $(RANLIB) $@
73
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050074shared: $(LIBNAME).so.$(PNGVER)
75
76libpng.pc:
77 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060078
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050079libpng-config:
80 ( cat scripts/libpng-config-head.in; \
81 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson22f28962002-05-13 18:17:09 -050082 echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_USE_PNGGCCRD \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050083 -DPNG_NO_ASSEMBLER_CODE\"; \
84 echo cflags=\"$(ABI)\"; \
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -050085 echo ldflags=\"-L$(LIBPATH) \"; \
86 echo rpath=\"$(LIBPATH) \"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050087 echo libs=\"-lpng12 -lz -lm\"; \
88 cat scripts/libpng-config-body.in ) > libpng-config
89 chmod +x libpng-config
90
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -050091$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
92 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
93
94$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
95 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060096
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060097$(LIBNAME).so.$(PNGVER): $(OBJS)
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -060098 $(LDSHARED) -o $@ $(OBJS)
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060099 rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -0600100
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500101libpng.so.3.$(PNGMIN): $(OBJS)
102 $(LDLEGACY) -o $@ $(OBJS)
103
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600104pngtest: pngtest.o libpng.a
Glenn Randers-Pehrsonea3bcd71998-03-07 14:33:00 -0600105 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600106
107test: pngtest
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -0500108 echo
109 echo Testing local static library.
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600110 ./pngtest
111
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600112install-headers: png.h pngconf.h
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500113 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
114 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
115 cp png.h pngconf.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -0500116 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500117 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
118 -@/bin/rm -f $(DI)/libpng
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500119 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600120
121install-static: install-headers libpng.a
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500122 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
123 cp libpng.a $(DL)/$(LIBNAME).a
124 chmod 644 $(DL)/$(LIBNAME).a
125 -@/bin/rm -f $(DL)/libpng.a
126 (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600127
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500128install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
129 libpng.so.3.$(PNGMIN)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500130 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500131 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500132 -@/bin/rm -f $(DL)/libpng.so
133 -@/bin/rm -f $(DL)/libpng.so.3
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500134 -@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500135 cp $(LIBNAME).so.$(PNGVER) $(DL)
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500136 cp libpng.so.3.$(PNGMIN) $(DL)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500137 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500138 chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500139 (cd $(DL); \
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500140 ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500141 ln -sf libpng.so.3 libpng.so; \
Glenn Randers-Pehrson299d7352002-05-01 16:55:46 -0500142 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
143 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500144 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
145 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
146 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
147 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
148 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
149 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600150
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500151install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500152 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
153 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
154 -@/bin/rm -f $(DM)/man3/libpng.3
155 -@/bin/rm -f $(DM)/man3/libpngpf.3
156 cp libpng.3 $(DM)/man3
157 cp libpngpf.3 $(DM)/man3
158 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
159 -@/bin/rm -f $(DM)/man5/png.5
160 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500161
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500162install-config: libpng-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500163 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
164 -@/bin/rm -f $(DB)/libpng-config
165 -@/bin/rm -f $(DB)/$(LIBNAME)-config
166 cp libpng-config $(DB)/$(LIBNAME)-config
167 chmod 755 $(DB)/$(LIBNAME)-config
168 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500169
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500170install: install-static install-shared install-man install-config
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -0600171
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -0500172# If you installed in $(DESTDIR), test-installed won't work until you
173# move the library to its final location.
174
175test-installed:
176 echo
177 echo Testing installed dynamic shared library.
178 $(CC) -I$(ZLIBINC) \
179 `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500180 -L$(ZLIBLIB) -rpath $(ZLIBLIB):`$(BINPATH)/libpng12-config --rpath` \
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500181 -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs`
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500182 ./pngtesti pngtest.png
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -0500183
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600184clean:
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -0500185 rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500186 $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
187 libpng.so.3.$(PNGMIN) \
188 so_locations
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600189
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600190DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
191writelock:
192 chmod a-w *.[ch35] $(DOCS) scripts/*
193
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600194# DO NOT DELETE THIS LINE -- make depend depends on it.
195
196png.o: png.h pngconf.h
197pngerror.o: png.h pngconf.h
198pngrio.o: png.h pngconf.h
199pngwio.o: png.h pngconf.h
200pngmem.o: png.h pngconf.h
201pngset.o: png.h pngconf.h
202pngget.o: png.h pngconf.h
203pngread.o: png.h pngconf.h
204pngrtran.o: png.h pngconf.h
205pngrutil.o: png.h pngconf.h
206pngtest.o: png.h pngconf.h
207pngtrans.o: png.h pngconf.h
208pngwrite.o: png.h pngconf.h
209pngwtran.o: png.h pngconf.h
210pngwutil.o: png.h pngconf.h
211pngpread.o: png.h pngconf.h
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600212pnggccrd.o: png.h pngconf.h
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600213