blob: 7e5e220406fd8288ff943e0c24ed9b5e48758de5 [file] [log] [blame]
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -05001# makefile for libpng on BeOS x86 ELF with gcc
Glenn Randers-Pehrsonbcfd15d1999-10-01 14:22:25 -05002# modified from makefile.linux by Sander Stoks
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -06003# Copyright (C) 2002 Glenn Randers-Pehrson
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -05004# Copyright (C) 1999 Greg Roelofs
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05005# Copyright (C) 1996, 1997 Andreas Dilger
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -05006# For conditions of distribution and use, see copyright notice in png.h
7
8CC=gcc
9
10# Where the zlib library and include files are located
11ZLIBLIB=/usr/local/lib
12ZLIBINC=/usr/local/include
13
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060014PNGMAJ = 0
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -050015PNGMIN = 1.2.4rc1
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -060016PNGVER = $(PNGMAJ).$(PNGMIN)
17
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050018ALIGN=
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -050019# For i386:
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050020# ALIGN=-malign-loops=2 -malign-functions=2
21
22WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
23 -Wmissing-declarations -Wtraditional -Wcast-align \
24 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
25
26# On BeOS, -O1 is actually better than -O3. This is a known bug but it's
27# still here in R4.5
28CFLAGS=-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
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060031LDFLAGS=-L. -Wl,-soname=$(LIBNAME).so.$(PNGMAJ) -L$(ZLIBLIB) -lz -lm
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050032
33RANLIB=ranlib
34#RANLIB=echo
35
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060036# where make install puts libpng.a, libpng12.so*, and png.h
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050037prefix=/usr/local
38INCPATH=$(prefix)/include
39LIBPATH=$(prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050040MANPATH=$(prefix)/man
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -050041BINPATH=$(prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050042
43# override DESTDIR= on the make install command line to easily support
44# installing into a temporary location. Example:
45#
46# make install DESTDIR=/tmp/build/libpng
47#
48# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050049# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050050# you execute make install.
51DESTDIR=
52
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050053DB=$(DESTDIR)$(BINPATH)
54DI=$(DESTDIR)$(INCPATH)
55DL=$(DESTDIR)$(LIBPATH)
56DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050057
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060058LIBNAME=libpng12
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050059
60OBJS = 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
63
64OBJSDLL = $(OBJS)
65
66.SUFFIXES: .c .o
67
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050068all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050069
70libpng.a: $(OBJS)
71 ar rc $@ $(OBJS)
72 $(RANLIB) $@
73
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050074libpng.pc:
75 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
76
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050077libpng-config:
78 ( cat scripts/libpng-config-head.in; \
79 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson22f28962002-05-13 18:17:09 -050080 echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050081 echo cflags=\"\"; \
Glenn Randers-Pehrson22f28962002-05-13 18:17:09 -050082 echo ldflags=\"-Wl,-soname=$(LIBNAME).so.$(PNGMAJ)\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050083 echo libs=\"-lpng12 -lz -lm\"; \
84 cat scripts/libpng-config-body.in ) > libpng-config
85 chmod +x libpng-config
86
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060087$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
88 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
89 cp $(LIBNAME).so* /boot/home/config/lib
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050090
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060091$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
92 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050093
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060094$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
95 $(CC) -L$(ZLIBLIB) -lz -nostart -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) -o
96$(LIBNAME).so.$(PNGVER) \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050097 $(OBJSDLL)
98
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060099pngtest: pngtest.o $(LIBNAME).so
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600100 $(CC) -L$(ZLIBLIB) -lz -lpng12 -o pngtest pngtest.o
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500101
102test: pngtest
103 ./pngtest
104
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600105install-headers: png.h pngconf.h
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500106 -@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)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500109 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500110 -@/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)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600113
114install-static: install-headers libpng.a
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500115 -@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)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600120
Glenn Randers-Pehrson25d82242002-05-01 11:51:26 -0500121install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500122 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500123 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500124 -@/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)
129 (cd $(DL); \
Glenn Randers-Pehrson73d57cb2002-03-25 18:49:08 -0600130 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); \
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600133 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
134 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500135 -@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)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600141
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500142install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500143 -@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
151 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500152
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500153install-config: libpng-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500154 -@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)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500160
161install: install-static install-shared install-man install-config
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500162
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500163# If you installed in $(DESTDIR), test-installed won't work until you
164# move the library to its final location.
165
166test-installed:
167 $(CC) $(CFLAGS) \
168 `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
169 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
170 -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs`
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500171 ./pngtesti pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500172
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500173clean:
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500174 /bin/rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
175 $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtesti
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500176
177# DO NOT DELETE THIS LINE -- make depend depends on it.
178
179png.o png.pic.o: png.h pngconf.h
180pngerror.o pngerror.pic.o: png.h pngconf.h
181pngrio.o pngrio.pic.o: png.h pngconf.h
182pngwio.o pngwio.pic.o: png.h pngconf.h
183pngmem.o pngmem.pic.o: png.h pngconf.h
184pngset.o pngset.pic.o: png.h pngconf.h
185pngget.o pngget.pic.o: png.h pngconf.h
186pngread.o pngread.pic.o: png.h pngconf.h
187pngrtran.o pngrtran.pic.o: png.h pngconf.h
188pngrutil.o pngrutil.pic.o: png.h pngconf.h
189pngtrans.o pngtrans.pic.o: png.h pngconf.h
190pngwrite.o pngwrite.pic.o: png.h pngconf.h
191pngwtran.o pngwtran.pic.o: png.h pngconf.h
192pngwutil.o pngwutil.pic.o: png.h pngconf.h
193pngpread.o pngpread.pic.o: png.h pngconf.h
194pngtest.o: png.h pngconf.h