]> git.saurik.com Git - wxWidgets.git/blame - src/png/scripts/makefile.hpgcc
non-PCH build fix (according to Tinderbox).
[wxWidgets.git] / src / png / scripts / makefile.hpgcc
CommitLineData
3d11a79a 1# makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
c6b71bff
GD
2# Copyright (C) 2002, Glenn Randers-Pehrson
3# Copyright (C) 2001, Laurent faillie
4# Copyright (C) 1998, 1999 Greg Roelofs
5# Copyright (C) 1996, 1997 Andreas Dilger
6# For conditions of distribution and use, see copyright notice in png.h
7
8CC=gcc
3d11a79a 9LD=ld
c6b71bff 10
3d11a79a 11# where "make install" puts libpng.a, libpng.sl*, png.h and pngconf.h
c6b71bff
GD
12prefix=/usr/local
13
14# Where the zlib library and include files are located
15ZLIBLIB=/opt/zlib/lib
16ZLIBINC=/opt/zlib/include
17
3d11a79a
VS
18# Note that if you plan to build a libpng shared library, zlib must also
19# be a shared library, which zlib's configure does not do. After running
20# zlib's configure, edit the appropriate lines of makefile to read:
21# CFLAGS=-O1 -DHAVE_UNISTD -DUSE_MAP -fPIC \
22# LDSHARED=ld -b
23# SHAREDLIB=libz.sl
24
c6b71bff
GD
25ALIGN=
26# for i386:
27#ALIGN=-malign-loops=2 -malign-functions=2
28
29WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
30 -Wmissing-declarations -Wtraditional -Wcast-align \
31 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
32
33# for pgcc version 2.95.1, -O3 is buggy; don't use it.
34
35CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \
36 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
37#LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
38LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm
39
40RANLIB=ranlib
41#RANLIB=echo
42
43PNGMAJ = 0
880c38ba 44PNGMIN = 1.2.7
c6b71bff
GD
45PNGVER = $(PNGMAJ).$(PNGMIN)
46LIBNAME = libpng12
47
48INCPATH=$(prefix)/include
49LIBPATH=$(prefix)/lib
50MANPATH=$(prefix)/man
51BINPATH=$(prefix)/bin
52
53# override DESTDIR= on the make install command line to easily support
54# installing into a temporary location. Example:
55#
56# make install DESTDIR=/tmp/build/libpng
57#
58# If you're going to install into a temporary location
59# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
60# you execute make install.
61DESTDIR=
62
63DB=$(DESTDIR)$(BINPATH)
64DI=$(DESTDIR)$(INCPATH)
65DL=$(DESTDIR)$(LIBPATH)
66DM=$(DESTDIR)$(MANPATH)
67
68OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
69 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
70 pngwtran.o pngmem.o pngerror.o pngpread.o
71
72OBJSDLL = $(OBJS:.o=.pic.o)
73
74.SUFFIXES: .c .o .pic.o
75
76.c.pic.o:
77 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
78
79all: libpng.a $(LIBNAME).sl pngtest libpng.pc libpng-config
80
81libpng.a: $(OBJS)
82 ar rc $@ $(OBJS)
83 $(RANLIB) $@
84
85libpng.pc:
86 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
87
88libpng-config:
89 ( cat scripts/libpng-config-head.in; \
90 echo prefix=\"$(prefix)\"; \
3d11a79a 91 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
c6b71bff
GD
92 echo libs=\"-lpng12 -lz -lm\"; \
93 cat scripts/libpng-config-body.in ) > libpng-config
94 chmod +x libpng-config
95
96$(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
3d11a79a 97 ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
c6b71bff
GD
98
99$(LIBNAME).sl.$(PNGMAJ): $(LIBNAME).sl.$(PNGVER)
3d11a79a 100 ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ)
c6b71bff
GD
101
102$(LIBNAME).sl.$(PNGVER): $(OBJSDLL)
3d11a79a
VS
103 $(LD) -b +s \
104 +h $(LIBNAME).sl.$(PNGMAJ) -o $(LIBNAME).sl.$(PNGVER) $(OBJSDLL)
105
106libpng.sl.3.$(PNGMIN): $(OBJSDLL)
107 $(LD) -b +s \
108 +h libpng.sl.3 -o libpng.sl.3.$(PNGMIN) $(OBJSDLL)
c6b71bff
GD
109
110pngtest: pngtest.o $(LIBNAME).sl
111 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
112
113test: pngtest
114 ./pngtest
115
116
117install-headers: png.h pngconf.h
118 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
119 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
120 cp png.h pngconf.h $(DI)/$(LIBNAME)
121 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
122 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
123 -@/bin/rm -f $(DI)/libpng
124 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
125
126install-static: install-headers libpng.a
127 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
128 cp libpng.a $(DL)/$(LIBNAME).a
129 chmod 644 $(DL)/$(LIBNAME).a
130 -@/bin/rm -f $(DL)/libpng.a
131 (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
132
3d11a79a
VS
133install-shared: install-headers $(LIBNAME).sl.$(PNGVER) libpng.pc \
134 libpng.sl.3.$(PNGMIN)
c6b71bff 135 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
3d11a79a
VS
136 -@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGVER)* $(DL)/$(LIBNAME).sl
137 -@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGMAJ)
138 -@/bin/rm -f $(DL)/libpng.sl
139 -@/bin/rm -f $(DL)/libpng.sl.3
140 -@/bin/rm -f $(DL)/libpng.sl.3.$(PNGMIN)*
c6b71bff 141 cp $(LIBNAME).sl.$(PNGVER) $(DL)
3d11a79a 142 cp libpng.sl.3.$(PNGMIN) $(DL)
c6b71bff 143 chmod 755 $(DL)/$(LIBNAME).sl.$(PNGVER)
3d11a79a 144 chmod 755 $(DL)/libpng.sl.3.$(PNGMIN)
c6b71bff 145 (cd $(DL); \
3d11a79a
VS
146 ln -sf libpng.sl.3.$(PNGMIN) libpng.sl.3; \
147 ln -sf libpng.sl.3 libpng.sl; \
c6b71bff
GD
148 ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
149 ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
3d11a79a 150 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
c6b71bff
GD
151 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
152 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
153 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
154 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
155 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
156
157install-man: libpng.3 libpngpf.3 png.5
158 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
159 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
160 -@/bin/rm -f $(DM)/man3/libpng.3
161 -@/bin/rm -f $(DM)/man3/libpngpf.3
162 cp libpng.3 $(DM)/man3
163 cp libpngpf.3 $(DM)/man3
164 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
165 -@/bin/rm -f $(DM)/man5/png.5
166 cp png.5 $(DM)/man5
167
168install-config: libpng-config
169 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
170 -@/bin/rm -f $(DB)/libpng-config
171 -@/bin/rm -f $(DB)/$(LIBNAME)-config
172 cp libpng-config $(DB)/$(LIBNAME)-config
173 chmod 755 $(DB)/$(LIBNAME)-config
174 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
175
176install: install-static install-shared install-man install-config
177
178# If you installed in $(DESTDIR), test-installed won't work until you
880c38ba
VS
179# move the library to its final location. Use test-dd to test it
180# before then.
181
182test-dd:
183 echo
184 echo Testing installed dynamic shared library in $(DL).
185 $(CC) -I$(DI) -I$(ZLIBINC) \
186 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
187 -L$(DL) -L$(ZLIBLIB) -W1,-rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
188 -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
189 ./pngtestd pngtest.png
c6b71bff
GD
190
191test-installed:
192 echo
193 echo Testing installed dynamic shared library.
194 $(CC) -I$(ZLIBINC) \
3d11a79a 195 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
c6b71bff 196 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
3d11a79a 197 -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
c6b71bff
GD
198 ./pngtesti pngtest.png
199
200clean:
3d11a79a
VS
201 /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
202 libpng-config $(LIBNAME).sl $(LIBNAME).sl.$(PNGMAJ)* \
203 libpng.sl.3.$(PNGMIN) \
204 libpng.pc
c6b71bff
GD
205
206DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
207writelock:
208 chmod a-w *.[ch35] $(DOCS) scripts/*
209
210# DO NOT DELETE THIS LINE -- make depend depends on it.
211
212png.o png.pic.o: png.h pngconf.h
213pngerror.o pngerror.pic.o: png.h pngconf.h
214pngrio.o pngrio.pic.o: png.h pngconf.h
215pngwio.o pngwio.pic.o: png.h pngconf.h
216pngmem.o pngmem.pic.o: png.h pngconf.h
217pngset.o pngset.pic.o: png.h pngconf.h
218pngget.o pngget.pic.o: png.h pngconf.h
219pngread.o pngread.pic.o: png.h pngconf.h
220pngrtran.o pngrtran.pic.o: png.h pngconf.h
221pngrutil.o pngrutil.pic.o: png.h pngconf.h
222pngtrans.o pngtrans.pic.o: png.h pngconf.h
223pngwrite.o pngwrite.pic.o: png.h pngconf.h
224pngwtran.o pngwtran.pic.o: png.h pngconf.h
225pngwutil.o pngwutil.pic.o: png.h pngconf.h
226pngpread.o pngpread.pic.o: png.h pngconf.h
227
228pngtest.o: png.h pngconf.h