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