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.
4 # For conditions of distribution and use, see copyright notice in png.h
9 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 and png.h
31 INCPATH=$(prefix)/include
32 LIBPATH=$(exec_prefix)/lib
34 BINPATH=$(exec_prefix)/bin
36 # override DESTDIR= on the make install command line to easily support
37 # installing into a temporary location. Example:
39 # make install DESTDIR=/tmp/build/libpng
41 # If you're going to install into a temporary location
42 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
43 # you execute make install.
46 DB=$(DESTDIR)$(BINPATH)
47 DI=$(DESTDIR)$(INCPATH)
48 DL=$(DESTDIR)$(LIBPATH)
49 DM=$(DESTDIR)$(MANPATH)
51 # Where the zlib library and include files are located
52 #ZLIBLIB=/usr/local/lib
53 #ZLIBINC=/usr/local/include
57 CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
58 LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm
60 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
61 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
62 pngwtran.o pngmem.o pngerror.o pngpread.o
64 all: $(LIBSO) libpng.a pngtest libpng.pc libpng-config
71 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
72 -e s!@exec_prefix@!$(exec_prefix)! \
73 -e s!@libdir@!$(LIBPATH)! \
74 -e s!@includedir@!$(INCPATH)! \
75 -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
78 ( cat scripts/libpng-config-head.in; \
79 echo prefix=\"$(prefix)\"; \
80 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
81 echo ccopts=\"-std\"; \
82 echo L_opts=\"-L$(LIBPATH)\"; \
83 echo libs=\"-lpng12 -lz -lm\"; \
84 cat scripts/libpng-config-body.in ) > libpng-config
85 chmod +x libpng-config
88 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
90 $(LIBSOMAJ): $(LIBSOVER)
91 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
94 $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
98 $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
101 pngtest: pngtest.o libpng.a
102 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
107 install-headers: png.h pngconf.h
108 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
109 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
110 cp png.h pngconf.h $(DI)/$(LIBNAME)
111 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
112 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
113 -@/bin/rm -f $(DI)/libpng
114 (cd $(DI); $(LN_SF)(LIBNAME) libpng; $(LN_SF)(LIBNAME)/* .)
116 install-static: install-headers libpng.a
117 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
118 cp libpng.a $(DL)/$(LIBNAME).a
119 chmod 644 $(DL)/$(LIBNAME).a
120 -@/bin/rm -f $(DL)/libpng.a
121 (cd $(DL); $(LN_SF)(LIBNAME).a libpng.a)
123 install-shared: install-headers $(LIBSOVER) libpng.pc \
125 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
126 -@/bin/rm -f $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
127 -@/bin/rm -f $(DL)/$(LIBSOMAJ)
128 -@/bin/rm -f $(DL)/$(OLDSO)
129 -@/bin/rm -f $(DL)/$(OLDSOMAJ)
130 -@/bin/rm -f $(DL)/$(OLDSOVER)*
133 chmod 755 $(DL)/$(LIBSOVER)
134 chmod 755 $(DL)/$(OLDSOVER)
136 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
137 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
138 $(LN_SF)(LIBSOVER) $(LIBSOMAJ); \
139 $(LN_SF)(LIBSOMAJ) $(LIBSO))
140 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
141 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
142 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
143 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
144 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
145 (cd $(DL)/pkgconfig; $(LN_SF)(LIBNAME).pc libpng.pc)
147 install-man: libpng.3 libpngpf.3 png.5
148 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
149 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
150 -@/bin/rm -f $(DM)/man3/libpng.3
151 -@/bin/rm -f $(DM)/man3/libpngpf.3
152 cp libpng.3 $(DM)/man3
153 cp libpngpf.3 $(DM)/man3
154 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
155 -@/bin/rm -f $(DM)/man5/png.5
158 install-config: libpng-config
159 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
160 -@/bin/rm -f $(DB)/libpng-config
161 -@/bin/rm -f $(DB)/$(LIBNAME)-config
162 cp libpng-config $(DB)/$(LIBNAME)-config
163 chmod 755 $(DB)/$(LIBNAME)-config
164 (cd $(DB); $(LN_SF)(LIBNAME)-config libpng-config)
166 install: install-static install-shared install-man install-config
168 # If you installed in $(DESTDIR), test-installed won't work until you
169 # move the library to its final location. Use test-dd to test it
174 echo Testing installed dynamic shared library in $(DL).
175 $(CC) -w1 -I$(DI) -I$(ZLIBINC) \
176 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
177 -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL) \
178 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
179 ./pngtestd pngtest.png
183 echo Testing installed dynamic shared library.
184 $(CC) -w1 -I$(ZLIBINC) \
185 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
186 -L$(ZLIBLIB) -R$(ZLIBLIB) \
187 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
188 ./pngtesti pngtest.png
191 /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
192 libpng-config $(LIBSO) $(LIBSOMAJ)* \
196 # DO NOT DELETE THIS LINE -- make depend depends on it.
198 png.o: png.h pngconf.h
199 pngerror.o: png.h pngconf.h
200 pngrio.o: png.h pngconf.h
201 pngwio.o: png.h pngconf.h
202 pngmem.o: png.h pngconf.h
203 pngset.o: png.h pngconf.h
204 pngget.o: png.h pngconf.h
205 pngread.o: png.h pngconf.h
206 pngrtran.o: png.h pngconf.h
207 pngrutil.o: png.h pngconf.h
208 pngtest.o: png.h pngconf.h
209 pngtrans.o: png.h pngconf.h
210 pngwrite.o: png.h pngconf.h
211 pngwtran.o: png.h pngconf.h
212 pngwutil.o: png.h pngconf.h
213 pngpread.o: png.h pngconf.h