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