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