1 # makefile for libpng on DEC Alpha Unix
2 # Copyright (C) 2000-2002, 2006 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
12 PNGVER = $(PNGMAJ).$(PNGMIN)
15 # Shared library names:
17 LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
18 LIBSOVER=$(LIBNAME).so.$(PNGVER)
21 OLDSOVER=libpng.so.3.$(PNGMIN)
31 # where make install puts libpng.a and png.h
34 INCPATH=$(prefix)/include
35 LIBPATH=$(exec_prefix)/lib
37 BINPATH=$(exec_prefix)/bin
39 # override DESTDIR= on the make install command line to easily support
40 # installing into a temporary location. Example:
42 # make install DESTDIR=/tmp/build/libpng
44 # If you're going to install into a temporary location
45 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
46 # you execute make install.
49 DB=$(DESTDIR)$(BINPATH)
50 DI=$(DESTDIR)$(INCPATH)
51 DL=$(DESTDIR)$(LIBPATH)
52 DM=$(DESTDIR)$(MANPATH)
54 # Where the zlib library and include files are located
55 #ZLIBLIB=/usr/local/lib
56 #ZLIBINC=/usr/local/include
60 CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
61 LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm
63 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
64 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
65 pngwtran.o pngmem.o pngerror.o pngpread.o
67 all: $(LIBSO) libpng.a pngtest libpng.pc libpng-config
74 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
75 -e s!@exec_prefix@!$(exec_prefix)! \
76 -e s!@libdir@!$(LIBPATH)! \
77 -e s!@includedir@!$(INCPATH)! \
78 -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
81 ( cat scripts/libpng-config-head.in; \
82 echo prefix=\"$(prefix)\"; \
83 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
84 echo ccopts=\"-std\"; \
85 echo L_opts=\"-L$(LIBPATH)\"; \
86 echo libs=\"-lpng12 -lz -lm\"; \
87 cat scripts/libpng-config-body.in ) > libpng-config
88 chmod +x libpng-config
91 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
93 $(LIBSOMAJ): $(LIBSOVER)
94 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
97 $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
101 $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
104 pngtest: pngtest.o libpng.a
105 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
110 install-headers: png.h pngconf.h
111 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
112 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(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_P) $(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 $(LIBSOVER) libpng.pc \
128 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
129 -@/bin/rm -f $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
130 -@/bin/rm -f $(DL)/$(LIBSOMAJ)
131 -@/bin/rm -f $(DL)/$(OLDSO)
132 -@/bin/rm -f $(DL)/$(OLDSOMAJ)
133 -@/bin/rm -f $(DL)/$(OLDSOVER)*
136 chmod 755 $(DL)/$(LIBSOVER)
137 chmod 755 $(DL)/$(OLDSOVER)
139 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
140 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
141 $(LN_SF)(LIBSOVER) $(LIBSOMAJ); \
142 $(LN_SF)(LIBSOMAJ) $(LIBSO))
143 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(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_P) $(DM); fi
152 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(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_P) $(DM)/man5; fi
158 -@/bin/rm -f $(DM)/man5/png.5
161 install-config: libpng-config
162 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(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) -w1 -I$(DI) -I$(ZLIBINC) \
179 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
180 -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL) \
181 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
182 ./pngtestd pngtest.png
186 echo Testing installed dynamic shared library.
187 $(CC) -w1 -I$(ZLIBINC) \
188 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
189 -L$(ZLIBLIB) -R$(ZLIBLIB) \
190 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
191 ./pngtesti pngtest.png
194 /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
195 libpng-config $(LIBSO) $(LIBSOMAJ)* \
199 # DO NOT DELETE THIS LINE -- make depend depends on it.
201 png.o: png.h pngconf.h
202 pngerror.o: png.h pngconf.h
203 pngrio.o: png.h pngconf.h
204 pngwio.o: png.h pngconf.h
205 pngmem.o: png.h pngconf.h
206 pngset.o: png.h pngconf.h
207 pngget.o: png.h pngconf.h
208 pngread.o: png.h pngconf.h
209 pngrtran.o: png.h pngconf.h
210 pngrutil.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
217 pngtest.o: png.h pngconf.h