VirtualBox

source: vbox/trunk/src/libs/libpng-1.2.54/scripts/makefile.gcmmx@ 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.3 KB
Line 
1# makefile for libpng.a and libpng12.so on Linux ELF with gcc using MMX
2# assembler code
3# Copyright 2002, 2006, 2008 Greg Roelofs and Glenn Randers-Pehrson
4# Copyright 1998-2001 Greg Roelofs
5# Copyright 1996-1997 Andreas Dilger
6
7# This code is released under the libpng license.
8# For conditions of distribution and use, see the disclaimer
9# and license in png.h
10
11# CAUTION: Do not use this makefile with gcc versions 2.7.2.2 and earlier.
12
13# NOTE: When testing MMX performance on a multitasking system, make sure
14# there are no floating-point programs (e.g., SETI@Home) running in
15# the background! Context switches between MMX and FPU are expensive.
16
17# Library name:
18LIBNAME = libpng12
19PNGMAJ = 0
20PNGMIN = 1.2.54
21PNGVER = $(PNGMAJ).$(PNGMIN)
22
23# Shared library names:
24LIBSO=$(LIBNAME).so
25LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
26LIBSOVER=$(LIBNAME).so.$(PNGVER)
27OLDSO=libpng.so
28OLDSOMAJ=libpng.so.3
29OLDSOVER=libpng.so.3.$(PNGMIN)
30
31# Utilities:
32CC = gcc
33LD = $(CC)
34AR_RC = ar rc
35LN_SF = ln -sf
36MKDIR_P = mkdir -p
37RANLIB = ranlib
38RM_F = /bin/rm -f
39
40# where "make install" puts libpng12.a, libpng12.so*,
41# libpng12/png.h and libpng12/pngconf.h
42# Prefix must be a full pathname.
43prefix=/usr/local
44exec_prefix=$(prefix)
45
46# Where the zlib library and include files are located.
47#ZLIBLIB=/usr/local/lib
48#ZLIBINC=/usr/local/include
49ZLIBLIB=../zlib
50ZLIBINC=../zlib
51
52ALIGN=
53# for i386:
54#ALIGN=-malign-loops=2 -malign-functions=2
55
56WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
57 -Wmissing-declarations -Wtraditional -Wcast-align \
58 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
59
60# for pgcc version 2.95.1, -O3 is buggy; don't use it.
61
62# Remove -DPNG_THREAD_UNSAFE_OK if you need thread safety
63### for generic gcc:
64CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -W -Wall -O \
65 $(ALIGN) -funroll-loops \
66 -fomit-frame-pointer # $(WARNMORE) -g -DPNG_DEBUG=5
67### for gcc 2.95.2 on 686:
68#CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -W -Wall -O \
69# -mcpu=i686 -malign-double -ffast-math -fstrict-aliasing \
70# $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer
71### for gcc 2.7.2.3 on 486 and up:
72#CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -W -Wall -O \
73# -m486 -malign-double -ffast-math \
74# $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer
75
76LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
77LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
78
79
80INCPATH=$(prefix)/include
81LIBPATH=$(exec_prefix)/lib
82MANPATH=$(prefix)/man
83BINPATH=$(exec_prefix)/bin
84
85# override DESTDIR= on the make install command line to easily support
86# installing into a temporary location. Example:
87#
88# make install DESTDIR=/tmp/build/libpng
89#
90# If you're going to install into a temporary location
91# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
92# you execute make install.
93DESTDIR=
94
95DB=$(DESTDIR)$(BINPATH)
96DI=$(DESTDIR)$(INCPATH)
97DL=$(DESTDIR)$(LIBPATH)
98DM=$(DESTDIR)$(MANPATH)
99
100OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
101 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
102 pngwtran.o pngmem.o pngerror.o pngpread.o
103
104OBJSDLL = $(OBJS:.o=.pic.o)
105
106.SUFFIXES: .c .o .pic.o
107
108.c.pic.o:
109 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
110
111all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config
112
113libpng.a: $(OBJS)
114 $(AR_RC) $@ $(OBJS)
115 $(RANLIB) $@
116
117libpng.pc:
118 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
119 -e s!@exec_prefix@!$(exec_prefix)! \
120 -e s!@libdir@!$(LIBPATH)! \
121 -e s!@includedir@!$(INCPATH)! \
122 -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
123
124libpng-config:
125 ( cat scripts/libpng-config-head.in; \
126 echo prefix=\"$(prefix)\"; \
127 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
128 echo cppflags=\"-DPNG_THREAD_UNSAFE_OK \"; \
129 echo L_opts=\"-L$(LIBPATH)\"; \
130 echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
131 echo libs=\"-lpng12 -lz -lm\"; \
132 cat scripts/libpng-config-body.in ) > libpng-config
133 chmod +x libpng-config
134
135$(LIBSO): $(LIBSOMAJ)
136 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
137
138$(LIBSOMAJ): $(LIBSOVER)
139 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
140
141$(LIBSOVER): $(OBJSDLL)
142 $(CC) -shared -Wl,-soname,$(LIBSOMAJ) \
143 -o $(LIBSOVER) \
144 $(OBJSDLL)
145
146$(OLDSOVER): $(OBJSDLL)
147 $(CC) -shared -Wl,-soname,$(OLDSOMAJ) \
148 -o $(OLDSOVER) \
149 $(OBJSDLL)
150
151pngtest: pngtest.o $(LIBSO)
152 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
153
154pngtest-static: pngtest.o libpng.a
155 $(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
156
157test: pngtest pngtest-static
158 @echo ""
159 @echo " Running pngtest dynamically linked with $(LIBSO):"
160 @echo ""
161 ./pngtest
162 @echo ""
163 @echo " Running pngtest statically linked with libpng.a:"
164 @echo ""
165 ./pngtest-static
166
167install-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
176install-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
183install-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
207install-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
218install-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
226install: 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
232test-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
241test-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
248clean:
249 $(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
250 $(LIBSO) $(LIBSOMAJ)* pngtest-static pngtesti \
251 $(OLDSOVER) \
252 libpng.pc
253
254DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
255writelock:
256 chmod a-w *.[ch35] $(DOCS) scripts/*
257
258png.o png.pic.o: png.h pngconf.h png.c
259pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.c
260pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.c
261pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.c
262pngmem.o pngmem.pic.o: png.h pngconf.h pngmem.c
263pngset.o pngset.pic.o: png.h pngconf.h pngset.c
264pngget.o pngget.pic.o: png.h pngconf.h pngget.c
265pngread.o pngread.pic.o: png.h pngconf.h pngread.c
266pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.c
267pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c
268pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.c
269pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
270pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
271pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c
272pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c
273
274pngtest.o: png.h pngconf.h pngtest.c
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