]>
Commit | Line | Data |
---|---|---|
0272a10d VZ |
1 | # makefile for libpng on BeOS x86 ELF with gcc |
2 | # modified from makefile.linux by Sander Stoks | |
b61cc19c | 3 | # Copyright (C) 2002, 2006, 2008, 2010 Glenn Randers-Pehrson |
0272a10d VZ |
4 | # Copyright (C) 1999 Greg Roelofs |
5 | # Copyright (C) 1996, 1997 Andreas Dilger | |
b61cc19c PC |
6 | # |
7 | # This code is released under the libpng license. | |
8 | # For conditions of distribution and use, see the disclaimer | |
9 | # and license in png.h | |
0272a10d VZ |
10 | |
11 | # Library name: | |
b61cc19c PC |
12 | LIBNAME=libpng14 |
13 | PNGMAJ = 14 | |
0272a10d VZ |
14 | |
15 | # Shared library names: | |
16 | LIBSO=$(LIBNAME).so | |
17 | LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) | |
b61cc19c | 18 | LIBSOREL=$(LIBSOMAJ).$(RELEASE) |
0272a10d | 19 | OLDSO=libpng.so |
0272a10d VZ |
20 | |
21 | # Utilities: | |
22 | CC=gcc | |
23 | AR_RC=ar rc | |
24 | MKDIR_P=mkdir -p | |
25 | LN_SF=ln -sf | |
26 | RANLIB=ranlib | |
27 | RM_F=/bin/rm -f | |
28 | ||
29 | # Where the zlib library and include files are located | |
30 | ZLIBLIB=/usr/local/lib | |
31 | ZLIBINC=/usr/local/include | |
32 | ||
33 | ALIGN= | |
34 | # For i386: | |
35 | # ALIGN=-malign-loops=2 -malign-functions=2 | |
36 | ||
37 | WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ | |
38 | -Wmissing-declarations -Wtraditional -Wcast-align \ | |
39 | -Wstrict-prototypes -Wmissing-prototypes #-Wconversion | |
40 | ||
41 | # On BeOS, -O1 is actually better than -O3. This is a known bug but it's | |
42 | # still here in R4.5 | |
970f6abe | 43 | CFLAGS=-I$(ZLIBINC) -W -Wall -O1 -funroll-loops \ |
0272a10d VZ |
44 | $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 |
45 | # LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz | |
46 | LDFLAGS=-L. -Wl,-soname=$(LIBSOMAJ) -L$(ZLIBLIB) -lz | |
47 | ||
b61cc19c | 48 | # where make install puts libpng.a, libpng14.so*, and png.h |
0272a10d VZ |
49 | prefix=/usr/local |
50 | exec_prefix=$(prefix) | |
51 | INCPATH=$(prefix)/include | |
52 | LIBPATH=$(exec_prefix)/lib | |
53 | MANPATH=$(prefix)/man | |
54 | BINPATH=$(exec_prefix)/bin | |
55 | ||
56 | # override DESTDIR= on the make install command line to easily support | |
57 | # installing into a temporary location. Example: | |
58 | # | |
59 | # make install DESTDIR=/tmp/build/libpng | |
60 | # | |
61 | # If you're going to install into a temporary location | |
62 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before | |
63 | # you execute make install. | |
64 | DESTDIR= | |
65 | ||
66 | DB=$(DESTDIR)$(BINPATH) | |
67 | DI=$(DESTDIR)$(INCPATH) | |
68 | DL=$(DESTDIR)$(LIBPATH) | |
69 | DM=$(DESTDIR)$(MANPATH) | |
70 | ||
71 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ | |
72 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ | |
73 | pngwtran.o pngmem.o pngerror.o pngpread.o | |
74 | ||
75 | OBJSDLL = $(OBJS) | |
76 | ||
77 | .SUFFIXES: .c .o | |
78 | ||
79 | all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config | |
80 | ||
81 | libpng.a: $(OBJS) | |
82 | $(AR_RC) $@ $(OBJS) | |
83 | $(RANLIB) $@ | |
84 | ||
85 | libpng.pc: | |
970f6abe VZ |
86 | cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ |
87 | -e s!@exec_prefix@!$(exec_prefix)! \ | |
88 | -e s!@libdir@!$(LIBPATH)! \ | |
89 | -e s!@includedir@!$(INCPATH)! \ | |
b61cc19c | 90 | -e s!-lpng14!-lpng14\ -lz\ -lm! > libpng.pc |
0272a10d VZ |
91 | |
92 | libpng-config: | |
93 | ( cat scripts/libpng-config-head.in; \ | |
94 | echo prefix=\"$(prefix)\"; \ | |
95 | echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ | |
b61cc19c | 96 | echo libs=\"-lpng14 -lz \"; \ |
0272a10d VZ |
97 | cat scripts/libpng-config-body.in ) > libpng-config |
98 | chmod +x libpng-config | |
99 | ||
100 | $(LIBSO): $(LIBSOMAJ) | |
101 | $(LN_SF) $(LIBSOMAJ) $(LIBSO) | |
102 | cp $(LIBSO)* /boot/home/config/lib | |
103 | ||
b61cc19c | 104 | $(LIBSOMAJ): $(OBJSDLL) |
0272a10d | 105 | $(CC) -nostart -Wl,-soname,$(LIBSOMAJ) -o \ |
b61cc19c | 106 | $(LIBSOMAJ) $(OBJSDLL) $(LDFLAGS) |
0272a10d VZ |
107 | |
108 | pngtest: pngtest.o $(LIBSO) | |
b61cc19c | 109 | $(CC) -L$(ZLIBLIB) -L. -lz -lpng14 -o pngtest pngtest.o |
0272a10d VZ |
110 | |
111 | test: pngtest | |
112 | ./pngtest | |
113 | ||
114 | install-headers: png.h pngconf.h | |
115 | -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi | |
116 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi | |
117 | cp png.h pngconf.h $(DI)/$(LIBNAME) | |
118 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h | |
119 | -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h | |
120 | -@$(RM_F) $(DI)/libpng | |
121 | (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .) | |
122 | ||
123 | install-static: install-headers libpng.a | |
124 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi | |
125 | cp libpng.a $(DL)/$(LIBNAME).a | |
126 | chmod 644 $(DL)/$(LIBNAME).a | |
127 | -@$(RM_F) $(DL)/libpng.a | |
128 | (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a) | |
129 | ||
b61cc19c PC |
130 | install-shared: install-headers $(LIBSOMAJ) libpng.pc |
131 | ||
0272a10d | 132 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi |
b61cc19c PC |
133 | -@$(RM_F) $(DL)/$(LIBSO) |
134 | -@$(RM_F) $(DL)/$(LIBSOREL) | |
0272a10d | 135 | -@$(RM_F) $(DL)/$(OLDSO) |
b61cc19c PC |
136 | cp $(LIBSOMAJ) $(DL)/$(LIBSOREL) |
137 | chmod 755 $(DL)/$(LIBSOREL) | |
0272a10d | 138 | (cd $(DL); \ |
b61cc19c PC |
139 | $(LN_SF) $(LIBSOREL) $(LIBSO); \ |
140 | $(LN_SF) $(LIBSO) $(OLDSO)) | |
0272a10d VZ |
141 | -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi |
142 | -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc | |
143 | -@$(RM_F) $(DL)/pkgconfig/libpng.pc | |
144 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc | |
145 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc | |
146 | (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc) | |
147 | ||
148 | install-man: libpng.3 libpngpf.3 png.5 | |
149 | -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi | |
150 | -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi | |
151 | -@$(RM_F) $(DM)/man3/libpng.3 | |
152 | -@$(RM_F) $(DM)/man3/libpngpf.3 | |
153 | cp libpng.3 $(DM)/man3 | |
154 | cp libpngpf.3 $(DM)/man3 | |
155 | -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi | |
156 | -@$(RM_F) $(DM)/man5/png.5 | |
157 | cp png.5 $(DM)/man5 | |
158 | ||
159 | install-config: libpng-config | |
160 | -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi | |
161 | -@$(RM_F) $(DB)/libpng-config | |
162 | -@$(RM_F) $(DB)/$(LIBNAME)-config | |
163 | cp libpng-config $(DB)/$(LIBNAME)-config | |
164 | chmod 755 $(DB)/$(LIBNAME)-config | |
165 | (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config) | |
166 | ||
167 | install: install-static install-shared install-man install-config | |
168 | ||
169 | # If you installed in $(DESTDIR), test-installed won't work until you | |
170 | # move the library to its final location. Use test-dd to test it | |
171 | # before then. | |
172 | ||
173 | test-dd: | |
174 | echo | |
175 | echo Testing installed dynamic shared library in $(DL). | |
176 | $(CC) -I$(DI) $(CFLAGS) \ | |
177 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ | |
178 | -L$(DL) -L$(ZLIBLIB) -Wl,-rpath $(ZLIBLIB):$(DL) \ | |
179 | -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` | |
180 | ./pngtestd pngtest.png | |
181 | ||
182 | test-installed: | |
183 | $(CC) $(CFLAGS) \ | |
184 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ | |
185 | -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \ | |
186 | -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` | |
187 | ./pngtesti pngtest.png | |
188 | ||
189 | clean: | |
190 | $(RM_F) *.o libpng.a pngtest pngout.png libpng-config \ | |
191 | $(LIBSO) $(LIBSOMAJ)* pngtesti \ | |
0272a10d VZ |
192 | libpng.pc |
193 | ||
194 | # DO NOT DELETE THIS LINE -- make depend depends on it. | |
195 | ||
b61cc19c PC |
196 | png.o png.pic.o: png.h pngconf.h pngpriv.h |
197 | pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h | |
198 | pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h | |
199 | pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h | |
200 | pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h | |
201 | pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h | |
202 | pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h | |
203 | pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h | |
204 | pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h | |
205 | pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h | |
206 | pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h | |
207 | pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h | |
208 | pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h | |
209 | pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h | |
210 | pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h | |
211 | ||
0272a10d | 212 | pngtest.o: png.h pngconf.h |