VirtualBox

source: vbox/trunk/src/libs/libpng-1.2.8/scripts/makefile.linux@ 9441

Last change on this file since 9441 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.1 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-config:
84 ( cat scripts/libpng-config-head.in; \
85 echo prefix=\"$(prefix)\"; \
86 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
87 echo L_opts=\"-L$(LIBPATH)\"; \
88 echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
89 echo libs=\"-lpng12 -lz -lm\"; \
90 cat scripts/libpng-config-body.in ) > libpng-config
91 chmod +x libpng-config
92
93$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
94 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
95
96$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
97 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
98
99$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
100 $(CC) -shared -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) \
101 -o $(LIBNAME).so.$(PNGVER) \
102 $(OBJSDLL)
103
104libpng.so.3.$(PNGMIN): $(OBJSDLL)
105 $(CC) -shared -Wl,-soname,libpng.so.3 \
106 -o libpng.so.3.$(PNGMIN) \
107 $(OBJSDLL)
108
109pngtest: pngtest.o $(LIBNAME).so
110 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
111
112pngtest-static: pngtest.o libpng.a
113 $(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
114
115test: pngtest pngtest-static
116 @echo ""
117 @echo " Running pngtest dynamically linked with $(LIBNAME).so:"
118 @echo ""
119 ./pngtest
120 @echo ""
121 @echo " Running pngtest statically linked with libpng.a:"
122 @echo ""
123 ./pngtest-static
124
125install-headers: png.h pngconf.h
126 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
127 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
128 cp png.h pngconf.h $(DI)/$(LIBNAME)
129 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
130 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
131 -@/bin/rm -f $(DI)/libpng
132 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
133
134install-static: install-headers libpng.a
135 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
136 cp libpng.a $(DL)/$(LIBNAME).a
137 chmod 644 $(DL)/$(LIBNAME).a
138 -@/bin/rm -f $(DL)/libpng.a
139 (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
140
141install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
142 libpng.so.3.$(PNGMIN)
143 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
144 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
145 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
146 -@/bin/rm -f $(DL)/libpng.so
147 -@/bin/rm -f $(DL)/libpng.so.3
148 -@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
149 cp $(LIBNAME).so.$(PNGVER) $(DL)
150 cp libpng.so.3.$(PNGMIN) $(DL)
151 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
152 chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
153 (cd $(DL); \
154 ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \
155 ln -sf libpng.so.3 libpng.so; \
156 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
157 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
158 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
159 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
160 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
161 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
162 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
163 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
164
165install-man: libpng.3 libpngpf.3 png.5
166 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
167 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
168 -@/bin/rm -f $(DM)/man3/libpng.3
169 -@/bin/rm -f $(DM)/man3/libpngpf.3
170 cp libpng.3 $(DM)/man3
171 cp libpngpf.3 $(DM)/man3
172 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
173 -@/bin/rm -f $(DM)/man5/png.5
174 cp png.5 $(DM)/man5
175
176install-config: libpng-config
177 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
178 -@/bin/rm -f $(DB)/libpng-config
179 -@/bin/rm -f $(DB)/$(LIBNAME)-config
180 cp libpng-config $(DB)/$(LIBNAME)-config
181 chmod 755 $(DB)/$(LIBNAME)-config
182 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
183
184install: install-static install-shared install-man install-config
185
186# If you installed in $(DESTDIR), test-installed won't work until you
187# move the library to its final location. Use test-dd to test it
188# before then.
189
190test-dd:
191 echo
192 echo Testing installed dynamic shared library in $(DL).
193 $(CC) -I$(DI) -I$(ZLIBINC) \
194 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
195 -L$(DL) -L$(ZLIBLIB) -W1, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
196 -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
197 ./pngtestd pngtest.png
198
199test-installed:
200 $(CC) -I$(ZLIBINC) \
201 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
202 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
203 -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
204 ./pngtesti pngtest.png
205
206clean:
207 /bin/rm -f *.o libpng.a pngtest pngout.png libpng-config \
208 $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti \
209 libpng.so.3.$(PNGMIN) \
210 libpng.pc
211
212DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
213writelock:
214 chmod a-w *.[ch35] $(DOCS) scripts/*
215
216# DO NOT DELETE THIS LINE -- make depend depends on it.
217
218png.o png.pic.o: png.h pngconf.h
219pngerror.o pngerror.pic.o: png.h pngconf.h
220pngrio.o pngrio.pic.o: png.h pngconf.h
221pngwio.o pngwio.pic.o: png.h pngconf.h
222pngmem.o pngmem.pic.o: png.h pngconf.h
223pngset.o pngset.pic.o: png.h pngconf.h
224pngget.o pngget.pic.o: png.h pngconf.h
225pngread.o pngread.pic.o: png.h pngconf.h
226pngrtran.o pngrtran.pic.o: png.h pngconf.h
227pngrutil.o pngrutil.pic.o: png.h pngconf.h
228pngtrans.o pngtrans.pic.o: png.h pngconf.h
229pngwrite.o pngwrite.pic.o: png.h pngconf.h
230pngwtran.o pngwtran.pic.o: png.h pngconf.h
231pngwutil.o pngwutil.pic.o: png.h pngconf.h
232pngpread.o pngpread.pic.o: png.h pngconf.h
233
234pngtest.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