1 # makefile for libpng.a and libpng17.so, SGI IRIX with 'cc'
2 # Copyright (C) 2001-2002, 2006, 2010-2014 Glenn Randers-Pehrson
3 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
5 # This code is released under the libpng license.
6 # For conditions of distribution and use, see the disclaimer
13 # Shared library names:
15 LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
16 LIBSOREL=$(LIBSOMAJ).$(RELEASE)
27 # Where make install puts libpng.a, libpng17.so, and libpng17/png.h
28 # Prefix must be a full pathname.
33 # Where the zlib library and include files are located
34 #ZLIBLIB=/usr/local/lib32
35 #ZLIBINC=/usr/local/include
36 #ZLIBLIB=/usr/local/lib
37 #ZLIBINC=/usr/local/include
41 # ABI can be blank to use default for your system, -32, -o32, -n32, or -64
42 # See "man abi". zlib must be built with the same ABI.
46 CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
47 CFLAGS=$(ABI) -O $(WARNMORE) -fPIC -mabi=n32 # -g
48 LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
49 LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \
50 -set_version sgi$(PNGMAJ).0
51 # See "man dso" for info about shared objects
53 INCPATH=$(prefix)/include
54 LIBPATH=$(exec_prefix)/lib
55 #LIBPATH=$(exec_prefix)/lib32
57 BINPATH=$(exec_prefix)/bin
59 # override DESTDIR= on the make install command line to easily support
60 # installing into a temporary location. Example:
62 # make install DESTDIR=/tmp/build/libpng
64 # If you're going to install into a temporary location
65 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
66 # you execute make install.
69 DB=$(DESTDIR)$(BINPATH)
70 DI=$(DESTDIR)$(INCPATH)
71 DL=$(DESTDIR)$(LIBPATH)
72 DM=$(DESTDIR)$(MANPATH)
74 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
75 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
76 pngwtran.o pngmem.o pngerror.o pngpread.o
79 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
81 all: libpng.a pngtest shared libpng.pc libpng-config
83 # see scripts/pnglibconf.mak for more options
84 pnglibconf.h: scripts/pnglibconf.h.prebuilt
85 cp scripts/pnglibconf.h.prebuilt $@
94 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
95 -e s!@exec_prefix@!$(exec_prefix)! \
96 -e s!@libdir@!$(LIBPATH)! \
97 -e s!@includedir@!$(INCPATH)! \
98 -e s!-lpng17!-lpng17\ -lz\ -lm! > libpng.pc
101 ( cat scripts/libpng-config-head.in; \
102 echo prefix=\"$(prefix)\"; \
103 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
104 echo ccopts=\"$(ABI)\"; \
105 echo cppflags=\"\"; \
106 echo ldopts=\"$(ABI)\"; \
107 echo L_opts=\"-L$(LIBPATH)\"; \
108 echo libdir=\"$(LIBPATH)\"; \
109 echo libs=\"-lpng17 -lz -lm\"; \
110 cat scripts/libpng-config-body.in ) > libpng-config
111 chmod +x libpng-config
113 $(LIBSO): $(LIBSOMAJ)
114 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
117 $(LDSHARED) -o $@ $(OBJS)
118 $(RM_F) $(LIBSO) $(LIBSOMAJ)
120 pngtest: pngtest.o libpng.a
121 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
125 echo Testing local static library.
128 install-headers: png.h pngconf.h pnglibconf.h
129 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
130 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
131 cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
132 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
133 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
134 -@$(RM_F) $(DI)/libpng
135 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
137 install-static: install-headers libpng.a
138 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
139 cp libpng.a $(DL)/$(LIBNAME).a
140 chmod 644 $(DL)/$(LIBNAME).a
141 -@$(RM_F) $(DL)/libpng.a
142 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
144 install-shared: install-headers $(LIBSOMAJ) libpng.pc
145 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
146 -@$(RM_F) $(DL)/$(LIBSO)
147 -@$(RM_F) $(DL)/$(LIBSOREL)
148 -@$(RM_F) $(DL)/$(OLDSO)
149 cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
150 chmod 755 $(DL)/$(LIBSOREL)
152 $(LN_SF) $(LIBSOREL) $(LIBSO); \
153 $(LN_SF) $(LIBSO) $(OLDSO))
154 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
155 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
156 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
157 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
158 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
159 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
161 install-man: libpng.3 libpngpf.3 png.5
162 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
163 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
164 -@$(RM_F) $(DM)/man3/libpng.3
165 -@$(RM_F) $(DM)/man3/libpngpf.3
166 cp libpng.3 $(DM)/man3
167 cp libpngpf.3 $(DM)/man3
168 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
169 -@$(RM_F) $(DM)/man5/png.5
172 install-config: libpng-config
173 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
174 -@$(RM_F) $(DB)/libpng-config
175 -@$(RM_F) $(DB)/$(LIBNAME)-config
176 cp libpng-config $(DB)/$(LIBNAME)-config
177 chmod 755 $(DB)/$(LIBNAME)-config
178 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
180 install: install-static install-shared install-man install-config
182 # If you installed in $(DESTDIR), test-installed won't work until you
183 # move the library to its final location. Use test-dd to test it
188 echo Testing installed dynamic shared library in $(DL).
189 $(CC) -I$(DI) $(CPPFLAGS) \
190 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
191 -L$(DL) -L$(ZLIBLIB) \
192 -rpath $(ZLIBLIB):$(DL) \
193 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
194 ./pngtestd pngtest.png
198 echo Testing installed dynamic shared library.
200 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
202 -rpath $(ZLIBLIB):`$(BINPATH)/$(LIBNAME)-config --libdir` \
203 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
204 ./pngtesti pngtest.png
207 $(RM_F) libpng.a pngtest pngtesti pngout.png libpng.pc \
208 so_locations libpng-config $(LIBSO) $(LIBSOMAJ)* pnglibconf.h
210 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
212 chmod a-w *.[ch35] $(DOCS) scripts/*
214 # DO NOT DELETE THIS LINE -- make depend depends on it.
216 png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
217 pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
218 pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
219 pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
220 pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
221 pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
222 pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
223 pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
224 pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
225 pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
226 pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
227 pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
228 pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
229 pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
230 pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
232 pngtest.o: png.h pngconf.h pnglibconf.h