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