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 cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
82 echo ldflags=\"-Wl,-soname=$(LIBNAME).so.$(PNGMAJ)\"; \
83 echo libs=\"-lpng12 -lz -lm\"; \
84 cat scripts/libpng-config-body.in ) > libpng-config
85 chmod +x libpng-config
87 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
88 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
89 cp $(LIBNAME).so* /boot/home/config/lib
91 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
92 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
94 $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
95 $(CC) -L$(ZLIBLIB) -lz -nostart -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) -o
96 $(LIBNAME).so.$(PNGVER) \
99 pngtest: pngtest.o $(LIBNAME).so
100 $(CC) -L$(ZLIBLIB) -lz -lpng12 -o pngtest pngtest.o
105 install-headers: png.h pngconf.h
106 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
107 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
108 cp png.h pngconf.h $(DI)/$(LIBNAME)
109 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
110 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
111 -@/bin/rm -f $(DI)/libpng
112 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
114 install-static: install-headers libpng.a
115 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
116 cp libpng.a $(DL)/$(LIBNAME).a
117 chmod 644 $(DL)/$(LIBNAME).a
118 -@/bin/rm -f $(DL)/libpng.a
119 (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
121 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
122 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
123 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
124 -@/bin/rm -f $(DL)/libpng.so
125 -@/bin/rm -f $(DL)/libpng.so.3
126 -@/bin/rm -f $(DL)/libpng.so.3.*
127 cp $(LIBNAME).so.$(PNGVER) $(DL)
128 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
130 ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
131 ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3; \
132 ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
133 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
134 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
135 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
136 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
137 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
138 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
139 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
140 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
142 install-man: libpng.3 libpngpf.3 png.5
143 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
144 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
145 -@/bin/rm -f $(DM)/man3/libpng.3
146 -@/bin/rm -f $(DM)/man3/libpngpf.3
147 cp libpng.3 $(DM)/man3
148 cp libpngpf.3 $(DM)/man3
149 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
150 -@/bin/rm -f $(DM)/man5/png.5
153 install-config: libpng-config
154 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
155 -@/bin/rm -f $(DB)/libpng-config
156 -@/bin/rm -f $(DB)/$(LIBNAME)-config
157 cp libpng-config $(DB)/$(LIBNAME)-config
158 chmod 755 $(DB)/$(LIBNAME)-config
159 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
161 install: install-static install-shared install-man install-config
163 # If you installed in $(DESTDIR), test-installed won't work until you
164 # move the library to its final location.
168 `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
169 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
170 -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs`
171 ./pngtesti pngtest.png
174 /bin/rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
175 $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtesti
177 # DO NOT DELETE THIS LINE -- make depend depends on it.
179 png.o png.pic.o: png.h pngconf.h
180 pngerror.o pngerror.pic.o: png.h pngconf.h
181 pngrio.o pngrio.pic.o: png.h pngconf.h
182 pngwio.o pngwio.pic.o: png.h pngconf.h
183 pngmem.o pngmem.pic.o: png.h pngconf.h
184 pngset.o pngset.pic.o: png.h pngconf.h
185 pngget.o pngget.pic.o: png.h pngconf.h
186 pngread.o pngread.pic.o: png.h pngconf.h
187 pngrtran.o pngrtran.pic.o: png.h pngconf.h
188 pngrutil.o pngrutil.pic.o: png.h pngconf.h
189 pngtrans.o pngtrans.pic.o: png.h pngconf.h
190 pngwrite.o pngwrite.pic.o: png.h pngconf.h
191 pngwtran.o pngwtran.pic.o: png.h pngconf.h
192 pngwutil.o pngwutil.pic.o: png.h pngconf.h
193 pngpread.o pngpread.pic.o: png.h pngconf.h
194 pngtest.o: png.h pngconf.h