makefile.hpux 7.4 KB
Newer Older
1
# makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
2
# Copyright (C) 1999-2002, 2006, 2010-2014 Glenn Randers-Pehrson
3
# Copyright (C) 1995 Guy Eric Schalnat, Group 42
4
# Contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
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
9 10 11 12 13

# Where the zlib library and include files are located
ZLIBLIB=/opt/zlib/lib
ZLIBINC=/opt/zlib/include

14 15 16
# Note that if you plan to build a libpng shared library, zlib must also
# be a shared library, which zlib's configure does not do.  After running
# zlib's configure, edit the appropriate lines of makefile to read:
17 18
#   CPPFLAGS=-DHAVE_UNISTD -DUSE_MAP
#   CFLAGS=-O1 -fPIC
19 20 21
#   LDSHARED=ld -b
#   SHAREDLIB=libz.sl

22
# Library name:
23 24
LIBNAME = libpng16
PNGMAJ = 16
25 26 27 28

# Shared library names:
LIBSO=$(LIBNAME).sl
LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ)
29
LIBSOREL=$(LIBSOMAJ).$(RELEASE)
30 31 32
OLDSO=libpng.sl

# Utilities:
33
AR_RC=ar rc
34
CC=cc
35
MKDIR_P=mkdir -p
36 37 38 39
LN_SF=ln -sf
RANLIB=ranlib
RM_F=/bin/rm -f

40
# where make install puts libpng.a, libpng16.sl, and png.h
41
prefix=/opt/libpng
42
exec_prefix=$(prefix)
43
INCPATH=$(prefix)/include
44
LIBPATH=$(exec_prefix)/lib
45
MANPATH=$(prefix)/man
46
BINPATH=$(exec_prefix)/bin
47

48 49
CPPFLAGS=-I$(ZLIBINC)
CFLAGS=-O -Ae +DA1.1 +DS2.0
50
# Caution: be sure you have built zlib with the same CFLAGS.
51
CCFLAGS=-O -Ae +DA1.1 +DS2.0
52 53
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm

54 55 56 57 58 59
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location.  Example:
#
#    make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
60
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
61 62
# you execute make install.
DESTDIR=
63

64 65 66 67
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
68

69 70 71 72
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt

73
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
74 75
	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
	pngwtran.o pngmem.o pngerror.o pngpread.o
76

77 78 79 80
OBJSDLL = $(OBJS:.o=.pic.o)

.SUFFIXES:	.c .o .pic.o

81 82 83
.c.o:
	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<

84
.c.pic.o:
85
	$(CC) -c $(CPPFLAGS) $(CFLAGS) +z -o $@ $*.c
86

87
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
88

89
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
90
	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
91

92
libpng.a: $(OBJS)
93
	$(AR_RC) $@ $(OBJS)
94
	$(RANLIB) $@
95

96
libpng.pc:
97 98 99 100
	cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
	-e s!@exec_prefix@!$(exec_prefix)! \
	-e s!@libdir@!$(LIBPATH)! \
	-e s!@includedir@!$(INCPATH)! \
101
	-e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
102

103 104 105
libpng-config:
	( cat scripts/libpng-config-head.in; \
	echo prefix=\"$(prefix)\"; \
106
	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
107
	echo ccopts=\"-O -Ae +DA1.1 +DS2.0\"; \
108
	echo L_opts=\"-L$(LIBPATH)\"; \
109
	echo libs=\"-lpng16 -lz -lm\"; \
110 111 112
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

113 114
$(LIBSO): $(LIBSOMAJ)
	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
115

116
$(LIBSOMAJ): $(OBJSDLL)
117
	$(LD) -b +s \
118
	+h $(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL)
119

120
pngtest: pngtest.o libpng.a
121
	$(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
122 123

test: pngtest
124
	./pngtest
125

126
install-headers: png.h pngconf.h pnglibconf.h
127 128
	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
129 130 131
	cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
132 133
	-@$(RM_F) $(DI)/libpng
	(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 138
	cp libpng.a $(DL)/$(LIBNAME).a
	chmod 644 $(DL)/$(LIBNAME).a
139 140
	-@$(RM_F) $(DL)/libpng.a
	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
141

142
install-shared: install-headers $(LIBSOMAJ) libpng.pc
143
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
144 145
	-@$(RM_F) $(DL)/$(LIBSO)
	-@$(RM_F) $(DL)/$(LIBSOREL)
146
	-@$(RM_F) $(DL)/$(OLDSO)
147 148
	cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
	chmod 755 $(DL)/$(LIBSOREL)
149
	(cd $(DL); \
150 151
	$(LN_SF) $(LIBSOREL) $(LIBSO); \
	$(LN_SF) $(LIBSO) $(OLDSO))
152 153 154
	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
155 156
	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
	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 161 162 163
	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
	-@$(RM_F) $(DM)/man3/libpng.3
	-@$(RM_F) $(DM)/man3/libpngpf.3
164 165
	cp libpng.3 $(DM)/man3
	cp libpngpf.3 $(DM)/man3
166 167
	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
	-@$(RM_F) $(DM)/man5/png.5
168
	cp png.5 $(DM)/man5
169

170
install-config: libpng-config
171 172 173
	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
	-@$(RM_F) $(DB)/libpng-config
	-@$(RM_F) $(DB)/$(LIBNAME)-config
174 175
	cp libpng-config $(DB)/$(LIBNAME)-config
	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 182 183 184 185 186
# move the library to its final location.  Use test-dd to test it
# before then.

test-dd:
	echo
	echo Testing installed dynamic shared library in $(DL).
187
	$(CC) -I$(DI) $(CPPFLAGS) $(CCFLAGS) \
188
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
189
	   -L$(DL) -L$(ZLIBLIB) \
190
	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
191
	./pngtestd pngtest.png
192 193 194 195

test-installed:
	echo
	echo Testing installed dynamic shared library.
196
	$(CC) $(CPPFLAGS) $(CCFLAGS) \
197
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
198
	   -L$(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)* \
205
	libpng.pc pnglibconf.h
206

207
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO
208 209 210
writelock:
	chmod a-w *.[ch35] $(DOCS) scripts/*

211 212
# DO NOT DELETE THIS LINE -- make depend depends on it.

213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
228

229
pngtest.o: png.h pngconf.h pnglibconf.h