comparison ext/libpng-1.2.29/scripts/makefile.elf @ 0:4a0efb7baf70

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