]> git.saurik.com Git - wxWidgets.git/blob - src/png/scripts/makefile.linux
whoever added mdig.cpp forgot to update the makefiles
[wxWidgets.git] / src / png / scripts / makefile.linux
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
6 LIBNAME = libpng12
7 PNGMAJ = 0
8 PNGMIN = 1.2.4
9 PNGVER = $(PNGMAJ).$(PNGMIN)
10
11 CC=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.
16 prefix=/usr/local
17
18 # Where the zlib library and include files are located.
19 #ZLIBLIB=/usr/local/lib
20 #ZLIBINC=/usr/local/include
21 ZLIBLIB=../zlib
22 ZLIBINC=../zlib
23
24 ALIGN=
25 # for i386:
26 #ALIGN=-malign-loops=2 -malign-functions=2
27
28 WARNMORE=-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
34 CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \
35 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
36
37 LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
38 LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
39
40 RANLIB=ranlib
41 #RANLIB=echo
42
43 INCPATH=$(prefix)/include
44 LIBPATH=$(prefix)/lib
45 MANPATH=$(prefix)/man
46 BINPATH=$(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.
56 DESTDIR=
57
58 DB=$(DESTDIR)$(BINPATH)
59 DI=$(DESTDIR)$(INCPATH)
60 DL=$(DESTDIR)$(LIBPATH)
61 DM=$(DESTDIR)$(MANPATH)
62
63 OBJS = 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
67 OBJSDLL = $(OBJS:.o=.pic.o)
68
69 .SUFFIXES: .c .o .pic.o
70
71 .c.pic.o:
72 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
73
74 all: libpng.a $(LIBNAME).so pngtest pngtest-static libpng.pc libpng-config
75
76 libpng.a: $(OBJS)
77 ar rc $@ $(OBJS)
78 $(RANLIB) $@
79
80 libpng.pc:
81 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
82
83 libpng-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
104 pngtest: pngtest.o $(LIBNAME).so
105 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
106
107 pngtest-static: pngtest.o libpng.a
108 $(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
109
110 test: 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
120 install-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
129 install-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
136 install-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
157 install-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
168 install-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
176 install: 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
181 test-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
188 clean:
189 /bin/rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
190 $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti
191
192 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
193 writelock:
194 chmod a-w *.[ch35] $(DOCS) scripts/*
195
196 # DO NOT DELETE THIS LINE -- make depend depends on it.
197
198 png.o png.pic.o: png.h pngconf.h
199 pngerror.o pngerror.pic.o: png.h pngconf.h
200 pngrio.o pngrio.pic.o: png.h pngconf.h
201 pngwio.o pngwio.pic.o: png.h pngconf.h
202 pngmem.o pngmem.pic.o: png.h pngconf.h
203 pngset.o pngset.pic.o: png.h pngconf.h
204 pngget.o pngget.pic.o: png.h pngconf.h
205 pngread.o pngread.pic.o: png.h pngconf.h
206 pngrtran.o pngrtran.pic.o: png.h pngconf.h
207 pngrutil.o pngrutil.pic.o: png.h pngconf.h
208 pngtrans.o pngtrans.pic.o: png.h pngconf.h
209 pngwrite.o pngwrite.pic.o: png.h pngconf.h
210 pngwtran.o pngwtran.pic.o: png.h pngconf.h
211 pngwutil.o pngwutil.pic.o: png.h pngconf.h
212 pngpread.o pngpread.pic.o: png.h pngconf.h
213
214 pngtest.o: png.h pngconf.h