]> git.saurik.com Git - wxWidgets.git/blob - src/png/scripts/makefile.gcmmx
Upported combobox changes and another fix.
[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 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 # WARNING: The assembler code in pnggccrd.c may not be thread safe.
11
12 # NOTE: When testing MMX performance on a multitasking system, make sure
13 # there are no floating-point programs (e.g., SETI@Home) running in
14 # the background! Context switches between MMX and FPU are expensive.
15
16 LIBNAME = libpng12
17 PNGMAJ = 0
18 PNGMIN = 1.2.4
19 PNGVER = $(PNGMAJ).$(PNGMIN)
20
21 CC=gcc
22
23 # where "make install" puts libpng12.a, libpng12.so*,
24 # libpng12/png.h and libpng12/pngconf.h
25 # Prefix must be a full pathname.
26 prefix=/usr/local
27
28 # Where the zlib library and include files are located.
29 #ZLIBLIB=/usr/local/lib
30 #ZLIBINC=/usr/local/include
31 ZLIBLIB=../zlib
32 ZLIBINC=../zlib
33
34 ALIGN=
35 # for i386:
36 #ALIGN=-malign-loops=2 -malign-functions=2
37
38 WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
39 -Wmissing-declarations -Wtraditional -Wcast-align \
40 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
41
42 # for pgcc version 2.95.1, -O3 is buggy; don't use it.
43
44 # Remove -DPNG_THREAD_UNSAFE_OK if you need thread safety
45 ### for generic gcc:
46 CFLAGS=-DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall \
47 -O3 $(ALIGN) -funroll-loops \
48 -fomit-frame-pointer # $(WARNMORE) -g -DPNG_DEBUG=5
49 ### for gcc 2.95.2 on 686:
50 #CFLAGS=-DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 \
51 # -mcpu=i686 -malign-double -ffast-math -fstrict-aliasing \
52 # $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer
53 ### for gcc 2.7.2.3 on 486 and up:
54 #CFLAGS=-DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 \
55 # -m486 -malign-double -ffast-math \
56 # $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer
57
58 LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
59 LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
60
61 RANLIB=ranlib
62 #RANLIB=echo
63
64 INCPATH=$(prefix)/include
65 LIBPATH=$(prefix)/lib
66 MANPATH=$(prefix)/man
67 BINPATH=$(prefix)/bin
68
69 # override DESTDIR= on the make install command line to easily support
70 # installing into a temporary location. Example:
71 #
72 # make install DESTDIR=/tmp/build/libpng
73 #
74 # If you're going to install into a temporary location
75 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
76 # you execute make install.
77 DESTDIR=
78
79 DB=$(DESTDIR)$(BINPATH)
80 DI=$(DESTDIR)$(INCPATH)
81 DL=$(DESTDIR)$(LIBPATH)
82 DM=$(DESTDIR)$(MANPATH)
83
84 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
85 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
86 pngwtran.o pngmem.o pngerror.o pngpread.o pnggccrd.o
87
88 OBJSDLL = $(OBJS:.o=.pic.o)
89
90 .SUFFIXES: .c .o .pic.o
91
92 .c.pic.o:
93 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
94
95 all: libpng.a $(LIBNAME).so pngtest pngtest-static libpng.pc libpng-config
96
97 libpng.a: $(OBJS)
98 ar rc $@ $(OBJS)
99 $(RANLIB) $@
100
101 libpng.pc:
102 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
103
104 libpng-config:
105 ( cat scripts/libpng-config-head.in; \
106 echo prefix=\"$(prefix)\"; \
107 echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_THREAD_UNSAFE_OK \
108 -DPNG_USE_PNGGCCRD\"; \
109 echo cflags=\"\"; \
110 echo ldflags=\"-L$(LIBPATH) -Wl,-rpath,$(LIBPATH)\"; \
111 echo libs=\"-lpng12 -lz -lm\"; \
112 cat scripts/libpng-config-body.in ) > libpng-config
113 chmod +x libpng-config
114
115 pnggccrd.o: pnggccrd.c png.h pngconf.h
116 $(CC) -c $(CFLAGS) -o $@ $*.c
117
118 pnggccrd.pic.o: pnggccrd.c png.h pngconf.h
119 $(CC) -c $(CFLAGS) -fPIC -o $@ pnggccrd.c
120
121 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
122 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
123
124 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
125 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
126
127 $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
128 $(CC) -shared -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) \
129 -o $(LIBNAME).so.$(PNGVER) \
130 $(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc
131
132 pngtest: pngtest.o $(LIBNAME).so
133 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
134
135 pngtest-static: pngtest.o libpng.a
136 $(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
137
138 test: pngtest pngtest-static
139 @echo ""
140 @echo " Running pngtest dynamically linked with $(LIBNAME).so:"
141 @echo ""
142 ./pngtest
143 @echo ""
144 @echo " Running pngtest statically linked with libpng.a:"
145 @echo ""
146 ./pngtest-static
147
148 install-headers: png.h pngconf.h
149 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
150 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
151 cp png.h pngconf.h $(DI)/$(LIBNAME)
152 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
153 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
154 -@/bin/rm -f $(DI)/libpng
155 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
156
157 install-static: install-headers libpng.a
158 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
159 cp libpng.a $(DL)/$(LIBNAME).a
160 chmod 644 $(DL)/$(LIBNAME).a
161 -@/bin/rm -f $(DL)/libpng.a
162 (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
163
164 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
165 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
166 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
167 -@/bin/rm -f $(DL)/libpng.so
168 -@/bin/rm -f $(DL)/libpng.so.3
169 -@/bin/rm -f $(DL)/libpng.so.3.*
170 cp $(LIBNAME).so.$(PNGVER) $(DL)
171 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
172 (cd $(DL); \
173 ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
174 ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3; \
175 ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
176 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
177 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
178 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
179 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
180 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
181 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
182 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
183 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
184
185 install-man: libpng.3 libpngpf.3 png.5
186 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
187 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
188 -@/bin/rm -f $(DM)/man3/libpng.3
189 -@/bin/rm -f $(DM)/man3/libpngpf.3
190 cp libpng.3 $(DM)/man3
191 cp libpngpf.3 $(DM)/man3
192 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
193 -@/bin/rm -f $(DM)/man5/png.5
194 cp png.5 $(DM)/man5
195
196 install-config: libpng-config
197 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
198 -@/bin/rm -f $(DB)/libpng-config
199 -@/bin/rm -f $(DB)/$(LIBNAME)-config
200 cp libpng-config $(DB)/$(LIBNAME)-config
201 chmod 755 $(DB)/$(LIBNAME)-config
202 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
203
204 install: install-static install-shared install-man install-config
205
206 # If you installed in $(DESTDIR), test-installed won't work until you
207 # move the library to its final location.
208
209 test-installed:
210 $(CC) -I$(ZLIBINC) \
211 `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
212 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
213 -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs`
214 ./pngtesti pngtest.png
215
216 clean:
217 /bin/rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
218 $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti
219
220 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
221 writelock:
222 chmod a-w *.[ch35] $(DOCS) scripts/*
223
224 png.o png.pic.o: png.h pngconf.h png.c
225 pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.c
226 pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.c
227 pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.c
228 pngmem.o pngmem.pic.o: png.h pngconf.h pngmem.c
229 pngset.o pngset.pic.o: png.h pngconf.h pngset.c
230 pngget.o pngget.pic.o: png.h pngconf.h pngget.c
231 pngread.o pngread.pic.o: png.h pngconf.h pngread.c
232 pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.c
233 pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c
234 pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.c
235 pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
236 pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
237 pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c
238 pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c
239
240 pngtest.o: png.h pngconf.h pngtest.c