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 | #
|
---|
5 | # This code is released under the libpng license.
|
---|
6 | # For conditions of distribution and use, see the disclaimer
|
---|
7 | # and license in png.h
|
---|
8 |
|
---|
9 | # Library name:
|
---|
10 | PNGMAJ = 0
|
---|
11 | PNGMIN = 1.2.53
|
---|
12 | PNGVER = $(PNGMAJ).$(PNGMIN)
|
---|
13 | LIBNAME = libpng12
|
---|
14 |
|
---|
15 | # Shared library names:
|
---|
16 | LIBSO=$(LIBNAME).so
|
---|
17 | LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
|
---|
18 | LIBSOVER=$(LIBNAME).so.$(PNGVER)
|
---|
19 | OLDSO=libpng.so
|
---|
20 | OLDSOMAJ=libpng.so.3
|
---|
21 | OLDSOVER=libpng.so.3.$(PNGMIN)
|
---|
22 |
|
---|
23 | # Utilities:
|
---|
24 | AR_RC=ar rc
|
---|
25 | CC=cc
|
---|
26 | MKDIR_P=mkdir
|
---|
27 | LN_SF=ln -f -s
|
---|
28 | RANLIB=ranlib
|
---|
29 | RM_F=/bin/rm -f
|
---|
30 |
|
---|
31 | # where make install puts libpng.a and png.h
|
---|
32 | prefix=/usr/local
|
---|
33 | exec_prefix=$(prefix)
|
---|
34 | INCPATH=$(prefix)/include
|
---|
35 | LIBPATH=$(exec_prefix)/lib
|
---|
36 | MANPATH=$(prefix)/man
|
---|
37 | BINPATH=$(exec_prefix)/bin
|
---|
38 |
|
---|
39 | # override DESTDIR= on the make install command line to easily support
|
---|
40 | # installing into a temporary location. Example:
|
---|
41 | #
|
---|
42 | # make install DESTDIR=/tmp/build/libpng
|
---|
43 | #
|
---|
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.
|
---|
47 | DESTDIR=
|
---|
48 |
|
---|
49 | DB=$(DESTDIR)$(BINPATH)
|
---|
50 | DI=$(DESTDIR)$(INCPATH)
|
---|
51 | DL=$(DESTDIR)$(LIBPATH)
|
---|
52 | DM=$(DESTDIR)$(MANPATH)
|
---|
53 |
|
---|
54 | # Where the zlib library and include files are located
|
---|
55 | #ZLIBLIB=/usr/local/lib
|
---|
56 | #ZLIBINC=/usr/local/include
|
---|
57 | ZLIBLIB=../zlib
|
---|
58 | ZLIBINC=../zlib
|
---|
59 |
|
---|
60 | CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
|
---|
61 | LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm
|
---|
62 |
|
---|
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
|
---|
66 |
|
---|
67 | all: $(LIBSO) libpng.a pngtest libpng.pc libpng-config
|
---|
68 |
|
---|
69 | libpng.a: $(OBJS)
|
---|
70 | $(AR_RC) $@ $(OBJS)
|
---|
71 | $(RANLIB) $@
|
---|
72 |
|
---|
73 | libpng.pc:
|
---|
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
|
---|
79 |
|
---|
80 | libpng-config:
|
---|
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
|
---|
89 |
|
---|
90 | $(LIBSO): $(LIBSOMAJ)
|
---|
91 | $(LN_SF) $(LIBSOMAJ) $(LIBSO)
|
---|
92 |
|
---|
93 | $(LIBSOMAJ): $(LIBSOVER)
|
---|
94 | $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
|
---|
95 |
|
---|
96 | $(LIBSOVER): $(OBJS)
|
---|
97 | $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
|
---|
98 | -soname $(LIBSOMAJ)
|
---|
99 |
|
---|
100 | $(OLDSOVER): $(OBJS)
|
---|
101 | $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
|
---|
102 | -soname $(OLDSOMAJ)
|
---|
103 |
|
---|
104 | pngtest: pngtest.o libpng.a
|
---|
105 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
---|
106 |
|
---|
107 | test: pngtest
|
---|
108 | ./pngtest
|
---|
109 |
|
---|
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)/* .)
|
---|
118 |
|
---|
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)
|
---|
125 |
|
---|
126 | install-shared: install-headers $(LIBSOVER) libpng.pc \
|
---|
127 | $(OLDSOVER)
|
---|
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)*
|
---|
134 | cp $(LIBSOVER) $(DL)
|
---|
135 | cp $(OLDSOVER) $(DL)
|
---|
136 | chmod 755 $(DL)/$(LIBSOVER)
|
---|
137 | chmod 755 $(DL)/$(OLDSOVER)
|
---|
138 | (cd $(DL); \
|
---|
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)
|
---|
149 |
|
---|
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
|
---|
159 | cp png.5 $(DM)/man5
|
---|
160 |
|
---|
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)
|
---|
168 |
|
---|
169 | install: install-static install-shared install-man install-config
|
---|
170 |
|
---|
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
|
---|
173 | # before then.
|
---|
174 |
|
---|
175 | test-dd:
|
---|
176 | echo
|
---|
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
|
---|
183 |
|
---|
184 | test-installed:
|
---|
185 | echo
|
---|
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
|
---|
192 |
|
---|
193 | clean:
|
---|
194 | /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
|
---|
195 | libpng-config $(LIBSO) $(LIBSOMAJ)* \
|
---|
196 | $(OLDSOVER) \
|
---|
197 | libpng.pc
|
---|
198 |
|
---|
199 | # DO NOT DELETE THIS LINE -- make depend depends on it.
|
---|
200 |
|
---|
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
|
---|
216 |
|
---|
217 | pngtest.o: png.h pngconf.h
|
---|