]> git.saurik.com Git - wxWidgets.git/blame - src/png/scripts/makefile.gcmmx
Fixed player dialog listbox size and app icon on wxGTK
[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
3# Copyright 2002, 2006 Greg Roelofs and Glenn Randers-Pehrson
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
17PNGMIN = 1.2.20
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:
61CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -Wall -O \
62 $(ALIGN) -funroll-loops \
63 -fomit-frame-pointer # $(WARNMORE) -g -DPNG_DEBUG=5
64### for gcc 2.95.2 on 686:
65#CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -Wall -O \
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:
69#CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -Wall -O \
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:
115 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
116
117libpng-config:
118 ( cat scripts/libpng-config-head.in; \
119 echo prefix=\"$(prefix)\"; \
120 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
121 echo cppflags=\"-DPNG_THREAD_UNSAFE_OK \"; \
122 echo L_opts=\"-L$(LIBPATH)\"; \
123 echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
124 echo libs=\"-lpng12 -lz -lm\"; \
125 cat scripts/libpng-config-body.in ) > libpng-config
126 chmod +x libpng-config
127
128$(LIBSO): $(LIBSOMAJ)
129 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
130
131$(LIBSOMAJ): $(LIBSOVER)
132 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
133
134$(LIBSOVER): $(OBJSDLL)
135 $(CC) -shared -Wl,-soname,$(LIBSOMAJ) \
136 -o $(LIBSOVER) \
137 $(OBJSDLL)
138
139$(OLDSOVER): $(OBJSDLL)
140 $(CC) -shared -Wl,-soname,$(OLDSOMAJ) \
141 -o $(OLDSOVER) \
142 $(OBJSDLL)
143
144pngtest: pngtest.o $(LIBSO)
145 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
146
147pngtest-static: pngtest.o libpng.a
148 $(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
149
150test: pngtest pngtest-static
151 @echo ""
152 @echo " Running pngtest dynamically linked with $(LIBSO):"
153 @echo ""
154 ./pngtest
155 @echo ""
156 @echo " Running pngtest statically linked with libpng.a:"
157 @echo ""
158 ./pngtest-static
159
160install-headers: png.h pngconf.h
161 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
162 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
163 cp png.h pngconf.h $(DI)/$(LIBNAME)
164 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
165 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
166 -@$(RM_F) $(DI)/libpng
167 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
168
169install-static: install-headers libpng.a
170 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
171 cp libpng.a $(DL)/$(LIBNAME).a
172 chmod 644 $(DL)/$(LIBNAME).a
173 -@$(RM_F) $(DL)/libpng.a
174 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
175
176install-shared: install-headers $(LIBSOVER) libpng.pc \
177 $(OLDSOVER)
178 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
179 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
180 -@$(RM_F) $(DL)/$(LIBSOMAJ)
181 -@$(RM_F) $(DL)/$(OLDSO)
182 -@$(RM_F) $(DL)/$(OLDSOMAJ)
183 -@$(RM_F) $(DL)/$(OLDSOVER)*
184 cp $(LIBSOVER) $(DL)
185 cp $(OLDSOVER) $(DL)
186 chmod 755 $(DL)/$(LIBSOVER)
187 chmod 755 $(DL)/$(OLDSOVER)
188 (cd $(DL); \
189 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
190 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
191 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
192 $(LN_SF) $(LIBSOMAJ) $(LIBSO))
193 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
194 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
195 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
196 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
197 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
198 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
199
200install-man: libpng.3 libpngpf.3 png.5
201 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
202 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
203 -@$(RM_F) $(DM)/man3/libpng.3
204 -@$(RM_F) $(DM)/man3/libpngpf.3
205 cp libpng.3 $(DM)/man3
206 cp libpngpf.3 $(DM)/man3
207 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
208 -@$(RM_F) $(DM)/man5/png.5
209 cp png.5 $(DM)/man5
210
211install-config: libpng-config
212 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
213 -@$(RM_F) $(DB)/libpng-config
214 -@$(RM_F) $(DB)/$(LIBNAME)-config
215 cp libpng-config $(DB)/$(LIBNAME)-config
216 chmod 755 $(DB)/$(LIBNAME)-config
217 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
218
219install: install-static install-shared install-man install-config
220
221# If you installed in $(DESTDIR), test-installed won't work until you
222# move the library to its final location. Use test-dd to test it
223# before then.
224
225test-dd:
226 echo
227 echo Testing installed dynamic shared library in $(DL).
228 $(CC) -I$(DI) -I$(ZLIBINC) \
229 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
230 -L$(DL) -L$(ZLIBLIB) -Wl, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
231 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
232 ./pngtestd pngtest.png
233
234test-installed:
235 $(CC) -I$(ZLIBINC) \
236 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
237 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
238 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
239 ./pngtesti pngtest.png
240
241clean:
242 $(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
243 $(LIBSO) $(LIBSOMAJ)* pngtest-static pngtesti \
244 $(OLDSOVER) \
245 libpng.pc
246
247DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
248writelock:
249 chmod a-w *.[ch35] $(DOCS) scripts/*
250
251png.o png.pic.o: png.h pngconf.h png.c
252pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.c
253pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.c
254pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.c
255pngmem.o pngmem.pic.o: png.h pngconf.h pngmem.c
256pngset.o pngset.pic.o: png.h pngconf.h pngset.c
257pngget.o pngget.pic.o: png.h pngconf.h pngget.c
258pngread.o pngread.pic.o: png.h pngconf.h pngread.c
259pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.c
260pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c
261pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.c
262pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
263pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
264pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c
265pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c
266
267pngtest.o: png.h pngconf.h pngtest.c