]>
Commit | Line | Data |
---|---|---|
f2f3b923 GD |
1 | # makefile for libpng.a and libpng12.so, SGI IRIX with 'cc' |
2 | # Copyright (C) 2001-2002 Glenn Randers-Pehrson | |
6f444465 GD |
3 | # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. |
4 | # For conditions of distribution and use, see copyright notice in png.h | |
5 | ||
f2f3b923 GD |
6 | LIBNAME=libpng12 |
7 | PNGMAJ = 0 | |
8 | PNGMIN = 1.2.4 | |
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 | ||
6f444465 | 16 | # Where the zlib library and include files are located |
f2f3b923 GD |
17 | #ZLIBLIB=/usr/local/lib32 |
18 | #ZLIBINC=/usr/local/include | |
6f444465 GD |
19 | #ZLIBLIB=/usr/local/lib |
20 | #ZLIBINC=/usr/local/include | |
21 | ZLIBLIB=../zlib | |
22 | ZLIBINC=../zlib | |
23 | ||
24 | CC=cc | |
25 | ||
f2f3b923 GD |
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 -DPNG_NO_ASSEMBLER_CODE | |
34 | LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng12 -lz -lm | |
35 | LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm | |
36 | LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ) | |
37 | # See "man dso" for info about shared objects | |
6f444465 GD |
38 | |
39 | RANLIB=echo | |
40 | #RANLIB=ranlib | |
41 | ||
f2f3b923 GD |
42 | INCPATH=$(prefix)/include |
43 | LIBPATH=$(prefix)/lib | |
44 | #LIBPATH=$(prefix)/lib32 | |
45 | MANPATH=$(prefix)/man | |
46 | BINPATH=$(prefix)/bin | |
47 | ||
48 | # override DESTDIR= on the make install command line to easily support | |
49 | # installing into a temporary location. Example: | |
50 | # | |
51 | # make install DESTDIR=/tmp/build/libpng | |
52 | # | |
53 | # If you're going to install into a temporary location | |
54 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before | |
55 | # you execute make install. | |
56 | DESTDIR= | |
57 | ||
58 | DB=$(DESTDIR)$(BINPATH) | |
59 | DI=$(DESTDIR)$(INCPATH) | |
60 | DL=$(DESTDIR)$(LIBPATH) | |
61 | DM=$(DESTDIR)$(MANPATH) | |
6f444465 | 62 | |
f2f3b923 | 63 | OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ |
6f444465 GD |
64 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ |
65 | pngwtran.o pngmem.o pngerror.o pngpread.o | |
66 | ||
f2f3b923 | 67 | all: libpng.a pngtest shared libpng.pc libpng-config |
6f444465 GD |
68 | |
69 | libpng.a: $(OBJS) | |
f2f3b923 | 70 | ar rc $@ $(OBJS) |
6f444465 GD |
71 | $(RANLIB) $@ |
72 | ||
f2f3b923 GD |
73 | shared: $(LIBNAME).so.$(PNGVER) |
74 | ||
75 | libpng.pc: | |
76 | cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc | |
77 | ||
78 | libpng-config: | |
79 | ( cat scripts/libpng-config-head.in; \ | |
80 | echo prefix=\"$(prefix)\"; \ | |
81 | echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_USE_PNGGCCRD \ | |
82 | -DPNG_NO_ASSEMBLER_CODE\"; \ | |
83 | echo cflags=\"$(ABI)\"; \ | |
84 | echo ldflags=\"-L$(LIBPATH) -rpath $(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 | ||
6f444465 GD |
99 | pngtest: pngtest.o libpng.a |
100 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) | |
101 | ||
102 | test: pngtest | |
f2f3b923 GD |
103 | echo |
104 | echo Testing local static library. | |
6f444465 GD |
105 | ./pngtest |
106 | ||
f2f3b923 GD |
107 | install-headers: png.h pngconf.h |
108 | -@if [ ! -d $(DI) ]; then mkdir $(DI); fi | |
109 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(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)/* .) | |
115 | ||
116 | install-static: install-headers libpng.a | |
117 | -@if [ ! -d $(DL) ]; then mkdir $(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) | |
122 | ||
123 | install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc | |
124 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi | |
125 | -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so | |
126 | -@/bin/rm -f $(DL)/libpng.so | |
127 | -@/bin/rm -f $(DL)/libpng.so.3 | |
128 | -@/bin/rm -f $(DL)/libpng.so.3.* | |
129 | cp $(LIBNAME).so.$(PNGVER) $(DL) | |
130 | chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER) | |
131 | (cd $(DL); \ | |
132 | ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \ | |
133 | ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3; \ | |
134 | ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \ | |
135 | ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ | |
136 | ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) | |
137 | -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi | |
138 | -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc | |
139 | -@/bin/rm -f $(DL)/pkgconfig/libpng.pc | |
140 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc | |
141 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc | |
142 | (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc) | |
143 | ||
144 | install-man: libpng.3 libpngpf.3 png.5 | |
145 | -@if [ ! -d $(DM) ]; then mkdir $(DM); fi | |
146 | -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi | |
147 | -@/bin/rm -f $(DM)/man3/libpng.3 | |
148 | -@/bin/rm -f $(DM)/man3/libpngpf.3 | |
149 | cp libpng.3 $(DM)/man3 | |
150 | cp libpngpf.3 $(DM)/man3 | |
151 | -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi | |
152 | -@/bin/rm -f $(DM)/man5/png.5 | |
153 | cp png.5 $(DM)/man5 | |
154 | ||
155 | install-config: libpng-config | |
156 | -@if [ ! -d $(DB) ]; then mkdir $(DB); fi | |
157 | -@/bin/rm -f $(DB)/libpng-config | |
158 | -@/bin/rm -f $(DB)/$(LIBNAME)-config | |
159 | cp libpng-config $(DB)/$(LIBNAME)-config | |
160 | chmod 755 $(DB)/$(LIBNAME)-config | |
161 | (cd $(DB); ln -sf $(LIBNAME)-config libpng-config) | |
162 | ||
163 | install: install-static install-shared install-man install-config | |
164 | ||
165 | # If you installed in $(DESTDIR), test-installed won't work until you | |
166 | # move the library to its final location. | |
167 | ||
168 | test-installed: | |
169 | echo | |
170 | echo Testing installed dynamic shared library. | |
171 | $(CC) -I$(ZLIBINC) \ | |
172 | `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \ | |
173 | -L$(ZLIBLIB) -rpath $(ZLIBLIB) \ | |
174 | -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs` | |
175 | ./pngtesti pngtest.png | |
6f444465 GD |
176 | |
177 | clean: | |
f2f3b923 GD |
178 | rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \ |
179 | $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* so_locations | |
180 | ||
181 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO | |
182 | writelock: | |
183 | chmod a-w *.[ch35] $(DOCS) scripts/* | |
6f444465 GD |
184 | |
185 | # DO NOT DELETE THIS LINE -- make depend depends on it. | |
186 | ||
187 | png.o: png.h pngconf.h | |
188 | pngerror.o: png.h pngconf.h | |
189 | pngrio.o: png.h pngconf.h | |
190 | pngwio.o: png.h pngconf.h | |
191 | pngmem.o: png.h pngconf.h | |
192 | pngset.o: png.h pngconf.h | |
193 | pngget.o: png.h pngconf.h | |
194 | pngread.o: png.h pngconf.h | |
195 | pngrtran.o: png.h pngconf.h | |
196 | pngrutil.o: png.h pngconf.h | |
197 | pngtest.o: png.h pngconf.h | |
198 | pngtrans.o: png.h pngconf.h | |
199 | pngwrite.o: png.h pngconf.h | |
200 | pngwtran.o: png.h pngconf.h | |
201 | pngwutil.o: png.h pngconf.h | |
202 | pngpread.o: png.h pngconf.h | |
f2f3b923 | 203 | pnggccrd.o: png.h pngconf.h |
6f444465 | 204 |