VirtualBox

source: vbox/trunk/src/libs/libpng-1.2.54/scripts/makefile.elf@ 78327

Last change on this file since 78327 was 58796, checked in by vboxsync, 9 years ago

libpng 1.2.54 unmodified

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette