]>
Commit | Line | Data |
---|---|---|
1 | # makefile for libpng.a and libpng12.so, SGI IRIX with 'cc' | |
2 | # Copyright (C) 2001-2002 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 | LIBNAME=libpng12 | |
7 | PNGMAJ = 0 | |
8 | PNGMIN = 1.2.7 | |
9 | PNGVER = $(PNGMAJ).$(PNGMIN) | |
10 | ||
11 | # Where make install puts libpng.a, libpng12.so, and libpng12/png.h | |
12 | # Prefix must be a full pathname. | |
13 | ||
14 | prefix=/usr/local | |
15 | ||
16 | # Where the zlib library and include files are located | |
17 | #ZLIBLIB=/usr/local/lib32 | |
18 | #ZLIBINC=/usr/local/include | |
19 | #ZLIBLIB=/usr/local/lib | |
20 | #ZLIBINC=/usr/local/include | |
21 | ZLIBLIB=../zlib | |
22 | ZLIBINC=../zlib | |
23 | ||
24 | CC=cc | |
25 | ||
26 | # ABI can be blank to use default for your system, -32, -o32, -n32, or -64 | |
27 | # See "man abi". zlib must be built with the same ABI. | |
28 | ABI= | |
29 | ||
30 | WARNMORE=-fullwarn | |
31 | # Note: -KPIC is the default anyhow | |
32 | #CFLAGS= $(ABI) -I$(ZLIBINC) -O $(WARNMORE) -KPIC -DPNG_USE_PNGGCCRD # -g -DPNG_DEBUG=5 | |
33 | CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD \ | |
34 | -DPNG_NO_ASSEMBLER_CODE | |
35 | LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng12 -lz -lm | |
36 | LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm | |
37 | LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ) \ | |
38 | -set_version sgi$(PNGMAJ).0 | |
39 | LDLEGACY=cc $(ABI) -shared -soname libpng.so.3 \ | |
40 | -set_version sgi$3.0 | |
41 | # See "man dso" for info about shared objects | |
42 | ||
43 | RANLIB=echo | |
44 | #RANLIB=ranlib | |
45 | ||
46 | INCPATH=$(prefix)/include | |
47 | LIBPATH=$(prefix)/lib | |
48 | #LIBPATH=$(prefix)/lib32 | |
49 | MANPATH=$(prefix)/man | |
50 | BINPATH=$(prefix)/bin | |
51 | ||
52 | # override DESTDIR= on the make install command line to easily support | |
53 | # installing into a temporary location. Example: | |
54 | # | |
55 | # make install DESTDIR=/tmp/build/libpng | |
56 | # | |
57 | # If you're going to install into a temporary location | |
58 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before | |
59 | # you execute make install. | |
60 | DESTDIR= | |
61 | ||
62 | DB=$(DESTDIR)$(BINPATH) | |
63 | DI=$(DESTDIR)$(INCPATH) | |
64 | DL=$(DESTDIR)$(LIBPATH) | |
65 | DM=$(DESTDIR)$(MANPATH) | |
66 | ||
67 | OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ | |
68 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ | |
69 | pngwtran.o pngmem.o pngerror.o pngpread.o | |
70 | ||
71 | all: libpng.a pngtest shared libpng.pc libpng-config | |
72 | ||
73 | libpng.a: $(OBJS) | |
74 | ar rc $@ $(OBJS) | |
75 | $(RANLIB) $@ | |
76 | ||
77 | shared: $(LIBNAME).so.$(PNGVER) | |
78 | ||
79 | libpng.pc: | |
80 | cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc | |
81 | ||
82 | libpng-config: | |
83 | ( cat scripts/libpng-config-head.in; \ | |
84 | echo prefix=\"$(prefix)\"; \ | |
85 | echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ | |
86 | echo cppflags=\"-DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE\"; \ | |
87 | echo ccopts=\"$(ABI)\"; \ | |
88 | echo ldopts=\"$(ABI)\"; \ | |
89 | echo L_opts=\"-L$(LIBPATH)\"; \ | |
90 | echo libdir=\"$(LIBPATH)\"; \ | |
91 | echo libs=\"-lpng12 -lz -lm\"; \ | |
92 | cat scripts/libpng-config-body.in ) > libpng-config | |
93 | chmod +x libpng-config | |
94 | ||
95 | $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) | |
96 | ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so | |
97 | ||
98 | $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER) | |
99 | ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ) | |
100 | ||
101 | $(LIBNAME).so.$(PNGVER): $(OBJS) | |
102 | $(LDSHARED) -o $@ $(OBJS) | |
103 | rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ) | |
104 | ||
105 | libpng.so.3.$(PNGMIN): $(OBJS) | |
106 | $(LDLEGACY) -o $@ $(OBJS) | |
107 | ||
108 | pngtest: pngtest.o libpng.a | |
109 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) | |
110 | ||
111 | test: pngtest | |
112 | echo | |
113 | echo Testing local static library. | |
114 | ./pngtest | |
115 | ||
116 | install-headers: png.h pngconf.h | |
117 | -@if [ ! -d $(DI) ]; then mkdir $(DI); fi | |
118 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi | |
119 | cp png.h pngconf.h $(DI)/$(LIBNAME) | |
120 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h | |
121 | -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h | |
122 | -@/bin/rm -f $(DI)/libpng | |
123 | (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .) | |
124 | ||
125 | install-static: install-headers libpng.a | |
126 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi | |
127 | cp libpng.a $(DL)/$(LIBNAME).a | |
128 | chmod 644 $(DL)/$(LIBNAME).a | |
129 | -@/bin/rm -f $(DL)/libpng.a | |
130 | (cd $(DL); ln -sf $(LIBNAME).a libpng.a) | |
131 | ||
132 | install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \ | |
133 | libpng.so.3.$(PNGMIN) | |
134 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi | |
135 | -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so | |
136 | -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ) | |
137 | -@/bin/rm -f $(DL)/libpng.so | |
138 | -@/bin/rm -f $(DL)/libpng.so.3 | |
139 | -@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)* | |
140 | cp $(LIBNAME).so.$(PNGVER) $(DL) | |
141 | cp libpng.so.3.$(PNGMIN) $(DL) | |
142 | chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER) | |
143 | chmod 755 $(DL)/libpng.so.3.$(PNGMIN) | |
144 | (cd $(DL); \ | |
145 | ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \ | |
146 | ln -sf libpng.so.3 libpng.so; \ | |
147 | ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ | |
148 | ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) | |
149 | -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi | |
150 | -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc | |
151 | -@/bin/rm -f $(DL)/pkgconfig/libpng.pc | |
152 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc | |
153 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc | |
154 | (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc) | |
155 | ||
156 | install-man: libpng.3 libpngpf.3 png.5 | |
157 | -@if [ ! -d $(DM) ]; then mkdir $(DM); fi | |
158 | -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi | |
159 | -@/bin/rm -f $(DM)/man3/libpng.3 | |
160 | -@/bin/rm -f $(DM)/man3/libpngpf.3 | |
161 | cp libpng.3 $(DM)/man3 | |
162 | cp libpngpf.3 $(DM)/man3 | |
163 | -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi | |
164 | -@/bin/rm -f $(DM)/man5/png.5 | |
165 | cp png.5 $(DM)/man5 | |
166 | ||
167 | install-config: libpng-config | |
168 | -@if [ ! -d $(DB) ]; then mkdir $(DB); fi | |
169 | -@/bin/rm -f $(DB)/libpng-config | |
170 | -@/bin/rm -f $(DB)/$(LIBNAME)-config | |
171 | cp libpng-config $(DB)/$(LIBNAME)-config | |
172 | chmod 755 $(DB)/$(LIBNAME)-config | |
173 | (cd $(DB); ln -sf $(LIBNAME)-config libpng-config) | |
174 | ||
175 | install: install-static install-shared install-man install-config | |
176 | ||
177 | # If you installed in $(DESTDIR), test-installed won't work until you | |
178 | # move the library to its final location. Use test-dd to test it | |
179 | # before then. | |
180 | ||
181 | test-dd: | |
182 | echo | |
183 | echo Testing installed dynamic shared library in $(DL). | |
184 | $(CC) -I$(DI) -I$(ZLIBINC) \ | |
185 | `$(BINPATH)/libpng12-config --cflags` pngtest.c \ | |
186 | -L$(DL) -L$(ZLIBLIB) \ | |
187 | -rpath $(ZLIBLIB):$(DL) \ | |
188 | -o pngtestd `$(BINPATH)/libpng12-config --ldflags` | |
189 | ./pngtestd pngtest.png | |
190 | ||
191 | test-installed: | |
192 | echo | |
193 | echo Testing installed dynamic shared library. | |
194 | $(CC) -I$(ZLIBINC) \ | |
195 | `$(BINPATH)/libpng12-config --cflags` pngtest.c \ | |
196 | -L$(ZLIBLIB) \ | |
197 | -rpath $(ZLIBLIB):`$(BINPATH)/libpng12-config --libdir` \ | |
198 | -o pngtesti `$(BINPATH)/libpng12-config --ldflags` | |
199 | ./pngtesti pngtest.png | |
200 | ||
201 | clean: | |
202 | rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \ | |
203 | $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \ | |
204 | libpng.so.3.$(PNGMIN) \ | |
205 | so_locations | |
206 | ||
207 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO | |
208 | writelock: | |
209 | chmod a-w *.[ch35] $(DOCS) scripts/* | |
210 | ||
211 | # DO NOT DELETE THIS LINE -- make depend depends on it. | |
212 | ||
213 | png.o: png.h pngconf.h | |
214 | pngerror.o: png.h pngconf.h | |
215 | pngrio.o: png.h pngconf.h | |
216 | pngwio.o: png.h pngconf.h | |
217 | pngmem.o: png.h pngconf.h | |
218 | pngset.o: png.h pngconf.h | |
219 | pngget.o: png.h pngconf.h | |
220 | pngread.o: png.h pngconf.h | |
221 | pngrtran.o: png.h pngconf.h | |
222 | pngrutil.o: png.h pngconf.h | |
223 | pngtest.o: png.h pngconf.h | |
224 | pngtrans.o: png.h pngconf.h | |
225 | pngwrite.o: png.h pngconf.h | |
226 | pngwtran.o: png.h pngconf.h | |
227 | pngwutil.o: png.h pngconf.h | |
228 | pngpread.o: png.h pngconf.h | |
229 | pnggccrd.o: png.h pngconf.h | |
230 |