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