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