]> git.saurik.com Git - wxWidgets.git/blob - src/png/scripts/makefile.hpgcc
more warning fixes
[wxWidgets.git] / src / png / scripts / makefile.hpgcc
1 # makefile for libpng on HP-UX using GCC
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
8 CC=gcc
9
10 # where "make install" puts libpng.a, libpng.so*, png.h and pngconf.h
11 prefix=/usr/local
12
13 # Where the zlib library and include files are located
14 ZLIBLIB=/opt/zlib/lib
15 ZLIBINC=/opt/zlib/include
16
17 ALIGN=
18 # for i386:
19 #ALIGN=-malign-loops=2 -malign-functions=2
20
21 WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
22 -Wmissing-declarations -Wtraditional -Wcast-align \
23 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
24
25 # for pgcc version 2.95.1, -O3 is buggy; don't use it.
26
27 CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \
28 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
29 #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
30 LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm
31
32 RANLIB=ranlib
33 #RANLIB=echo
34
35 PNGMAJ = 0
36 PNGMIN = 1.2.4
37 PNGVER = $(PNGMAJ).$(PNGMIN)
38 LIBNAME = libpng12
39
40 INCPATH=$(prefix)/include
41 LIBPATH=$(prefix)/lib
42 MANPATH=$(prefix)/man
43 BINPATH=$(prefix)/bin
44
45 # override DESTDIR= on the make install command line to easily support
46 # installing into a temporary location. Example:
47 #
48 # make install DESTDIR=/tmp/build/libpng
49 #
50 # If you're going to install into a temporary location
51 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
52 # you execute make install.
53 DESTDIR=
54
55 DB=$(DESTDIR)$(BINPATH)
56 DI=$(DESTDIR)$(INCPATH)
57 DL=$(DESTDIR)$(LIBPATH)
58 DM=$(DESTDIR)$(MANPATH)
59
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
63
64 OBJSDLL = $(OBJS:.o=.pic.o)
65
66 .SUFFIXES: .c .o .pic.o
67
68 .c.pic.o:
69 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
70
71 all: libpng.a $(LIBNAME).sl pngtest libpng.pc libpng-config
72
73 libpng.a: $(OBJS)
74 ar rc $@ $(OBJS)
75 $(RANLIB) $@
76
77 libpng.pc:
78 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
79
80 libpng-config:
81 ( cat scripts/libpng-config-head.in; \
82 echo prefix=\"$(prefix)\"; \
83 echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
84 echo cflags=\"\"; \
85 echo ldflags=\"\"; \
86 echo libs=\"-lpng12 -lz -lm\"; \
87 cat scripts/libpng-config-body.in ) > libpng-config
88 chmod +x libpng-config
89
90 $(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
91 ln -f -s $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
92
93 $(LIBNAME).sl.$(PNGMAJ): $(LIBNAME).sl.$(PNGVER)
94 ln -f -s $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ)
95
96 $(LIBNAME).sl.$(PNGVER): $(OBJSDLL)
97 $(LD) -b -L$(ZLIBLIB) +s +b $(ZLIBLIB) \
98 +h libpng.sl.$(PNGMAJ) -o libpng.sl.$(PNGVER) $(OBJSDLL) -lz
99
100 pngtest: pngtest.o $(LIBNAME).sl
101 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
102
103 test: pngtest
104 ./pngtest
105
106
107 install-headers: png.h pngconf.h
108 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
109 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
110 cp png.h pngconf.h $(DI)/$(LIBNAME)
111 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
112 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
113 -@/bin/rm -f $(DI)/libpng
114 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
115
116 install-static: install-headers libpng.a
117 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
118 cp libpng.a $(DL)/$(LIBNAME).a
119 chmod 644 $(DL)/$(LIBNAME).a
120 -@/bin/rm -f $(DL)/libpng.a
121 (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
122
123 install-shared: install-headers $(LIBNAME).sl.$(PNGVER) libpng.pc
124 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
125 -@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGMAJ)* $(DL)/$(LIBNAME).sl
126 -@/bin/rm -f $(DL)/libpng.so
127 -@/bin/rm -f $(DL)/libpng.so.3
128 -@/bin/rm -f $(DL)/libpng.so.3.*
129 cp $(LIBNAME).sl.$(PNGVER) $(DL)
130 chmod 755 $(DL)/$(LIBNAME).sl.$(PNGVER)
131 (cd $(DL); \
132 ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
133 ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.3; \
134 ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.3.$(PNGMIN); \
135 ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
136 ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
137 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir \
138 $(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)
144
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
154 cp png.5 $(DM)/man5
155
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)
163
164 install: install-static install-shared install-man install-config
165
166 # If you installed in $(DESTDIR), test-installed won't work until you
167 # move the library to its final location.
168
169 test-installed:
170 echo
171 echo Testing installed dynamic shared library.
172 $(CC) -I$(ZLIBINC) \
173 `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
174 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
175 -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs`
176 ./pngtesti pngtest.png
177
178 clean:
179 /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc \
180 libpng-config $(LIBNAME).sl $(LIBNAME).sl.$(PNGMAJ)*
181
182 clean:
183 /bin/rm -f *.o libpng.a $(SHAREDLIB).sl $(SHAREDLIB).sl.$(PNGMAJ)* \
184 pngtest pngout.png
185
186 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
187 writelock:
188 chmod a-w *.[ch35] $(DOCS) scripts/*
189
190 # DO NOT DELETE THIS LINE -- make depend depends on it.
191
192 png.o png.pic.o: png.h pngconf.h
193 pngerror.o pngerror.pic.o: png.h pngconf.h
194 pngrio.o pngrio.pic.o: png.h pngconf.h
195 pngwio.o pngwio.pic.o: png.h pngconf.h
196 pngmem.o pngmem.pic.o: png.h pngconf.h
197 pngset.o pngset.pic.o: png.h pngconf.h
198 pngget.o pngget.pic.o: png.h pngconf.h
199 pngread.o pngread.pic.o: png.h pngconf.h
200 pngrtran.o pngrtran.pic.o: png.h pngconf.h
201 pngrutil.o pngrutil.pic.o: png.h pngconf.h
202 pngtrans.o pngtrans.pic.o: png.h pngconf.h
203 pngwrite.o pngwrite.pic.o: png.h pngconf.h
204 pngwtran.o pngwtran.pic.o: png.h pngconf.h
205 pngwutil.o pngwutil.pic.o: png.h pngconf.h
206 pngpread.o pngpread.pic.o: png.h pngconf.h
207
208 pngtest.o: png.h pngconf.h