1 # makefile for libpng.a and libpng12.so, SGI IRIX with 'cc'
2 # Copyright (C) 2001-2002, 2006 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
10 PNGVER = $(PNGMAJ).$(PNGMIN)
12 # Shared library names:
14 LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
15 LIBSOVER=$(LIBNAME).so.$(PNGVER)
18 OLDSOVER=libpng.so.3.$(PNGMIN)
28 # Where make install puts libpng.a, libpng12.so, and libpng12/png.h
29 # Prefix must be a full pathname.
34 # Where the zlib library and include files are located
35 #ZLIBLIB=/usr/local/lib32
36 #ZLIBINC=/usr/local/include
37 #ZLIBLIB=/usr/local/lib
38 #ZLIBINC=/usr/local/include
42 # ABI can be blank to use default for your system, -32, -o32, -n32, or -64
43 # See "man abi". zlib must be built with the same ABI.
46 WARNMORE= # -g -DPNG_DEBUG=5
47 CFLAGS=$(ABI) -I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32
48 LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
49 LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \
50 -set_version sgi$(PNGMAJ).0
51 LDLEGACY=cc $(ABI) -shared -soname $(OLDSOMAJ) \
53 # See "man dso" for info about shared objects
55 INCPATH=$(prefix)/include
56 LIBPATH=$(exec_prefix)/lib
57 #LIBPATH=$(exec_prefix)/lib32
59 BINPATH=$(exec_prefix)/bin
61 # override DESTDIR= on the make install command line to easily support
62 # installing into a temporary location. Example:
64 # make install DESTDIR=/tmp/build/libpng
66 # If you're going to install into a temporary location
67 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
68 # you execute make install.
71 DB=$(DESTDIR)$(BINPATH)
72 DI=$(DESTDIR)$(INCPATH)
73 DL=$(DESTDIR)$(LIBPATH)
74 DM=$(DESTDIR)$(MANPATH)
76 OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
77 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
78 pngwtran.o pngmem.o pngerror.o pngpread.o
80 all: libpng.a pngtest shared libpng.pc libpng-config
89 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
92 ( cat scripts/libpng-config-head.in; \
93 echo prefix=\"$(prefix)\"; \
94 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
95 echo ccopts=\"$(ABI)\"; \
96 echo ldopts=\"$(ABI)\"; \
97 echo L_opts=\"-L$(LIBPATH)\"; \
98 echo libdir=\"$(LIBPATH)\"; \
99 echo libs=\"-lpng12 -lz -lm\"; \
100 cat scripts/libpng-config-body.in ) > libpng-config
101 chmod +x libpng-config
103 $(LIBSO): $(LIBSOMAJ)
104 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
106 $(LIBSOMAJ): $(LIBSOVER)
107 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
110 $(LDSHARED) -o $@ $(OBJS)
111 $(RM_F) $(LIBSO) $(LIBSOMAJ)
114 $(LDLEGACY) -o $@ $(OBJS)
116 pngtest: pngtest.o libpng.a
117 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
121 echo Testing local static library.
124 install-headers: png.h pngconf.h
125 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
126 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
127 cp png.h pngconf.h $(DI)/$(LIBNAME)
128 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
129 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
130 -@$(RM_F) $(DI)/libpng
131 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
133 install-static: install-headers libpng.a
134 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
135 cp libpng.a $(DL)/$(LIBNAME).a
136 chmod 644 $(DL)/$(LIBNAME).a
137 -@$(RM_F) $(DL)/libpng.a
138 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
140 install-shared: install-headers $(LIBSOVER) libpng.pc \
142 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
143 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
144 -@$(RM_F) $(DL)/$(LIBSOMAJ)
145 -@$(RM_F) $(DL)/$(OLDSO)
146 -@$(RM_F) $(DL)/$(OLDSOMAJ)
147 -@$(RM_F) $(DL)/$(OLDSOVER)*
150 chmod 755 $(DL)/$(LIBSOVER)
151 chmod 755 $(DL)/$(OLDSOVER)
153 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
154 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
155 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
156 $(LN_SF) $(LIBSOMAJ) $(LIBSO))
157 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
158 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
159 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
160 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
161 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
162 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
164 install-man: libpng.3 libpngpf.3 png.5
165 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
166 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
167 -@$(RM_F) $(DM)/man3/libpng.3
168 -@$(RM_F) $(DM)/man3/libpngpf.3
169 cp libpng.3 $(DM)/man3
170 cp libpngpf.3 $(DM)/man3
171 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
172 -@$(RM_F) $(DM)/man5/png.5
175 install-config: libpng-config
176 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
177 -@$(RM_F) $(DB)/libpng-config
178 -@$(RM_F) $(DB)/$(LIBNAME)-config
179 cp libpng-config $(DB)/$(LIBNAME)-config
180 chmod 755 $(DB)/$(LIBNAME)-config
181 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
183 install: install-static install-shared install-man install-config
185 # If you installed in $(DESTDIR), test-installed won't work until you
186 # move the library to its final location. Use test-dd to test it
191 echo Testing installed dynamic shared library in $(DL).
192 $(CC) -I$(DI) -I$(ZLIBINC) \
193 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
194 -L$(DL) -L$(ZLIBLIB) \
195 -rpath $(ZLIBLIB):$(DL) \
196 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
197 ./pngtestd pngtest.png
201 echo Testing installed dynamic shared library.
203 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
205 -rpath $(ZLIBLIB):`$(BINPATH)/$(LIBNAME)-config --libdir` \
206 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
207 ./pngtesti pngtest.png
210 $(RM_F) libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
211 $(LIBSO) $(LIBSOMAJ)* \
215 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
217 chmod a-w *.[ch35] $(DOCS) scripts/*
219 # DO NOT DELETE THIS LINE -- make depend depends on it.
221 png.o: png.h pngconf.h
222 pngerror.o: png.h pngconf.h
223 pngrio.o: png.h pngconf.h
224 pngwio.o: png.h pngconf.h
225 pngmem.o: png.h pngconf.h
226 pngset.o: png.h pngconf.h
227 pngget.o: png.h pngconf.h
228 pngread.o: png.h pngconf.h
229 pngrtran.o: png.h pngconf.h
230 pngrutil.o: png.h pngconf.h
231 pngtest.o: png.h pngconf.h
232 pngtrans.o: png.h pngconf.h
233 pngwrite.o: png.h pngconf.h
234 pngwtran.o: png.h pngconf.h
235 pngwutil.o: png.h pngconf.h
236 pngpread.o: png.h pngconf.h
237 pnggccrd.o: png.h pngconf.h