1 # makefile for libpng.a and libpng12.so, SGI IRIX with 'cc'
2 # Copyright (C) 2001-2002 Glenn Randers-Pehrson
3 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
4 # For conditions of distribution and use, see copyright notice in png.h
6 # Where make install puts libpng.a, libpng12.so, and libpng12/png.h
7 # Prefix must be a full pathname.
11 # Where the zlib library and include files are located
12 #ZLIBLIB=/usr/local/lib32
13 #ZLIBINC=/usr/local/include
14 #ZLIBLIB=/usr/local/lib
15 #ZLIBINC=/usr/local/include
22 PNGVER = $(PNGMAJ).$(PNGMIN)
25 # ABI can be blank to use default for your system, -32, -o32, -n32, or -64
26 # See "man abi". zlib must be built with the same ABI.
29 WARNMORE= # -g -DPNG_DEBUG=5
30 CFLAGS=$(ABI) -I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32
31 LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
32 LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ) \
33 -set_version sgi$(PNGMAJ).0
34 LDLEGACY=cc $(ABI) -shared -soname libpng.so.3 \
36 # See "man dso" for info about shared objects
41 INCPATH=$(prefix)/include
43 #LIBPATH=$(prefix)/lib32
47 # override DESTDIR= on the make install command line to easily support
48 # installing into a temporary location. Example:
50 # make install DESTDIR=/tmp/build/libpng
52 # If you're going to install into a temporary location
53 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
54 # you execute make install.
57 DB=$(DESTDIR)$(BINPATH)
58 DI=$(DESTDIR)$(INCPATH)
59 DL=$(DESTDIR)$(LIBPATH)
60 DM=$(DESTDIR)$(MANPATH)
62 OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
63 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
64 pngwtran.o pngmem.o pngerror.o pngpread.o
66 all: libpng.a pngtest shared libpng.pc libpng-config
72 shared: $(LIBNAME).so.$(PNGVER)
75 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
78 ( cat scripts/libpng-config-head.in; \
79 echo prefix=\"$(prefix)\"; \
80 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
81 echo ccopts=\"$(ABI)\"; \
82 echo ldopts=\"$(ABI)\"; \
83 echo L_opts=\"-L$(LIBPATH)\"; \
84 echo libdir=\"$(LIBPATH)\"; \
85 echo libs=\"-lpng12 -lz -lm\"; \
86 cat scripts/libpng-config-body.in ) > libpng-config
87 chmod +x libpng-config
89 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
90 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
92 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
93 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
95 $(LIBNAME).so.$(PNGVER): $(OBJS)
96 $(LDSHARED) -o $@ $(OBJS)
97 rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
99 libpng.so.3.$(PNGMIN): $(OBJS)
100 $(LDLEGACY) -o $@ $(OBJS)
102 pngtest: pngtest.o libpng.a
103 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
107 echo Testing local static library.
110 install-headers: png.h pngconf.h
111 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
112 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
113 cp png.h pngconf.h $(DI)/$(LIBNAME)
114 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
115 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
116 -@/bin/rm -f $(DI)/libpng
117 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
119 install-static: install-headers libpng.a
120 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
121 cp libpng.a $(DL)/$(LIBNAME).a
122 chmod 644 $(DL)/$(LIBNAME).a
123 -@/bin/rm -f $(DL)/libpng.a
124 (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
126 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
127 libpng.so.3.$(PNGMIN)
128 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
129 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
130 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
131 -@/bin/rm -f $(DL)/libpng.so
132 -@/bin/rm -f $(DL)/libpng.so.3
133 -@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
134 cp $(LIBNAME).so.$(PNGVER) $(DL)
135 cp libpng.so.3.$(PNGMIN) $(DL)
136 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
137 chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
139 ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \
140 ln -sf libpng.so.3 libpng.so; \
141 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
142 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
143 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
144 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
145 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
146 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
147 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
148 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
150 install-man: libpng.3 libpngpf.3 png.5
151 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
152 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
153 -@/bin/rm -f $(DM)/man3/libpng.3
154 -@/bin/rm -f $(DM)/man3/libpngpf.3
155 cp libpng.3 $(DM)/man3
156 cp libpngpf.3 $(DM)/man3
157 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
158 -@/bin/rm -f $(DM)/man5/png.5
161 install-config: libpng-config
162 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
163 -@/bin/rm -f $(DB)/libpng-config
164 -@/bin/rm -f $(DB)/$(LIBNAME)-config
165 cp libpng-config $(DB)/$(LIBNAME)-config
166 chmod 755 $(DB)/$(LIBNAME)-config
167 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
169 install: install-static install-shared install-man install-config
171 # If you installed in $(DESTDIR), test-installed won't work until you
172 # move the library to its final location. Use test-dd to test it
177 echo Testing installed dynamic shared library in $(DL).
178 $(CC) -I$(DI) -I$(ZLIBINC) \
179 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
180 -L$(DL) -L$(ZLIBLIB) \
181 -rpath $(ZLIBLIB):$(DL)\
182 -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
183 ./pngtestd pngtest.png
187 echo Testing installed dynamic shared library.
189 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
191 -rpath $(ZLIBLIB):`$(BINPATH)/libpng12-config --libdir` \
192 -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
193 ./pngtesti pngtest.png
196 rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
197 $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
198 libpng.so.3.$(PNGMIN) \
201 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
203 chmod a-w *.[ch35] $(DOCS) scripts/*
205 # DO NOT DELETE THIS LINE -- make depend depends on it.
207 png.o: png.h pngconf.h
208 pngerror.o: png.h pngconf.h
209 pngrio.o: png.h pngconf.h
210 pngwio.o: png.h pngconf.h
211 pngmem.o: png.h pngconf.h
212 pngset.o: png.h pngconf.h
213 pngget.o: png.h pngconf.h
214 pngread.o: png.h pngconf.h
215 pngrtran.o: png.h pngconf.h
216 pngrutil.o: png.h pngconf.h
217 pngtest.o: png.h pngconf.h
218 pngtrans.o: png.h pngconf.h
219 pngwrite.o: png.h pngconf.h
220 pngwtran.o: png.h pngconf.h
221 pngwutil.o: png.h pngconf.h
222 pngpread.o: png.h pngconf.h
223 pnggccrd.o: png.h pngconf.h