comparison ext/libpng-1.2.29/scripts/makefile.linux @ 0:4a0efb7baf70

* Datasets becomes the new trunk and retires after that :-)
author mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 29 Jun 2008 18:44:17 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4a0efb7baf70
1 # makefile for libpng.a and libpng12.so on Linux ELF with gcc
2 # Copyright (C) 1998, 1999, 2002, 2006 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 # Library name:
7 LIBNAME = libpng12
8 PNGMAJ = 0
9 PNGMIN = 1.2.29
10 PNGVER = $(PNGMAJ).$(PNGMIN)
11
12 # Shared library names:
13 LIBSO=$(LIBNAME).so
14 LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
15 LIBSOVER=$(LIBNAME).so.$(PNGVER)
16 OLDSO=libpng.so
17 OLDSOMAJ=libpng.so.3
18 OLDSOVER=libpng.so.3.$(PNGMIN)
19
20 # Utilities:
21 AR_RC=ar rc
22 CC=gcc
23 MKDIR_P=mkdir -p
24 LN_SF=ln -sf
25 RANLIB=ranlib
26 RM_F=/bin/rm -f
27
28 # where "make install" puts libpng12.a, libpng12.so*,
29 # libpng12/png.h and libpng12/pngconf.h
30 # Prefix must be a full pathname.
31 prefix=/usr/local
32 exec_prefix=$(prefix)
33
34 # Where the zlib library and include files are located.
35 #ZLIBLIB=/usr/local/lib
36 #ZLIBINC=/usr/local/include
37 ZLIBLIB=../zlib
38 ZLIBINC=../zlib
39
40 ALIGN=
41 # for i386:
42 #ALIGN=-malign-loops=2 -malign-functions=2
43
44 WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
45 -Wmissing-declarations -Wtraditional -Wcast-align \
46 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
47
48 # for pgcc version 2.95.1, -O3 is buggy; don't use it.
49
50 CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \
51 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
52
53 LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
54 LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
55
56 INCPATH=$(prefix)/include
57 LIBPATH=$(exec_prefix)/lib
58 MANPATH=$(prefix)/man
59 BINPATH=$(exec_prefix)/bin
60
61 # override DESTDIR= on the make install command line to easily support
62 # installing into a temporary location. Example:
63 #
64 # make install DESTDIR=/tmp/build/libpng
65 #
66 # If you're going to install into a temporary location
67 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
68 # you execute make install.
69 DESTDIR=
70
71 DB=$(DESTDIR)$(BINPATH)
72 DI=$(DESTDIR)$(INCPATH)
73 DL=$(DESTDIR)$(LIBPATH)
74 DM=$(DESTDIR)$(MANPATH)
75
76 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
77 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
78 pngwtran.o pngmem.o pngerror.o pngpread.o
79
80 OBJSDLL = $(OBJS:.o=.pic.o)
81
82 .SUFFIXES: .c .o .pic.o
83
84 .c.pic.o:
85 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
86
87 all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config
88
89 libpng.a: $(OBJS)
90 $(AR_RC) $@ $(OBJS)
91 $(RANLIB) $@
92
93 libpng.pc:
94 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
95 -e s!@exec_prefix@!$(exec_prefix)! \
96 -e s!@libdir@!$(LIBPATH)! \
97 -e s!@includedir@!$(INCPATH)! \
98 -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
99
100 libpng-config:
101 ( cat scripts/libpng-config-head.in; \
102 echo prefix=\"$(prefix)\"; \
103 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
104 echo L_opts=\"-L$(LIBPATH)\"; \
105 echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
106 echo libs=\"-lpng12 -lz -lm\"; \
107 cat scripts/libpng-config-body.in ) > libpng-config
108 chmod +x libpng-config
109
110 $(LIBSO): $(LIBSOMAJ)
111 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
112
113 $(LIBSOMAJ): $(LIBSOVER)
114 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
115
116 $(LIBSOVER): $(OBJSDLL)
117 $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSOVER) $(OBJSDLL)
118
119 $(OLDSOVER): $(OBJSDLL)
120 $(CC) -shared -Wl,-soname,$(OLDSOMAJ) \
121 -o $(OLDSOVER) \
122 $(OBJSDLL)
123
124 pngtest: pngtest.o $(LIBSO)
125 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
126
127 pngtest-static: pngtest.o libpng.a
128 $(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
129
130 test: pngtest pngtest-static
131 @echo ""
132 @echo " Running pngtest dynamically linked with $(LIBSO):"
133 @echo ""
134 ./pngtest
135 @echo ""
136 @echo " Running pngtest statically linked with libpng.a:"
137 @echo ""
138 ./pngtest-static
139
140 install-headers: png.h pngconf.h
141 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
142 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
143 cp png.h pngconf.h $(DI)/$(LIBNAME)
144 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
145 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
146 -@$(RM_F) $(DI)/libpng
147 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
148
149 install-static: install-headers libpng.a
150 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
151 cp libpng.a $(DL)/$(LIBNAME).a
152 chmod 644 $(DL)/$(LIBNAME).a
153 -@$(RM_F) $(DL)/libpng.a
154 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
155
156 install-shared: install-headers $(LIBSOVER) libpng.pc \
157 $(OLDSOVER)
158 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
159 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
160 -@$(RM_F) $(DL)/$(LIBSOMAJ)
161 -@$(RM_F) $(DL)/$(OLDSO)
162 -@$(RM_F) $(DL)/$(OLDSOMAJ)
163 -@$(RM_F) $(DL)/$(OLDSOVER)*
164 cp $(LIBSOVER) $(DL)
165 cp $(OLDSOVER) $(DL)
166 chmod 755 $(DL)/$(LIBSOVER)
167 chmod 755 $(DL)/$(OLDSOVER)
168 (cd $(DL); \
169 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
170 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
171 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
172 $(LN_SF) $(LIBSOMAJ) $(LIBSO))
173 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
174 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
175 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
176 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
177 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
178 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
179
180 install-man: libpng.3 libpngpf.3 png.5
181 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
182 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
183 -@$(RM_F) $(DM)/man3/libpng.3
184 -@$(RM_F) $(DM)/man3/libpngpf.3
185 cp libpng.3 $(DM)/man3
186 cp libpngpf.3 $(DM)/man3
187 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
188 -@$(RM_F) $(DM)/man5/png.5
189 cp png.5 $(DM)/man5
190
191 install-config: libpng-config
192 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
193 -@$(RM_F) $(DB)/libpng-config
194 -@$(RM_F) $(DB)/$(LIBNAME)-config
195 cp libpng-config $(DB)/$(LIBNAME)-config
196 chmod 755 $(DB)/$(LIBNAME)-config
197 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
198
199 install: install-static install-shared install-man install-config
200
201 # If you installed in $(DESTDIR), test-installed won't work until you
202 # move the library to its final location. Use test-dd to test it
203 # before then.
204
205 test-dd:
206 echo
207 echo Testing installed dynamic shared library in $(DL).
208 $(CC) -I$(DI) -I$(ZLIBINC) \
209 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
210 -L$(DL) -L$(ZLIBLIB) -Wl, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
211 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
212 ./pngtestd pngtest.png
213
214 test-installed:
215 $(CC) -I$(ZLIBINC) \
216 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
217 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
218 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
219 ./pngtesti pngtest.png
220
221 clean:
222 $(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
223 $(LIBSO) $(LIBSOMAJ)* pngtest-static pngtesti \
224 $(OLDSOVER) \
225 libpng.pc
226
227 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
228 writelock:
229 chmod a-w *.[ch35] $(DOCS) scripts/*
230
231 # DO NOT DELETE THIS LINE -- make depend depends on it.
232
233 png.o png.pic.o: png.h pngconf.h
234 pngerror.o pngerror.pic.o: png.h pngconf.h
235 pngrio.o pngrio.pic.o: png.h pngconf.h
236 pngwio.o pngwio.pic.o: png.h pngconf.h
237 pngmem.o pngmem.pic.o: png.h pngconf.h
238 pngset.o pngset.pic.o: png.h pngconf.h
239 pngget.o pngget.pic.o: png.h pngconf.h
240 pngread.o pngread.pic.o: png.h pngconf.h
241 pngrtran.o pngrtran.pic.o: png.h pngconf.h
242 pngrutil.o pngrutil.pic.o: png.h pngconf.h
243 pngtrans.o pngtrans.pic.o: png.h pngconf.h
244 pngwrite.o pngwrite.pic.o: png.h pngconf.h
245 pngwtran.o pngwtran.pic.o: png.h pngconf.h
246 pngwutil.o pngwutil.pic.o: png.h pngconf.h
247 pngpread.o pngpread.pic.o: png.h pngconf.h
248
249 pngtest.o: png.h pngconf.h