]>
Commit | Line | Data |
---|---|---|
1 | # makefile for libpng.a and libpng15.so, SGI IRIX with 'cc' | |
2 | # Copyright (C) 2001-2002, 2006, 2007, 2010-2011 Glenn Randers-Pehrson | |
3 | # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. | |
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 | |
8 | ||
9 | # Library name: | |
10 | LIBNAME=libpng15 | |
11 | PNGMAJ = 15 | |
12 | ||
13 | # Shared library names: | |
14 | LIBSO=$(LIBNAME).so | |
15 | LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) | |
16 | LIBSOREL=$(LIBSOMAJ).$(RELEASE) | |
17 | OLDSO=libpng.so | |
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 | ||
27 | # Where make install puts libpng.a, libpng15.so, and libpng15/png.h | |
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 | |
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) -lpng15 -lz -lm | |
50 | LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm | |
51 | LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \ | |
52 | -set_version sgi$(PNGMAJ).0 | |
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 | # see scripts/pnglibconf.mak for more options | |
83 | pnglibconf.h: scripts/pnglibconf.h.prebuilt | |
84 | cp scripts/pnglibconf.h.prebuilt $@ | |
85 | ||
86 | libpng.a: $(OBJS) | |
87 | $(AR_RC) $@ $(OBJS) | |
88 | $(RANLIB) $@ | |
89 | ||
90 | libpng.pc: | |
91 | cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ | |
92 | -e s!@exec_prefix@!$(exec_prefix)! \ | |
93 | -e s!@libdir@!$(LIBPATH)! \ | |
94 | -e s!@includedir@!$(INCPATH)! \ | |
95 | -e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc | |
96 | ||
97 | libpng-config: | |
98 | ( cat scripts/libpng-config-head.in; \ | |
99 | echo prefix=\"$(prefix)\"; \ | |
100 | echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ | |
101 | echo ccopts=\"$(ABI)\"; \ | |
102 | echo ldopts=\"$(ABI)\"; \ | |
103 | echo L_opts=\"-L$(LIBPATH)\"; \ | |
104 | echo libdir=\"$(LIBPATH)\"; \ | |
105 | echo libs=\"-lpng15 -lz -lm\"; \ | |
106 | cat scripts/libpng-config-body.in ) > libpng-config | |
107 | chmod +x libpng-config | |
108 | ||
109 | $(LIBSO): $(LIBSOMAJ) | |
110 | $(LN_SF) $(LIBSOMAJ) $(LIBSO) | |
111 | ||
112 | $(LIBSOMAJ): $(OBJS) | |
113 | $(LDSHARED) -o $@ $(OBJS) | |
114 | $(RM_F) $(LIBSO) $(LIBSOMAJ) | |
115 | ||
116 | pngtest: pngtest.o libpng.a | |
117 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) | |
118 | ||
119 | test: pngtest | |
120 | echo | |
121 | echo Testing local static library. | |
122 | ./pngtest | |
123 | ||
124 | install-headers: png.h pngconf.h pnglibconf.h | |
125 | -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi | |
126 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi | |
127 | cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME) | |
128 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h | |
129 | -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h | |
130 | -@$(RM_F) $(DI)/libpng | |
131 | (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .) | |
132 | ||
133 | install-static: install-headers libpng.a | |
134 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi | |
135 | cp libpng.a $(DL)/$(LIBNAME).a | |
136 | chmod 644 $(DL)/$(LIBNAME).a | |
137 | -@$(RM_F) $(DL)/libpng.a | |
138 | (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a) | |
139 | ||
140 | install-shared: install-headers $(LIBSOMAJ) libpng.pc | |
141 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi | |
142 | -@$(RM_F) $(DL)/$(LIBSO) | |
143 | -@$(RM_F) $(DL)/$(LIBSOREL) | |
144 | -@$(RM_F) $(DL)/$(OLDSO) | |
145 | cp $(LIBSOMAJ) $(DL)/$(LIBSOREL) | |
146 | chmod 755 $(DL)/$(LIBSOREL) | |
147 | (cd $(DL); \ | |
148 | $(LN_SF) $(LIBSOREL) $(LIBSO); \ | |
149 | $(LN_SF) $(LIBSO) $(OLDSO)) | |
150 | -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi | |
151 | -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc | |
152 | -@$(RM_F) $(DL)/pkgconfig/libpng.pc | |
153 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc | |
154 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc | |
155 | (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc) | |
156 | ||
157 | install-man: libpng.3 libpngpf.3 png.5 | |
158 | -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi | |
159 | -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi | |
160 | -@$(RM_F) $(DM)/man3/libpng.3 | |
161 | -@$(RM_F) $(DM)/man3/libpngpf.3 | |
162 | cp libpng.3 $(DM)/man3 | |
163 | cp libpngpf.3 $(DM)/man3 | |
164 | -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi | |
165 | -@$(RM_F) $(DM)/man5/png.5 | |
166 | cp png.5 $(DM)/man5 | |
167 | ||
168 | install-config: libpng-config | |
169 | -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi | |
170 | -@$(RM_F) $(DB)/libpng-config | |
171 | -@$(RM_F) $(DB)/$(LIBNAME)-config | |
172 | cp libpng-config $(DB)/$(LIBNAME)-config | |
173 | chmod 755 $(DB)/$(LIBNAME)-config | |
174 | (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config) | |
175 | ||
176 | install: install-static install-shared install-man install-config | |
177 | ||
178 | # If you installed in $(DESTDIR), test-installed won't work until you | |
179 | # move the library to its final location. Use test-dd to test it | |
180 | # before then. | |
181 | ||
182 | test-dd: | |
183 | echo | |
184 | echo Testing installed dynamic shared library in $(DL). | |
185 | $(CC) -I$(DI) -I$(ZLIBINC) \ | |
186 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ | |
187 | -L$(DL) -L$(ZLIBLIB) \ | |
188 | -rpath $(ZLIBLIB):$(DL) \ | |
189 | -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` | |
190 | ./pngtestd pngtest.png | |
191 | ||
192 | test-installed: | |
193 | echo | |
194 | echo Testing installed dynamic shared library. | |
195 | $(CC) -I$(ZLIBINC) \ | |
196 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ | |
197 | -L$(ZLIBLIB) \ | |
198 | -rpath $(ZLIBLIB):`$(BINPATH)/$(LIBNAME)-config --libdir` \ | |
199 | -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` | |
200 | ./pngtesti pngtest.png | |
201 | ||
202 | clean: | |
203 | $(RM_F) *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \ | |
204 | $(LIBSO) $(LIBSOMAJ)* \ | |
205 | so_locations pnglibconf.h | |
206 | ||
207 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO | |
208 | writelock: | |
209 | chmod a-w *.[ch35] $(DOCS) scripts/* | |
210 | ||
211 | # DO NOT DELETE THIS LINE -- make depend depends on it. | |
212 | ||
213 | png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
214 | pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
215 | pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
216 | pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
217 | pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
218 | pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
219 | pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
220 | pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
221 | pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
222 | pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
223 | pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
224 | pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
225 | pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
226 | pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
227 | pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
228 | ||
229 | pngtest.o: png.h pngconf.h pnglibconf.h |