]>
Commit | Line | Data |
---|---|---|
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 | |
5 | ||
6 | # Library name: | |
7 | PNGMAJ = 0 | |
8 | PNGMIN = 1.2.20 | |
9 | PNGVER = $(PNGMAJ).$(PNGMIN) | |
10 | LIBNAME = libpng12 | |
11 | ||
12 | # Shared library names: | |
13 | LIBSO=$(LIBNAME).so | |
14 | LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) | |
15 | LIBSOVER=$(LIBNAME).so.$(PNGVER) | |
16 | OLDSO=libpng.so | |
17 | OLDSOMAJ=libpng.so.3 | |
18 | OLDSOVER=libpng.so.3.$(PNGMIN) | |
19 | ||
20 | # Utilities: | |
21 | AR_RC=ar rc | |
22 | CC=cc | |
23 | MKDIR_P=mkdir | |
24 | LN_SF=ln -f -s | |
25 | RANLIB=ranlib | |
26 | RM_F=/bin/rm -f | |
27 | ||
28 | # where make install puts libpng.a and png.h | |
29 | prefix=/usr/local | |
30 | exec_prefix=$(prefix) | |
31 | INCPATH=$(prefix)/include | |
32 | LIBPATH=$(exec_prefix)/lib | |
33 | MANPATH=$(prefix)/man | |
34 | BINPATH=$(exec_prefix)/bin | |
35 | ||
36 | # override DESTDIR= on the make install command line to easily support | |
37 | # installing into a temporary location. Example: | |
38 | # | |
39 | # make install DESTDIR=/tmp/build/libpng | |
40 | # | |
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. | |
44 | DESTDIR= | |
45 | ||
46 | DB=$(DESTDIR)$(BINPATH) | |
47 | DI=$(DESTDIR)$(INCPATH) | |
48 | DL=$(DESTDIR)$(LIBPATH) | |
49 | DM=$(DESTDIR)$(MANPATH) | |
50 | ||
51 | # Where the zlib library and include files are located | |
52 | #ZLIBLIB=/usr/local/lib | |
53 | #ZLIBINC=/usr/local/include | |
54 | ZLIBLIB=../zlib | |
55 | ZLIBINC=../zlib | |
56 | ||
57 | CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1 | |
58 | LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm | |
59 | ||
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 | |
63 | ||
64 | all: $(LIBSO) libpng.a pngtest libpng.pc libpng-config | |
65 | ||
66 | libpng.a: $(OBJS) | |
67 | $(AR_RC) $@ $(OBJS) | |
68 | $(RANLIB) $@ | |
69 | ||
70 | libpng.pc: | |
71 | cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc | |
72 | ||
73 | libpng-config: | |
74 | ( cat scripts/libpng-config-head.in; \ | |
75 | echo prefix=\"$(prefix)\"; \ | |
76 | echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ | |
77 | echo ccopts=\"-std\"; \ | |
78 | echo L_opts=\"-L$(LIBPATH)\"; \ | |
79 | echo libs=\"-lpng12 -lz -lm\"; \ | |
80 | cat scripts/libpng-config-body.in ) > libpng-config | |
81 | chmod +x libpng-config | |
82 | ||
83 | $(LIBSO): $(LIBSOMAJ) | |
84 | $(LN_SF) $(LIBSOMAJ) $(LIBSO) | |
85 | ||
86 | $(LIBSOMAJ): $(LIBSOVER) | |
87 | $(LN_SF) $(LIBSOVER) $(LIBSOMAJ) | |
88 | ||
89 | $(LIBSOVER): $(OBJS) | |
90 | $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \ | |
91 | -soname $(LIBSOMAJ) | |
92 | ||
93 | $(OLDSOVER): $(OBJS) | |
94 | $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \ | |
95 | -soname $(OLDSOMAJ) | |
96 | ||
97 | pngtest: pngtest.o libpng.a | |
98 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) | |
99 | ||
100 | test: pngtest | |
101 | ./pngtest | |
102 | ||
103 | install-headers: png.h pngconf.h | |
104 | -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi | |
105 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi | |
106 | cp png.h pngconf.h $(DI)/$(LIBNAME) | |
107 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h | |
108 | -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h | |
109 | -@/bin/rm -f $(DI)/libpng | |
110 | (cd $(DI); $(LN_SF)(LIBNAME) libpng; $(LN_SF)(LIBNAME)/* .) | |
111 | ||
112 | install-static: install-headers libpng.a | |
113 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi | |
114 | cp libpng.a $(DL)/$(LIBNAME).a | |
115 | chmod 644 $(DL)/$(LIBNAME).a | |
116 | -@/bin/rm -f $(DL)/libpng.a | |
117 | (cd $(DL); $(LN_SF)(LIBNAME).a libpng.a) | |
118 | ||
119 | install-shared: install-headers $(LIBSOVER) libpng.pc \ | |
120 | $(OLDSOVER) | |
121 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi | |
122 | -@/bin/rm -f $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO) | |
123 | -@/bin/rm -f $(DL)/$(LIBSOMAJ) | |
124 | -@/bin/rm -f $(DL)/$(OLDSO) | |
125 | -@/bin/rm -f $(DL)/$(OLDSOMAJ) | |
126 | -@/bin/rm -f $(DL)/$(OLDSOVER)* | |
127 | cp $(LIBSOVER) $(DL) | |
128 | cp $(OLDSOVER) $(DL) | |
129 | chmod 755 $(DL)/$(LIBSOVER) | |
130 | chmod 755 $(DL)/$(OLDSOVER) | |
131 | (cd $(DL); \ | |
132 | $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \ | |
133 | $(LN_SF) $(OLDSOMAJ) $(OLDSO); \ | |
134 | $(LN_SF)(LIBSOVER) $(LIBSOMAJ); \ | |
135 | $(LN_SF)(LIBSOMAJ) $(LIBSO)) | |
136 | -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi | |
137 | -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc | |
138 | -@/bin/rm -f $(DL)/pkgconfig/libpng.pc | |
139 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc | |
140 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc | |
141 | (cd $(DL)/pkgconfig; $(LN_SF)(LIBNAME).pc libpng.pc) | |
142 | ||
143 | install-man: libpng.3 libpngpf.3 png.5 | |
144 | -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi | |
145 | -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi | |
146 | -@/bin/rm -f $(DM)/man3/libpng.3 | |
147 | -@/bin/rm -f $(DM)/man3/libpngpf.3 | |
148 | cp libpng.3 $(DM)/man3 | |
149 | cp libpngpf.3 $(DM)/man3 | |
150 | -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi | |
151 | -@/bin/rm -f $(DM)/man5/png.5 | |
152 | cp png.5 $(DM)/man5 | |
153 | ||
154 | install-config: libpng-config | |
155 | -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi | |
156 | -@/bin/rm -f $(DB)/libpng-config | |
157 | -@/bin/rm -f $(DB)/$(LIBNAME)-config | |
158 | cp libpng-config $(DB)/$(LIBNAME)-config | |
159 | chmod 755 $(DB)/$(LIBNAME)-config | |
160 | (cd $(DB); $(LN_SF)(LIBNAME)-config libpng-config) | |
161 | ||
162 | install: install-static install-shared install-man install-config | |
163 | ||
164 | # If you installed in $(DESTDIR), test-installed won't work until you | |
165 | # move the library to its final location. Use test-dd to test it | |
166 | # before then. | |
167 | ||
168 | test-dd: | |
169 | echo | |
170 | echo Testing installed dynamic shared library in $(DL). | |
171 | $(CC) -w1 -I$(DI) -I$(ZLIBINC) \ | |
172 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ | |
173 | -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL) \ | |
174 | -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` | |
175 | ./pngtestd pngtest.png | |
176 | ||
177 | test-installed: | |
178 | echo | |
179 | echo Testing installed dynamic shared library. | |
180 | $(CC) -w1 -I$(ZLIBINC) \ | |
181 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ | |
182 | -L$(ZLIBLIB) -R$(ZLIBLIB) \ | |
183 | -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` | |
184 | ./pngtesti pngtest.png | |
185 | ||
186 | clean: | |
187 | /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \ | |
188 | libpng-config $(LIBSO) $(LIBSOMAJ)* \ | |
189 | $(OLDSOVER) \ | |
190 | libpng.pc | |
191 | ||
192 | # DO NOT DELETE THIS LINE -- make depend depends on it. | |
193 | ||
194 | png.o: png.h pngconf.h | |
195 | pngerror.o: png.h pngconf.h | |
196 | pngrio.o: png.h pngconf.h | |
197 | pngwio.o: png.h pngconf.h | |
198 | pngmem.o: png.h pngconf.h | |
199 | pngset.o: png.h pngconf.h | |
200 | pngget.o: png.h pngconf.h | |
201 | pngread.o: png.h pngconf.h | |
202 | pngrtran.o: png.h pngconf.h | |
203 | pngrutil.o: png.h pngconf.h | |
204 | pngtest.o: png.h pngconf.h | |
205 | pngtrans.o: png.h pngconf.h | |
206 | pngwrite.o: png.h pngconf.h | |
207 | pngwtran.o: png.h pngconf.h | |
208 | pngwutil.o: png.h pngconf.h | |
209 | pngpread.o: png.h pngconf.h | |
210 |