]> git.saurik.com Git - wxWidgets.git/blame - src/png/scripts/makefile.gcmmx
fixing infinite recursion
[wxWidgets.git] / src / png / scripts / makefile.gcmmx
CommitLineData
0272a10d
VZ
1# makefile for libpng.a and libpng12.so on Linux ELF with gcc using MMX
2# assembler code
970f6abe 3# Copyright 2002, 2006, 2008 Greg Roelofs and Glenn Randers-Pehrson
0272a10d
VZ
4# Copyright 1998-2001 Greg Roelofs
5# Copyright 1996-1997 Andreas Dilger
6# For conditions of distribution and use, see copyright notice in png.h
7
8# CAUTION: Do not use this makefile with gcc versions 2.7.2.2 and earlier.
9
10# NOTE: When testing MMX performance on a multitasking system, make sure
11# there are no floating-point programs (e.g., SETI@Home) running in
12# the background! Context switches between MMX and FPU are expensive.
13
14# Library name:
15LIBNAME = libpng12
16PNGMAJ = 0
970f6abe 17PNGMIN = 1.2.34
0272a10d
VZ
18PNGVER = $(PNGMAJ).$(PNGMIN)
19
20# Shared library names:
21LIBSO=$(LIBNAME).so
22LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
23LIBSOVER=$(LIBNAME).so.$(PNGVER)
24OLDSO=libpng.so
25OLDSOMAJ=libpng.so.3
26OLDSOVER=libpng.so.3.$(PNGMIN)
27
28# Utilities:
29CC = gcc
30LD = $(CC)
31AR_RC = ar rc
32LN_SF = ln -sf
33MKDIR_P = mkdir -p
34RANLIB = ranlib
35RM_F = /bin/rm -f
36
37# where "make install" puts libpng12.a, libpng12.so*,
38# libpng12/png.h and libpng12/pngconf.h
39# Prefix must be a full pathname.
40prefix=/usr/local
41exec_prefix=$(prefix)
42
43# Where the zlib library and include files are located.
44#ZLIBLIB=/usr/local/lib
45#ZLIBINC=/usr/local/include
46ZLIBLIB=../zlib
47ZLIBINC=../zlib
48
49ALIGN=
50# for i386:
51#ALIGN=-malign-loops=2 -malign-functions=2
52
53WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
54 -Wmissing-declarations -Wtraditional -Wcast-align \
55 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
56
57# for pgcc version 2.95.1, -O3 is buggy; don't use it.
58
59# Remove -DPNG_THREAD_UNSAFE_OK if you need thread safety
60### for generic gcc:
970f6abe 61CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -W -Wall -O \
0272a10d
VZ
62 $(ALIGN) -funroll-loops \
63 -fomit-frame-pointer # $(WARNMORE) -g -DPNG_DEBUG=5
64### for gcc 2.95.2 on 686:
970f6abe 65#CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -W -Wall -O \
0272a10d
VZ
66# -mcpu=i686 -malign-double -ffast-math -fstrict-aliasing \
67# $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer
68### for gcc 2.7.2.3 on 486 and up:
970f6abe 69#CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -W -Wall -O \
0272a10d
VZ
70# -m486 -malign-double -ffast-math \
71# $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer
72
73LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
74LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
75
76
77INCPATH=$(prefix)/include
78LIBPATH=$(exec_prefix)/lib
79MANPATH=$(prefix)/man
80BINPATH=$(exec_prefix)/bin
81
82# override DESTDIR= on the make install command line to easily support
83# installing into a temporary location. Example:
84#
85# make install DESTDIR=/tmp/build/libpng
86#
87# If you're going to install into a temporary location
88# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
89# you execute make install.
90DESTDIR=
91
92DB=$(DESTDIR)$(BINPATH)
93DI=$(DESTDIR)$(INCPATH)
94DL=$(DESTDIR)$(LIBPATH)
95DM=$(DESTDIR)$(MANPATH)
96
97OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
98 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
99 pngwtran.o pngmem.o pngerror.o pngpread.o
100
101OBJSDLL = $(OBJS:.o=.pic.o)
102
103.SUFFIXES: .c .o .pic.o
104
105.c.pic.o:
106 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
107
108all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config
109
110libpng.a: $(OBJS)
111 $(AR_RC) $@ $(OBJS)
112 $(RANLIB) $@
113
114libpng.pc:
970f6abe
VZ
115 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
116 -e s!@exec_prefix@!$(exec_prefix)! \
117 -e s!@libdir@!$(LIBPATH)! \
118 -e s!@includedir@!$(INCPATH)! \
119 -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
0272a10d
VZ
120
121libpng-config:
122 ( cat scripts/libpng-config-head.in; \
123 echo prefix=\"$(prefix)\"; \
124 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
125 echo cppflags=\"-DPNG_THREAD_UNSAFE_OK \"; \
126 echo L_opts=\"-L$(LIBPATH)\"; \
127 echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
128 echo libs=\"-lpng12 -lz -lm\"; \
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)
139 $(CC) -shared -Wl,-soname,$(LIBSOMAJ) \
140 -o $(LIBSOVER) \
141 $(OBJSDLL)
142
143$(OLDSOVER): $(OBJSDLL)
144 $(CC) -shared -Wl,-soname,$(OLDSOMAJ) \
145 -o $(OLDSOVER) \
146 $(OBJSDLL)
147
148pngtest: pngtest.o $(LIBSO)
149 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
150
151pngtest-static: pngtest.o libpng.a
152 $(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
153
154test: pngtest pngtest-static
155 @echo ""
156 @echo " Running pngtest dynamically linked with $(LIBSO):"
157 @echo ""
158 ./pngtest
159 @echo ""
160 @echo " Running pngtest statically linked with libpng.a:"
161 @echo ""
162 ./pngtest-static
163
164install-headers: png.h pngconf.h
165 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
166 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
167 cp png.h pngconf.h $(DI)/$(LIBNAME)
168 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
169 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
170 -@$(RM_F) $(DI)/libpng
171 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
172
173install-static: install-headers libpng.a
174 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
175 cp libpng.a $(DL)/$(LIBNAME).a
176 chmod 644 $(DL)/$(LIBNAME).a
177 -@$(RM_F) $(DL)/libpng.a
178 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
179
180install-shared: install-headers $(LIBSOVER) libpng.pc \
181 $(OLDSOVER)
182 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
183 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
184 -@$(RM_F) $(DL)/$(LIBSOMAJ)
185 -@$(RM_F) $(DL)/$(OLDSO)
186 -@$(RM_F) $(DL)/$(OLDSOMAJ)
187 -@$(RM_F) $(DL)/$(OLDSOVER)*
188 cp $(LIBSOVER) $(DL)
189 cp $(OLDSOVER) $(DL)
190 chmod 755 $(DL)/$(LIBSOVER)
191 chmod 755 $(DL)/$(OLDSOVER)
192 (cd $(DL); \
193 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
194 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
195 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
196 $(LN_SF) $(LIBSOMAJ) $(LIBSO))
197 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
198 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
199 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
200 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
201 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
202 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
203
204install-man: libpng.3 libpngpf.3 png.5
205 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
206 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
207 -@$(RM_F) $(DM)/man3/libpng.3
208 -@$(RM_F) $(DM)/man3/libpngpf.3
209 cp libpng.3 $(DM)/man3
210 cp libpngpf.3 $(DM)/man3
211 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
212 -@$(RM_F) $(DM)/man5/png.5
213 cp png.5 $(DM)/man5
214
215install-config: libpng-config
216 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
217 -@$(RM_F) $(DB)/libpng-config
218 -@$(RM_F) $(DB)/$(LIBNAME)-config
219 cp libpng-config $(DB)/$(LIBNAME)-config
220 chmod 755 $(DB)/$(LIBNAME)-config
221 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
222
223install: install-static install-shared install-man install-config
224
225# If you installed in $(DESTDIR), test-installed won't work until you
226# move the library to its final location. Use test-dd to test it
227# before then.
228
229test-dd:
230 echo
231 echo Testing installed dynamic shared library in $(DL).
232 $(CC) -I$(DI) -I$(ZLIBINC) \
233 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
234 -L$(DL) -L$(ZLIBLIB) -Wl, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
235 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
236 ./pngtestd pngtest.png
237
238test-installed:
239 $(CC) -I$(ZLIBINC) \
240 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
241 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
242 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
243 ./pngtesti pngtest.png
244
245clean:
246 $(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
247 $(LIBSO) $(LIBSOMAJ)* pngtest-static pngtesti \
248 $(OLDSOVER) \
249 libpng.pc
250
251DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
252writelock:
253 chmod a-w *.[ch35] $(DOCS) scripts/*
254
255png.o png.pic.o: png.h pngconf.h png.c
256pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.c
257pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.c
258pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.c
259pngmem.o pngmem.pic.o: png.h pngconf.h pngmem.c
260pngset.o pngset.pic.o: png.h pngconf.h pngset.c
261pngget.o pngget.pic.o: png.h pngconf.h pngget.c
262pngread.o pngread.pic.o: png.h pngconf.h pngread.c
263pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.c
264pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c
265pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.c
266pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
267pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
268pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c
269pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c
270
271pngtest.o: png.h pngconf.h pngtest.c