]>
Commit | Line | Data |
---|---|---|
0272a10d | 1 | # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product. |
9c0d9ce3 | 2 | # Copyright (C) 1999-2002, 2006, 2010-2011 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: | |
9c0d9ce3 DS |
22 | LIBNAME = libpng15 |
23 | PNGMAJ = 15 | |
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 | ||
9c0d9ce3 | 39 | # where make install puts libpng.a, libpng15.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 | ||
9c0d9ce3 DS |
80 | # see scripts/pnglibconf.mak for more options |
81 | pnglibconf.h: scripts/pnglibconf.h.prebuilt | |
82 | cp scripts/pnglibconf.h.prebuilt $@ | |
83 | ||
0272a10d VZ |
84 | libpng.a: $(OBJS) |
85 | $(AR_RC) $@ $(OBJS) | |
86 | $(RANLIB) $@ | |
87 | ||
88 | libpng.pc: | |
970f6abe VZ |
89 | cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ |
90 | -e s!@exec_prefix@!$(exec_prefix)! \ | |
91 | -e s!@libdir@!$(LIBPATH)! \ | |
92 | -e s!@includedir@!$(INCPATH)! \ | |
9c0d9ce3 | 93 | -e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc |
0272a10d VZ |
94 | |
95 | libpng-config: | |
96 | ( cat scripts/libpng-config-head.in; \ | |
97 | echo prefix=\"$(prefix)\"; \ | |
98 | echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ | |
99 | echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \ | |
100 | echo L_opts=\"-L$(LIBPATH)\"; \ | |
9c0d9ce3 | 101 | echo libs=\"-lpng15 -lz -lm\"; \ |
0272a10d VZ |
102 | cat scripts/libpng-config-body.in ) > libpng-config |
103 | chmod +x libpng-config | |
104 | ||
105 | $(LIBSO): $(LIBSOMAJ) | |
106 | $(LN_SF) $(LIBSOMAJ) $(LIBSO) | |
107 | ||
b61cc19c | 108 | $(LIBSOMAJ): $(OBJSDLL) |
0272a10d | 109 | $(LD) -b +s \ |
b61cc19c | 110 | +h $(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL) |
0272a10d VZ |
111 | |
112 | pngtest: pngtest.o libpng.a | |
113 | $(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS) | |
114 | ||
115 | test: pngtest | |
116 | ./pngtest | |
117 | ||
9c0d9ce3 | 118 | install-headers: png.h pngconf.h pnglibconf.h |
0272a10d VZ |
119 | -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi |
120 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi | |
9c0d9ce3 DS |
121 | cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME) |
122 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h | |
123 | -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h | |
0272a10d VZ |
124 | -@$(RM_F) $(DI)/libpng |
125 | (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .) | |
126 | ||
127 | install-static: install-headers libpng.a | |
128 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi | |
129 | cp libpng.a $(DL)/$(LIBNAME).a | |
130 | chmod 644 $(DL)/$(LIBNAME).a | |
131 | -@$(RM_F) $(DL)/libpng.a | |
132 | (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a) | |
133 | ||
b61cc19c | 134 | install-shared: install-headers $(LIBSOMAJ) libpng.pc |
0272a10d | 135 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi |
b61cc19c PC |
136 | -@$(RM_F) $(DL)/$(LIBSO) |
137 | -@$(RM_F) $(DL)/$(LIBSOREL) | |
0272a10d | 138 | -@$(RM_F) $(DL)/$(OLDSO) |
b61cc19c PC |
139 | cp $(LIBSOMAJ) $(DL)/$(LIBSOREL) |
140 | chmod 755 $(DL)/$(LIBSOREL) | |
0272a10d | 141 | (cd $(DL); \ |
b61cc19c PC |
142 | $(LN_SF) $(LIBSOREL) $(LIBSO); \ |
143 | $(LN_SF) $(LIBSO) $(OLDSO)) | |
0272a10d VZ |
144 | -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi |
145 | -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc | |
146 | -@$(RM_F) $(DL)/pkgconfig/libpng.pc | |
147 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc | |
148 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc | |
149 | (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc) | |
150 | ||
151 | install-man: libpng.3 libpngpf.3 png.5 | |
152 | -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi | |
153 | -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi | |
154 | -@$(RM_F) $(DM)/man3/libpng.3 | |
155 | -@$(RM_F) $(DM)/man3/libpngpf.3 | |
156 | cp libpng.3 $(DM)/man3 | |
157 | cp libpngpf.3 $(DM)/man3 | |
158 | -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi | |
159 | -@$(RM_F) $(DM)/man5/png.5 | |
160 | cp png.5 $(DM)/man5 | |
161 | ||
162 | install-config: libpng-config | |
163 | -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi | |
164 | -@$(RM_F) $(DB)/libpng-config | |
165 | -@$(RM_F) $(DB)/$(LIBNAME)-config | |
166 | cp libpng-config $(DB)/$(LIBNAME)-config | |
167 | chmod 755 $(DB)/$(LIBNAME)-config | |
168 | (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config) | |
169 | ||
170 | install: install-static install-shared install-man install-config | |
171 | ||
172 | # If you installed in $(DESTDIR), test-installed won't work until you | |
173 | # move the library to its final location. Use test-dd to test it | |
174 | # before then. | |
175 | ||
176 | test-dd: | |
177 | echo | |
178 | echo Testing installed dynamic shared library in $(DL). | |
179 | $(CC) -I$(DI) -I$(ZLIBINC) $(CCFLAGS) \ | |
180 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ | |
181 | -L$(DL) -L$(ZLIBLIB) \ | |
182 | -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` | |
183 | ./pngtestd pngtest.png | |
184 | ||
185 | test-installed: | |
186 | echo | |
187 | echo Testing installed dynamic shared library. | |
188 | $(CC) $(CCFLAGS) \ | |
189 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ | |
190 | -L$(ZLIBLIB) \ | |
191 | -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` | |
192 | ./pngtesti pngtest.png | |
193 | ||
194 | clean: | |
195 | $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \ | |
196 | libpng-config $(LIBSO) $(LIBSOMAJ)* \ | |
9c0d9ce3 | 197 | libpng.pc pnglibconf.h |
0272a10d VZ |
198 | |
199 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO | |
200 | writelock: | |
201 | chmod a-w *.[ch35] $(DOCS) scripts/* | |
202 | ||
203 | # DO NOT DELETE THIS LINE -- make depend depends on it. | |
204 | ||
9c0d9ce3 DS |
205 | png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
206 | pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
207 | pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
208 | pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
209 | pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
210 | pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
211 | pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
212 | pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
213 | pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
214 | pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
215 | pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
216 | pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
217 | pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
218 | pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
219 | pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
220 | ||
221 | pngtest.o: png.h pngconf.h pnglibconf.h |