VirtualBox

source: vbox/trunk/src/libs/libpng-1.2.8/scripts/makefile.elf@ 32036

Last change on this file since 32036 was 6395, checked in by vboxsync, 17 years ago

export libpng and zlib so Windows and OS/2 build cleanly.

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