]>
Commit | Line | Data |
---|---|---|
0272a10d | 1 | # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product. |
b61cc19c | 2 | # Copyright (C) 1999-2002, 2006, 2010 Glenn Randers-Pehrson |
0272a10d VZ |
3 | # Copyright (C) 1995 Guy Eric Schalnat, Group 42 |
4 | # contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard | |
b61cc19c PC |
5 | # |
6 | # This code is released under the libpng license. | |
7 | # For conditions of distribution and use, see the disclaimer | |
8 | # and license in png.h | |
0272a10d VZ |
9 | |
10 | # Where the zlib library and include files are located | |
11 | ZLIBLIB=/opt/zlib/lib | |
12 | ZLIBINC=/opt/zlib/include | |
13 | ||
14 | # Note that if you plan to build a libpng shared library, zlib must also | |
15 | # be a shared library, which zlib's configure does not do. After running | |
16 | # zlib's configure, edit the appropriate lines of makefile to read: | |
17 | # CFLAGS=-O1 -DHAVE_UNISTD -DUSE_MAP -fPIC \ | |
18 | # LDSHARED=ld -b | |
19 | # SHAREDLIB=libz.sl | |
20 | ||
21 | # Library name: | |
b61cc19c PC |
22 | LIBNAME = libpng14 |
23 | PNGMAJ = 14 | |
0272a10d VZ |
24 | |
25 | # Shared library names: | |
26 | LIBSO=$(LIBNAME).sl | |
27 | LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ) | |
b61cc19c | 28 | LIBSOREL=$(LIBSOMAJ).$(RELEASE) |
0272a10d | 29 | OLDSO=libpng.sl |
0272a10d VZ |
30 | |
31 | # Utilities: | |
32 | AR_RC=ar rc | |
33 | CC=cc | |
34 | MKDIR_P=mkdir -p | |
35 | LN_SF=ln -sf | |
36 | RANLIB=ranlib | |
37 | RM_F=/bin/rm -f | |
38 | ||
b61cc19c | 39 | # where make install puts libpng.a, libpng14.sl, and png.h |
0272a10d VZ |
40 | prefix=/opt/libpng |
41 | exec_prefix=$(prefix) | |
42 | INCPATH=$(prefix)/include | |
43 | LIBPATH=$(exec_prefix)/lib | |
44 | MANPATH=$(prefix)/man | |
45 | BINPATH=$(exec_prefix)/bin | |
46 | ||
b61cc19c | 47 | CFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0 |
0272a10d VZ |
48 | # Caution: be sure you have built zlib with the same CFLAGS. |
49 | CCFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0 | |
50 | LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm | |
51 | ||
52 | # override DESTDIR= on the make install command line to easily support | |
53 | # installing into a temporary location. Example: | |
54 | # | |
55 | # make install DESTDIR=/tmp/build/libpng | |
56 | # | |
57 | # If you're going to install into a temporary location | |
58 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before | |
59 | # you execute make install. | |
60 | DESTDIR= | |
61 | ||
62 | DB=$(DESTDIR)$(BINPATH) | |
63 | DI=$(DESTDIR)$(INCPATH) | |
64 | DL=$(DESTDIR)$(LIBPATH) | |
65 | DM=$(DESTDIR)$(MANPATH) | |
66 | ||
67 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ | |
68 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ | |
69 | pngwtran.o pngmem.o pngerror.o pngpread.o | |
70 | ||
71 | OBJSDLL = $(OBJS:.o=.pic.o) | |
72 | ||
73 | .SUFFIXES: .c .o .pic.o | |
74 | ||
75 | .c.pic.o: | |
76 | $(CC) -c $(CFLAGS) +z -o $@ $*.c | |
77 | ||
78 | all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config | |
79 | ||
80 | libpng.a: $(OBJS) | |
81 | $(AR_RC) $@ $(OBJS) | |
82 | $(RANLIB) $@ | |
83 | ||
84 | libpng.pc: | |
970f6abe VZ |
85 | cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ |
86 | -e s!@exec_prefix@!$(exec_prefix)! \ | |
87 | -e s!@libdir@!$(LIBPATH)! \ | |
88 | -e s!@includedir@!$(INCPATH)! \ | |
b61cc19c | 89 | -e s!-lpng14!-lpng14\ -lz\ -lm! > libpng.pc |
0272a10d VZ |
90 | |
91 | libpng-config: | |
92 | ( cat scripts/libpng-config-head.in; \ | |
93 | echo prefix=\"$(prefix)\"; \ | |
94 | echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ | |
95 | echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \ | |
96 | echo L_opts=\"-L$(LIBPATH)\"; \ | |
b61cc19c | 97 | echo libs=\"-lpng14 -lz -lm\"; \ |
0272a10d VZ |
98 | cat scripts/libpng-config-body.in ) > libpng-config |
99 | chmod +x libpng-config | |
100 | ||
101 | $(LIBSO): $(LIBSOMAJ) | |
102 | $(LN_SF) $(LIBSOMAJ) $(LIBSO) | |
103 | ||
b61cc19c | 104 | $(LIBSOMAJ): $(OBJSDLL) |
0272a10d | 105 | $(LD) -b +s \ |
b61cc19c | 106 | +h $(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL) |
0272a10d VZ |
107 | |
108 | pngtest: pngtest.o libpng.a | |
109 | $(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS) | |
110 | ||
111 | test: pngtest | |
112 | ./pngtest | |
113 | ||
114 | install-headers: png.h pngconf.h | |
115 | -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi | |
116 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi | |
117 | cp png.h pngconf.h $(DI)/$(LIBNAME) | |
118 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h | |
119 | -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h | |
120 | -@$(RM_F) $(DI)/libpng | |
121 | (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .) | |
122 | ||
123 | install-static: install-headers libpng.a | |
124 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi | |
125 | cp libpng.a $(DL)/$(LIBNAME).a | |
126 | chmod 644 $(DL)/$(LIBNAME).a | |
127 | -@$(RM_F) $(DL)/libpng.a | |
128 | (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a) | |
129 | ||
b61cc19c | 130 | install-shared: install-headers $(LIBSOMAJ) libpng.pc |
0272a10d | 131 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi |
b61cc19c PC |
132 | -@$(RM_F) $(DL)/$(LIBSO) |
133 | -@$(RM_F) $(DL)/$(LIBSOREL) | |
0272a10d | 134 | -@$(RM_F) $(DL)/$(OLDSO) |
b61cc19c PC |
135 | cp $(LIBSOMAJ) $(DL)/$(LIBSOREL) |
136 | chmod 755 $(DL)/$(LIBSOREL) | |
0272a10d | 137 | (cd $(DL); \ |
b61cc19c PC |
138 | $(LN_SF) $(LIBSOREL) $(LIBSO); \ |
139 | $(LN_SF) $(LIBSO) $(OLDSO)) | |
0272a10d VZ |
140 | -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi |
141 | -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc | |
142 | -@$(RM_F) $(DL)/pkgconfig/libpng.pc | |
143 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc | |
144 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc | |
145 | (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc) | |
146 | ||
147 | install-man: libpng.3 libpngpf.3 png.5 | |
148 | -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi | |
149 | -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi | |
150 | -@$(RM_F) $(DM)/man3/libpng.3 | |
151 | -@$(RM_F) $(DM)/man3/libpngpf.3 | |
152 | cp libpng.3 $(DM)/man3 | |
153 | cp libpngpf.3 $(DM)/man3 | |
154 | -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi | |
155 | -@$(RM_F) $(DM)/man5/png.5 | |
156 | cp png.5 $(DM)/man5 | |
157 | ||
158 | install-config: libpng-config | |
159 | -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi | |
160 | -@$(RM_F) $(DB)/libpng-config | |
161 | -@$(RM_F) $(DB)/$(LIBNAME)-config | |
162 | cp libpng-config $(DB)/$(LIBNAME)-config | |
163 | chmod 755 $(DB)/$(LIBNAME)-config | |
164 | (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config) | |
165 | ||
166 | install: install-static install-shared install-man install-config | |
167 | ||
168 | # If you installed in $(DESTDIR), test-installed won't work until you | |
169 | # move the library to its final location. Use test-dd to test it | |
170 | # before then. | |
171 | ||
172 | test-dd: | |
173 | echo | |
174 | echo Testing installed dynamic shared library in $(DL). | |
175 | $(CC) -I$(DI) -I$(ZLIBINC) $(CCFLAGS) \ | |
176 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ | |
177 | -L$(DL) -L$(ZLIBLIB) \ | |
178 | -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` | |
179 | ./pngtestd pngtest.png | |
180 | ||
181 | test-installed: | |
182 | echo | |
183 | echo Testing installed dynamic shared library. | |
184 | $(CC) $(CCFLAGS) \ | |
185 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ | |
186 | -L$(ZLIBLIB) \ | |
187 | -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` | |
188 | ./pngtesti pngtest.png | |
189 | ||
190 | clean: | |
191 | $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \ | |
192 | libpng-config $(LIBSO) $(LIBSOMAJ)* \ | |
0272a10d VZ |
193 | libpng.pc |
194 | ||
195 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO | |
196 | writelock: | |
197 | chmod a-w *.[ch35] $(DOCS) scripts/* | |
198 | ||
199 | # DO NOT DELETE THIS LINE -- make depend depends on it. | |
200 | ||
b61cc19c PC |
201 | png.o: png.h pngconf.h pngpriv.h |
202 | pngerror.o: png.h pngconf.h pngpriv.h | |
203 | pngrio.o: png.h pngconf.h pngpriv.h | |
204 | pngwio.o: png.h pngconf.h pngpriv.h | |
205 | pngmem.o: png.h pngconf.h pngpriv.h | |
206 | pngset.o: png.h pngconf.h pngpriv.h | |
207 | pngget.o: png.h pngconf.h pngpriv.h | |
208 | pngread.o: png.h pngconf.h pngpriv.h | |
209 | pngrtran.o: png.h pngconf.h pngpriv.h | |
210 | pngrutil.o: png.h pngconf.h pngpriv.h | |
211 | pngtrans.o: png.h pngconf.h pngpriv.h | |
212 | pngwrite.o: png.h pngconf.h pngpriv.h | |
213 | pngwtran.o: png.h pngconf.h pngpriv.h | |
214 | pngwutil.o: png.h pngconf.h pngpriv.h | |
215 | pngpread.o: png.h pngconf.h pngpriv.h | |
216 | ||
0272a10d | 217 | pngtest.o: png.h pngconf.h |