OSDN Git Service

67d8f42a6836e4f2c466da8ddbebe0b7b232cf4c
[putex/putex.git] / src / texsourc / libpng / scripts / makefile.hpgcc
1 # makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
2 # Copyright (C) 2002, 2006-2008, 2010-2014 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 = libpng16
13 PNGMAJ = 16
14
15 # Shared library names:
16 LIBSO=$(LIBNAME).sl
17 LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ)
18 LIBSOREL=$(LIBSOMAJ).$(RELEASE)
19 OLDSO=libpng.sl
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, pngconf.h
31 # and pnglibconf.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 CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
57 CFLAGS=-W -Wall -O3 -funroll-loops $(ALIGN) # $(WARNMORE) -g
58 #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm
59 LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -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.o:
90         $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
91
92 .c.pic.o:
93         $(CC) -c $(CPPFLAGS) $(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!-lpng16!-lpng16\ -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=\"-lpng16 -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): $(OBJSDLL)
120         $(LD) -b +s \
121         +h $(LIBSOMAJ) -o $(LIBSOMAJ) $(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 pnglibconf.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 pnglibconf.h $(DI)/$(LIBNAME)
134         chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
135         -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.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 $(LIBSOMAJ) libpng.pc
147         -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
148         -@$(RM_F) $(DL)/$(LIBSO)
149         -@$(RM_F) $(DL)/$(LIBSOREL)
150         -@$(RM_F) $(DL)/$(OLDSO)
151         cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
152         chmod 755 $(DL)/$(LIBSOREL)
153         (cd $(DL); \
154         $(LN_SF) $(LIBSOREL) $(LIBSO); \
155         $(LN_SF) $(LIBSO) $(OLDSO))
156         -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
157         -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
158         -@$(RM_F) $(DL)/pkgconfig/libpng.pc
159         cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
160         chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
161         (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
162
163 install-man: libpng.3 libpngpf.3 png.5
164         -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
165         -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
166         -@$(RM_F) $(DM)/man3/libpng.3
167         -@$(RM_F) $(DM)/man3/libpngpf.3
168         cp libpng.3 $(DM)/man3
169         cp libpngpf.3 $(DM)/man3
170         -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
171         -@$(RM_F) $(DM)/man5/png.5
172         cp png.5 $(DM)/man5
173
174 install-config: libpng-config
175         -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
176         -@$(RM_F) $(DB)/libpng-config
177         -@$(RM_F) $(DB)/$(LIBNAME)-config
178         cp libpng-config $(DB)/$(LIBNAME)-config
179         chmod 755 $(DB)/$(LIBNAME)-config
180         (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
181
182 install: install-static install-shared install-man install-config
183
184 # If you installed in $(DESTDIR), test-installed won't work until you
185 # move the library to its final location.  Use test-dd to test it
186 # before then.
187
188 test-dd:
189         echo
190         echo Testing installed dynamic shared library in $(DL).
191         $(CC) -I$(DI) $(CPPFLAGS) \
192            `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
193            -L$(DL) -L$(ZLIBLIB) -Wl,-rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
194            -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
195         ./pngtestd pngtest.png
196
197 test-installed:
198         echo
199         echo Testing installed dynamic shared library.
200         $(CC) $(CPPFLAGS) \
201            `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
202            -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
203            -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
204         ./pngtesti pngtest.png
205
206 clean:
207         $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
208         libpng-config $(LIBSO) $(LIBSOMAJ)* \
209         libpng.pc pnglibconf.h
210
211 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
212 writelock:
213         chmod a-w *.[ch35] $(DOCS) scripts/*
214
215 # DO NOT DELETE THIS LINE -- make depend depends on it.
216
217 png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
218 pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
219 pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
220 pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
221 pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
222 pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
223 pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
224 pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
225 pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
226 pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
227 pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
228 pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
229 pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
230 pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
231 pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
232
233 pngtest.o: png.h pngconf.h pnglibconf.h