1 # makefile for libpng on BeOS x86 ELF with gcc
2 # modified from makefile.linux by Sander Stoks
3 # Copyright (C) 2002 Glenn Randers-Pehrson
4 # Copyright (C) 1999 Greg Roelofs
5 # Copyright (C) 1996, 1997 Andreas Dilger
6 # For conditions of distribution and use, see copyright notice in png.h
10 # Where the zlib library and include files are located
11 ZLIBLIB=/usr/local/lib
12 ZLIBINC=/usr/local/include
16 PNGVER = $(PNGMAJ).$(PNGMIN)
20 # ALIGN=-malign-loops=2 -malign-functions=2
22 WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
23 -Wmissing-declarations -Wtraditional -Wcast-align \
24 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
26 # On BeOS, -O1 is actually better than -O3. This is a known bug but it's
28 CFLAGS=-I$(ZLIBINC) -Wall -O1 -funroll-loops \
29 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
30 # LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
31 LDFLAGS=-L. -Wl,-soname=$(LIBNAME).so.$(PNGMAJ) -L$(ZLIBLIB) -lz -lm
36 # where make install puts libpng.a, libpng12.so*, and png.h
38 INCPATH=$(prefix)/include
43 # override DESTDIR= on the make install command line to easily support
44 # installing into a temporary location. Example:
46 # make install DESTDIR=/tmp/build/libpng
48 # If you're going to install into a temporary location
49 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
50 # you execute make install.
53 DB=$(DESTDIR)$(BINPATH)
54 DI=$(DESTDIR)$(INCPATH)
55 DL=$(DESTDIR)$(LIBPATH)
56 DM=$(DESTDIR)$(MANPATH)
60 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
61 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
62 pngwtran.o pngmem.o pngerror.o pngpread.o
68 all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
75 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
78 ( cat scripts/libpng-config-head.in; \
79 echo prefix=\"$(prefix)\"; \
80 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
81 echo libs=\"-lpng12 -lz -lm\"; \
82 cat scripts/libpng-config-body.in ) > libpng-config
83 chmod +x libpng-config
85 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
86 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
87 cp $(LIBNAME).so* /boot/home/config/lib
89 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
90 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
92 $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
93 $(CC) -nostart -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) -o \
94 $(LIBNAME).so.$(PNGVER) $(OBJSDLL)
96 libpng.so.3.$(PNGMIN): $(OBJSDLL)
97 $(CC) -nostart -Wl,-soname,libpng.so.3 -o \
98 libpng.so.3.$(PNGMIN) $(OBJSDLL)
100 pngtest: pngtest.o $(LIBNAME).so
101 $(CC) -L$(ZLIBLIB) -lz -lpng12 -o pngtest pngtest.o
106 install-headers: png.h pngconf.h
107 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
108 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
109 cp png.h pngconf.h $(DI)/$(LIBNAME)
110 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
111 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
112 -@/bin/rm -f $(DI)/libpng
113 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
115 install-static: install-headers libpng.a
116 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
117 cp libpng.a $(DL)/$(LIBNAME).a
118 chmod 644 $(DL)/$(LIBNAME).a
119 -@/bin/rm -f $(DL)/libpng.a
120 (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
122 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
123 libpng.so.3.$(PNGMIN)
124 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
125 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
126 -@/bin/rm -f $(DL)/libpng.so
127 -@/bin/rm -f $(DL)/libpng.so.3
128 -@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
129 cp $(LIBNAME).so.$(PNGVER) $(DL)
130 cp libpng.so.3.$(PNGMIN) $(DL)
131 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
132 chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
134 ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \
135 ln -sf libpng.so.3 libpng.so; \
136 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
137 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
138 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
139 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
140 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
141 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
142 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
143 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
145 install-man: libpng.3 libpngpf.3 png.5
146 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
147 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
148 -@/bin/rm -f $(DM)/man3/libpng.3
149 -@/bin/rm -f $(DM)/man3/libpngpf.3
150 cp libpng.3 $(DM)/man3
151 cp libpngpf.3 $(DM)/man3
152 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
153 -@/bin/rm -f $(DM)/man5/png.5
156 install-config: libpng-config
157 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
158 -@/bin/rm -f $(DB)/libpng-config
159 -@/bin/rm -f $(DB)/$(LIBNAME)-config
160 cp libpng-config $(DB)/$(LIBNAME)-config
161 chmod 755 $(DB)/$(LIBNAME)-config
162 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
164 install: install-static install-shared install-man install-config
166 # If you installed in $(DESTDIR), test-installed won't work until you
167 # move the library to its final location.
171 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
172 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
173 -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
174 ./pngtesti pngtest.png
177 /bin/rm -f *.o libpng.a pngtest pngout.png libpng-config \
178 $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtesti \
179 libpng.so.3.$(PNGMIN) \
182 # DO NOT DELETE THIS LINE -- make depend depends on it.
184 png.o png.pic.o: png.h pngconf.h
185 pngerror.o pngerror.pic.o: png.h pngconf.h
186 pngrio.o pngrio.pic.o: png.h pngconf.h
187 pngwio.o pngwio.pic.o: png.h pngconf.h
188 pngmem.o pngmem.pic.o: png.h pngconf.h
189 pngset.o pngset.pic.o: png.h pngconf.h
190 pngget.o pngget.pic.o: png.h pngconf.h
191 pngread.o pngread.pic.o: png.h pngconf.h
192 pngrtran.o pngrtran.pic.o: png.h pngconf.h
193 pngrutil.o pngrutil.pic.o: png.h pngconf.h
194 pngtrans.o pngtrans.pic.o: png.h pngconf.h
195 pngwrite.o pngwrite.pic.o: png.h pngconf.h
196 pngwtran.o pngwtran.pic.o: png.h pngconf.h
197 pngwutil.o pngwutil.pic.o: png.h pngconf.h
198 pngpread.o pngpread.pic.o: png.h pngconf.h
199 pngtest.o: png.h pngconf.h