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
9 PNGVER = $(PNGMAJ).$(PNGMIN)
11 # Where make install puts libpng.a, libpng12.so, and libpng12/png.h
12 # Prefix must be a full pathname.
16 # Where the zlib library and include files are located
17 #ZLIBLIB=/usr/local/lib32
18 #ZLIBINC=/usr/local/include
19 #ZLIBLIB=/usr/local/lib
20 #ZLIBINC=/usr/local/include
26 # 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.
31 # Note: -KPIC is the default anyhow
32 #CFLAGS= $(ABI) -I$(ZLIBINC) -O $(WARNMORE) -KPIC -DPNG_USE_PNGGCCRD # -g -DPNG_DEBUG=5
33 CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD \
34 -DPNG_NO_ASSEMBLER_CODE
35 LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng12 -lz -lm
36 LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
37 LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ) \
38 -set_version sgi$(PNGMAJ).0
39 LDLEGACY=cc $(ABI) -shared -soname libpng.so.3 \
41 # See "man dso" for info about shared objects
46 INCPATH=$(prefix)/include
48 #LIBPATH=$(prefix)/lib32
52 # override DESTDIR= on the make install command line to easily support
53 # installing into a temporary location. Example:
55 # make install DESTDIR=/tmp/build/libpng
57 # If you're going to install into a temporary location
58 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
59 # you execute make install.
62 DB=$(DESTDIR)$(BINPATH)
63 DI=$(DESTDIR)$(INCPATH)
64 DL=$(DESTDIR)$(LIBPATH)
65 DM=$(DESTDIR)$(MANPATH)
67 OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
68 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
69 pngwtran.o pngmem.o pngerror.o pngpread.o
71 all: libpng.a pngtest shared libpng.pc libpng-config
77 shared: $(LIBNAME).so.$(PNGVER)
80 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
83 ( cat scripts/libpng-config-head.in; \
84 echo prefix=\"$(prefix)\"; \
85 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
86 echo cppflags=\"-DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE\"; \
87 echo ccopts=\"$(ABI)\"; \
88 echo ldopts=\"$(ABI)\"; \
89 echo L_opts=\"-L$(LIBPATH)\"; \
90 echo libdir=\"$(LIBPATH)\"; \
91 echo libs=\"-lpng12 -lz -lm\"; \
92 cat scripts/libpng-config-body.in ) > libpng-config
93 chmod +x libpng-config
95 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
96 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
98 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
99 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
101 $(LIBNAME).so.$(PNGVER): $(OBJS)
102 $(LDSHARED) -o $@ $(OBJS)
103 rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
105 libpng.so.3.$(PNGMIN): $(OBJS)
106 $(LDLEGACY) -o $@ $(OBJS)
108 pngtest: pngtest.o libpng.a
109 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
113 echo Testing local static library.
116 install-headers: png.h pngconf.h
117 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
118 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
119 cp png.h pngconf.h $(DI)/$(LIBNAME)
120 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
121 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
122 -@/bin/rm -f $(DI)/libpng
123 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
125 install-static: install-headers libpng.a
126 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
127 cp libpng.a $(DL)/$(LIBNAME).a
128 chmod 644 $(DL)/$(LIBNAME).a
129 -@/bin/rm -f $(DL)/libpng.a
130 (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
132 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
133 libpng.so.3.$(PNGMIN)
134 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
135 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
136 -@/bin/rm -f $(DL)/libpng.so
137 -@/bin/rm -f $(DL)/libpng.so.3
138 -@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
139 cp $(LIBNAME).so.$(PNGVER) $(DL)
140 cp libpng.so.3.$(PNGMIN) $(DL)
141 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
142 chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
144 ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \
145 ln -sf libpng.so.3 libpng.so; \
146 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
147 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
148 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
149 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
150 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
151 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
152 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
153 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
155 install-man: libpng.3 libpngpf.3 png.5
156 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
157 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
158 -@/bin/rm -f $(DM)/man3/libpng.3
159 -@/bin/rm -f $(DM)/man3/libpngpf.3
160 cp libpng.3 $(DM)/man3
161 cp libpngpf.3 $(DM)/man3
162 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
163 -@/bin/rm -f $(DM)/man5/png.5
166 install-config: libpng-config
167 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
168 -@/bin/rm -f $(DB)/libpng-config
169 -@/bin/rm -f $(DB)/$(LIBNAME)-config
170 cp libpng-config $(DB)/$(LIBNAME)-config
171 chmod 755 $(DB)/$(LIBNAME)-config
172 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
174 install: install-static install-shared install-man install-config
176 # If you installed in $(DESTDIR), test-installed won't work until you
177 # move the library to its final location.
181 echo Testing installed dynamic shared library.
183 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
184 -L$(ZLIBLIB) -rpath $(ZLIBLIB):`$(BINPATH)/libpng12-config --libdir` \
185 -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
186 ./pngtesti pngtest.png
189 rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
190 $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
191 libpng.so.3.$(PNGMIN) \
194 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
196 chmod a-w *.[ch35] $(DOCS) scripts/*
198 # DO NOT DELETE THIS LINE -- make depend depends on it.
200 png.o: png.h pngconf.h
201 pngerror.o: png.h pngconf.h
202 pngrio.o: png.h pngconf.h
203 pngwio.o: png.h pngconf.h
204 pngmem.o: png.h pngconf.h
205 pngset.o: png.h pngconf.h
206 pngget.o: png.h pngconf.h
207 pngread.o: png.h pngconf.h
208 pngrtran.o: png.h pngconf.h
209 pngrutil.o: png.h pngconf.h
210 pngtest.o: png.h pngconf.h
211 pngtrans.o: png.h pngconf.h
212 pngwrite.o: png.h pngconf.h
213 pngwtran.o: png.h pngconf.h
214 pngwutil.o: png.h pngconf.h
215 pngpread.o: png.h pngconf.h
216 pnggccrd.o: png.h pngconf.h