]> git.saurik.com Git - wxWidgets.git/blob - src/png/scripts/makefile.gcmmx
compilation fix after r61232
[wxWidgets.git] / src / png / scripts / makefile.gcmmx
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 # 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:
15 LIBNAME = libpng12
16 PNGMAJ = 0
17 PNGMIN = 1.2.34
18 PNGVER = $(PNGMAJ).$(PNGMIN)
19
20 # Shared library names:
21 LIBSO=$(LIBNAME).so
22 LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
23 LIBSOVER=$(LIBNAME).so.$(PNGVER)
24 OLDSO=libpng.so
25 OLDSOMAJ=libpng.so.3
26 OLDSOVER=libpng.so.3.$(PNGMIN)
27
28 # Utilities:
29 CC = gcc
30 LD = $(CC)
31 AR_RC = ar rc
32 LN_SF = ln -sf
33 MKDIR_P = mkdir -p
34 RANLIB = ranlib
35 RM_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.
40 prefix=/usr/local
41 exec_prefix=$(prefix)
42
43 # Where the zlib library and include files are located.
44 #ZLIBLIB=/usr/local/lib
45 #ZLIBINC=/usr/local/include
46 ZLIBLIB=../zlib
47 ZLIBINC=../zlib
48
49 ALIGN=
50 # for i386:
51 #ALIGN=-malign-loops=2 -malign-functions=2
52
53 WARNMORE=-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:
61 CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -W -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) -W -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) -W -Wall -O \
70 # -m486 -malign-double -ffast-math \
71 # $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer
72
73 LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
74 LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
75
76
77 INCPATH=$(prefix)/include
78 LIBPATH=$(exec_prefix)/lib
79 MANPATH=$(prefix)/man
80 BINPATH=$(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.
90 DESTDIR=
91
92 DB=$(DESTDIR)$(BINPATH)
93 DI=$(DESTDIR)$(INCPATH)
94 DL=$(DESTDIR)$(LIBPATH)
95 DM=$(DESTDIR)$(MANPATH)
96
97 OBJS = 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
101 OBJSDLL = $(OBJS:.o=.pic.o)
102
103 .SUFFIXES: .c .o .pic.o
104
105 .c.pic.o:
106 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
107
108 all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config
109
110 libpng.a: $(OBJS)
111 $(AR_RC) $@ $(OBJS)
112 $(RANLIB) $@
113
114 libpng.pc:
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
120
121 libpng-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
148 pngtest: pngtest.o $(LIBSO)
149 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
150
151 pngtest-static: pngtest.o libpng.a
152 $(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
153
154 test: 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
164 install-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
173 install-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
180 install-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
204 install-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
215 install-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
223 install: 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
229 test-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
238 test-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
245 clean:
246 $(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
247 $(LIBSO) $(LIBSOMAJ)* pngtest-static pngtesti \
248 $(OLDSOVER) \
249 libpng.pc
250
251 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
252 writelock:
253 chmod a-w *.[ch35] $(DOCS) scripts/*
254
255 png.o png.pic.o: png.h pngconf.h png.c
256 pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.c
257 pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.c
258 pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.c
259 pngmem.o pngmem.pic.o: png.h pngconf.h pngmem.c
260 pngset.o pngset.pic.o: png.h pngconf.h pngset.c
261 pngget.o pngget.pic.o: png.h pngconf.h pngget.c
262 pngread.o pngread.pic.o: png.h pngconf.h pngread.c
263 pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.c
264 pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c
265 pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.c
266 pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
267 pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
268 pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c
269 pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c
270
271 pngtest.o: png.h pngconf.h pngtest.c