]> git.saurik.com Git - wxWidgets.git/blob - src/png/scripts/makefile.elf
Moved wxPGProperty::SetFlag() to protected API since it does not have any side-effect...
[wxWidgets.git] / src / png / scripts / makefile.elf
1 # makefile for libpng.a and libpng12.so on Linux ELF with gcc
2 # Copyright (C) 1998, 1999, 2002, 2006, 2008 Greg Roelofs
3 # and Glenn Randers-Pehrson
4 # Copyright (C) 1996, 1997 Andreas Dilger
5 # For conditions of distribution and use, see copyright notice in png.h
6
7 # Modified for Debian by Junichi Uekawa and Josselin Mouette
8 # Major modifications are:
9 # * link libpng explicitly with libz and libm
10 # * $(OLDSO).3 is a symlink rather than a different library
11 # * versioned symbols
12
13 # Library name:
14 LIBNAME = libpng12
15 PNGMAJ = 0
16 PNGMIN = 1.2.34
17 PNGVER = $(PNGMAJ).$(PNGMIN)
18
19 # Shared library names:
20 LIBSO=$(LIBNAME).so
21 LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
22 LIBSOVER=$(LIBNAME).so.$(PNGVER)
23 OLDSO=libpng.so
24 OLDSOMAJ=libpng.so.3
25 OLDSOVER=libpng.so.3.$(PNGMIN)
26
27 # Utilities:
28 AR_RC=ar rc
29 CC=gcc
30 MKDIR_P=mkdir -p
31 LN_SF=ln -sf
32 RANLIB=ranlib
33 RM_F=/bin/rm -f
34
35 # where "make install" puts libpng12.a, libpng12.so*,
36 # libpng12/png.h and libpng12/pngconf.h
37 # Prefix must be a full pathname.
38 prefix=/usr/local
39 exec_prefix=$(prefix)
40
41 # Where the zlib library and include files are located.
42 ZLIBLIB=/usr/local/lib
43 ZLIBINC=/usr/local/include
44 # ZLIBLIB=../zlib
45 # ZLIBINC=../zlib
46
47 ALIGN=
48 # for i386:
49 #ALIGN=-malign-loops=2 -malign-functions=2
50
51 WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
52 -Wmissing-declarations -Wtraditional -Wcast-align \
53 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
54
55 # for pgcc version 2.95.1, -O3 is buggy; don't use it.
56
57 CFLAGS=-W -Wall -D_REENTRANT -O2 \
58 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
59
60 LDFLAGS=-L. -lpng12
61 LDFLAGS_A=libpng.a -lz -lm
62 LIBADDFLAGS=-lz -lm
63
64
65 INCPATH=$(prefix)/include
66 LIBPATH=$(exec_prefix)/lib
67 MANPATH=$(prefix)/man
68 BINPATH=$(exec_prefix)/bin
69
70 # override DESTDIR= on the make install command line to easily support
71 # installing into a temporary location. Example:
72 #
73 # make install DESTDIR=/tmp/build/libpng
74 #
75 # If you're going to install into a temporary location
76 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
77 # you execute make install.
78 DESTDIR=
79
80 DB=$(DESTDIR)$(BINPATH)
81 DI=$(DESTDIR)$(INCPATH)
82 DL=$(DESTDIR)$(LIBPATH)
83 DM=$(DESTDIR)$(MANPATH)
84
85 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
86 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
87 pngwtran.o pngmem.o pngerror.o pngpread.o
88
89 OBJSDLL = $(OBJS:.o=.pic.o)
90
91 .SUFFIXES: .c .o .pic.o
92
93 .c.pic.o:
94 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
95
96 all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config
97
98 libpng.a: $(OBJS)
99 $(AR_RC) $@ $(OBJS)
100 $(RANLIB) $@
101
102 libpng.pc:
103 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
104 -e s!@exec_prefix@!$(exec_prefix)! \
105 -e s!@libdir@!$(LIBPATH)! \
106 -e s!@includedir@!$(INCPATH)! \
107 -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
108
109 libpng.syms: png.h pngconf.h
110 $(CC) $(CFLAGS) -E -DPNG_BUILDSYMS -DPNG_INTERNAL png.h |\
111 awk -F '[\t [\\]();]' -v PNGMAJ=$(PNGMAJ) 'BEGIN{printf("PNG12_%s {global:\n",PNGMAJ)}\
112 { for (i=1;i+2<=NF;++i)\
113 if ($$(i)=="PNG_FUNCTION_EXPORT" && $$(i+2)=="END")\
114 print $$(i+1) ";";\
115 for (i=1;i+1<=NF;++i)\
116 if ($$(i)=="PNG_DATA_EXPORT")\
117 print $$(i+1) ";";}\
118 END{print "local: *; };"}' >$@.new
119 $(RM_F) $@
120 mv $@.new $@
121
122 libpng-config:
123 ( cat scripts/libpng-config-head.in; \
124 echo prefix=\"$(prefix)\"; \
125 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
126 echo L_opts=\"\"; \
127 echo R_opts=\"\"; \
128 echo libs=\"-lpng12\"; \
129 echo all_libs=\"-lpng12 $(LIBADDFLAGS)\"; \
130 cat scripts/libpng-config-body.in ) > libpng-config
131 chmod +x libpng-config
132
133 $(LIBSO): $(LIBSOMAJ)
134 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
135
136 $(LIBSOMAJ): $(LIBSOVER)
137 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
138
139 $(LIBSOVER): $(OBJSDLL) libpng.syms
140 $(CC) -shared -Wl,-soname,$(LIBSOMAJ) \
141 -Wl,-version-script,libpng.syms \
142 -o $(LIBSOVER) \
143 $(OBJSDLL)
144
145 $(OLDSOVER): $(OBJSDLL) libpng.syms
146 $(CC) -shared -Wl,-soname,$(OLDSOMAJ) \
147 -Wl,-version-script,libpng.syms \
148 -o $(OLDSOVER) \
149 $(OBJSDLL)
150
151 pngtest: pngtest.o $(LIBSO)
152 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
153
154 pngtest-static: pngtest.o libpng.a
155 $(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
156
157 test: pngtest pngtest-static
158 @echo ""
159 @echo " Running pngtest dynamically linked with $(LIBSO):"
160 @echo ""
161 LD_LIBRARY_PATH=".:${LD_LIBRARY_PATH}" ./pngtest
162 @echo ""
163 @echo " Running pngtest statically linked with libpng.a:"
164 @echo ""
165 ./pngtest-static
166
167 install-headers: png.h pngconf.h
168 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
169 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
170 cp png.h pngconf.h $(DI)/$(LIBNAME)
171 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
172 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
173 -@$(RM_F) $(DI)/libpng
174 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
175
176 install-static: install-headers libpng.a
177 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
178 cp libpng.a $(DL)/$(LIBNAME).a
179 chmod 644 $(DL)/$(LIBNAME).a
180 -@$(RM_F) $(DL)/libpng.a
181 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
182
183 install-shared: install-headers $(LIBSOVER) libpng.pc \
184 $(OLDSOVER)
185 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
186 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
187 -@$(RM_F) $(DL)/$(LIBSOMAJ)
188 -@$(RM_F) $(DL)/$(OLDSO)
189 -@$(RM_F) $(DL)/$(OLDSOMAJ)
190 -@$(RM_F) $(DL)/$(OLDSOVER)*
191 cp $(LIBSOVER) $(DL)
192 cp $(OLDSOVER) $(DL)
193 chmod 755 $(DL)/$(LIBSOVER)
194 chmod 755 $(DL)/$(OLDSOVER)
195 (cd $(DL); \
196 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
197 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
198 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
199 $(LN_SF) $(LIBSOMAJ) $(LIBSO))
200 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
201 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
202 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
203 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
204 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
205 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
206
207 install-man: libpng.3 libpngpf.3 png.5
208 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
209 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
210 -@$(RM_F) $(DM)/man3/libpng.3
211 -@$(RM_F) $(DM)/man3/libpngpf.3
212 cp libpng.3 $(DM)/man3
213 cp libpngpf.3 $(DM)/man3
214 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
215 -@$(RM_F) $(DM)/man5/png.5
216 cp png.5 $(DM)/man5
217
218 install-config: libpng-config
219 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
220 -@$(RM_F) $(DB)/libpng-config
221 -@$(RM_F) $(DB)/$(LIBNAME)-config
222 cp libpng-config $(DB)/$(LIBNAME)-config
223 chmod 755 $(DB)/$(LIBNAME)-config
224 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
225
226 install: install-static install-shared install-man install-config
227
228 # If you installed in $(DESTDIR), test-installed won't work until you
229 # move the library to its final location. Use test-dd to test it
230 # before then.
231
232 test-dd:
233 echo
234 echo Testing installed dynamic shared library in $(DL).
235 $(CC) -I$(DI) -I$(ZLIBINC) \
236 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
237 -L$(DL) -L$(ZLIBLIB) -Wl, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
238 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
239 ./pngtestd pngtest.png
240
241 test-installed:
242 $(CC) -I$(ZLIBINC) \
243 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
244 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
245 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
246 ./pngtesti pngtest.png
247
248 clean:
249 $(RM_F) *.o libpng.a libpng.syms pngtest pngout.png libpng-config \
250 $(LIBSO) $(LIBSOMAJ)* pngtest-static pngtesti \
251 $(OLDSOVER) \
252 libpng.pc
253
254 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
255 writelock:
256 chmod a-w *.[ch35] $(DOCS) scripts/*
257
258 # DO NOT DELETE THIS LINE -- make depend depends on it.
259
260 png.o png.pic.o: png.h pngconf.h
261 pngerror.o pngerror.pic.o: png.h pngconf.h
262 pngrio.o pngrio.pic.o: png.h pngconf.h
263 pngwio.o pngwio.pic.o: png.h pngconf.h
264 pngmem.o pngmem.pic.o: png.h pngconf.h
265 pngset.o pngset.pic.o: png.h pngconf.h
266 pngget.o pngget.pic.o: png.h pngconf.h
267 pngread.o pngread.pic.o: png.h pngconf.h
268 pngrtran.o pngrtran.pic.o: png.h pngconf.h
269 pngrutil.o pngrutil.pic.o: png.h pngconf.h
270 pngtrans.o pngtrans.pic.o: png.h pngconf.h
271 pngwrite.o pngwrite.pic.o: png.h pngconf.h
272 pngwtran.o pngwtran.pic.o: png.h pngconf.h
273 pngwutil.o pngwutil.pic.o: png.h pngconf.h
274 pngpread.o pngpread.pic.o: png.h pngconf.h
275
276 pngtest.o: png.h pngconf.h