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