]> git.saurik.com Git - wxWidgets.git/blame - src/png/scripts/makefile.linux
added wxDIB::Save() and wxDIB to/from wxBitmap) conversions, use them instead of...
[wxWidgets.git] / src / png / scripts / makefile.linux
CommitLineData
c6b71bff
GD
1# makefile for libpng.a and libpng12.so on Linux ELF with gcc
2# Copyright (C) 1998, 1999, 2002 Greg Roelofs and Glenn Randers-Pehrson
3# Copyright (C) 1996, 1997 Andreas Dilger
4# For conditions of distribution and use, see copyright notice in png.h
5
6LIBNAME = libpng12
7PNGMAJ = 0
8PNGMIN = 1.2.4
9PNGVER = $(PNGMAJ).$(PNGMIN)
10
11CC=gcc
12
13# where "make install" puts libpng12.a, libpng12.so*,
14# libpng12/png.h and libpng12/pngconf.h
15# Prefix must be a full pathname.
16prefix=/usr/local
17
18# Where the zlib library and include files are located.
19#ZLIBLIB=/usr/local/lib
20#ZLIBINC=/usr/local/include
21ZLIBLIB=../zlib
22ZLIBINC=../zlib
23
24ALIGN=
25# for i386:
26#ALIGN=-malign-loops=2 -malign-functions=2
27
28WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
29 -Wmissing-declarations -Wtraditional -Wcast-align \
30 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
31
32# for pgcc version 2.95.1, -O3 is buggy; don't use it.
33
34CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \
35 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
36
37LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
38LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
39
40RANLIB=ranlib
41#RANLIB=echo
42
43INCPATH=$(prefix)/include
44LIBPATH=$(prefix)/lib
45MANPATH=$(prefix)/man
46BINPATH=$(prefix)/bin
47
48# override DESTDIR= on the make install command line to easily support
49# installing into a temporary location. Example:
50#
51# make install DESTDIR=/tmp/build/libpng
52#
53# If you're going to install into a temporary location
54# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
55# you execute make install.
56DESTDIR=
57
58DB=$(DESTDIR)$(BINPATH)
59DI=$(DESTDIR)$(INCPATH)
60DL=$(DESTDIR)$(LIBPATH)
61DM=$(DESTDIR)$(MANPATH)
62
63OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
64 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
65 pngwtran.o pngmem.o pngerror.o pngpread.o
66
67OBJSDLL = $(OBJS:.o=.pic.o)
68
69.SUFFIXES: .c .o .pic.o
70
71.c.pic.o:
72 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
73
74all: libpng.a $(LIBNAME).so pngtest pngtest-static libpng.pc libpng-config
75
76libpng.a: $(OBJS)
77 ar rc $@ $(OBJS)
78 $(RANLIB) $@
79
80libpng.pc:
81 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
82
83libpng-config:
84 ( cat scripts/libpng-config-head.in; \
85 echo prefix=\"$(prefix)\"; \
86 echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
87 echo cflags=\"\"; \
88 echo ldflags=\"-L$(LIBPATH) -Wl,-rpath,$(LIBPATH)\"; \
89 echo libs=\"-lpng12 -lz -lm\"; \
90 cat scripts/libpng-config-body.in ) > libpng-config
91 chmod +x libpng-config
92
93$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
94 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
95
96$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
97 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
98
99$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
100 $(CC) -shared -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) \
101 -o $(LIBNAME).so.$(PNGVER) \
102 $(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc
103
104pngtest: pngtest.o $(LIBNAME).so
105 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
106
107pngtest-static: pngtest.o libpng.a
108 $(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
109
110test: pngtest pngtest-static
111 @echo ""
112 @echo " Running pngtest dynamically linked with $(LIBNAME).so:"
113 @echo ""
114 ./pngtest
115 @echo ""
116 @echo " Running pngtest statically linked with libpng.a:"
117 @echo ""
118 ./pngtest-static
119
120install-headers: png.h pngconf.h
121 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
122 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
123 cp png.h pngconf.h $(DI)/$(LIBNAME)
124 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
125 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
126 -@/bin/rm -f $(DI)/libpng
127 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
128
129install-static: install-headers libpng.a
130 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
131 cp libpng.a $(DL)/$(LIBNAME).a
132 chmod 644 $(DL)/$(LIBNAME).a
133 -@/bin/rm -f $(DL)/libpng.a
134 (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
135
136install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
137 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
138 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
139 -@/bin/rm -f $(DL)/libpng.so
140 -@/bin/rm -f $(DL)/libpng.so.3
141 -@/bin/rm -f $(DL)/libpng.so.3.*
142 cp $(LIBNAME).so.$(PNGVER) $(DL)
143 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
144 (cd $(DL); \
145 ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
146 ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3; \
147 ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
148 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
149 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
150 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
151 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
152 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
153 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
154 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
155 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
156
157install-man: libpng.3 libpngpf.3 png.5
158 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
159 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
160 -@/bin/rm -f $(DM)/man3/libpng.3
161 -@/bin/rm -f $(DM)/man3/libpngpf.3
162 cp libpng.3 $(DM)/man3
163 cp libpngpf.3 $(DM)/man3
164 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
165 -@/bin/rm -f $(DM)/man5/png.5
166 cp png.5 $(DM)/man5
167
168install-config: libpng-config
169 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
170 -@/bin/rm -f $(DB)/libpng-config
171 -@/bin/rm -f $(DB)/$(LIBNAME)-config
172 cp libpng-config $(DB)/$(LIBNAME)-config
173 chmod 755 $(DB)/$(LIBNAME)-config
174 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
175
176install: install-static install-shared install-man install-config
177
178# If you installed in $(DESTDIR), test-installed won't work until you
179# move the library to its final location.
180
181test-installed:
182 $(CC) -I$(ZLIBINC) \
183 `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
184 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
185 -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs`
186 ./pngtesti pngtest.png
187
188clean:
189 /bin/rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
190 $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti
191
192DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
193writelock:
194 chmod a-w *.[ch35] $(DOCS) scripts/*
195
196# DO NOT DELETE THIS LINE -- make depend depends on it.
197
198png.o png.pic.o: png.h pngconf.h
199pngerror.o pngerror.pic.o: png.h pngconf.h
200pngrio.o pngrio.pic.o: png.h pngconf.h
201pngwio.o pngwio.pic.o: png.h pngconf.h
202pngmem.o pngmem.pic.o: png.h pngconf.h
203pngset.o pngset.pic.o: png.h pngconf.h
204pngget.o pngget.pic.o: png.h pngconf.h
205pngread.o pngread.pic.o: png.h pngconf.h
206pngrtran.o pngrtran.pic.o: png.h pngconf.h
207pngrutil.o pngrutil.pic.o: png.h pngconf.h
208pngtrans.o pngtrans.pic.o: png.h pngconf.h
209pngwrite.o pngwrite.pic.o: png.h pngconf.h
210pngwtran.o pngwtran.pic.o: png.h pngconf.h
211pngwutil.o pngwutil.pic.o: png.h pngconf.h
212pngpread.o pngpread.pic.o: png.h pngconf.h
213
214pngtest.o: png.h pngconf.h