makefile.hpux 7.7 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-2011 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 17 18 19 20
# 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:
#   CFLAGS=-O1 -DHAVE_UNISTD -DUSE_MAP -fPIC \
#   LDSHARED=ld -b
#   SHAREDLIB=libz.sl

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

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

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

39
# where make install puts libpng.a, libpng16.sl, and png.h
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

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

52 53 54 55 56 57
# 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
58
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
59 60
# you execute make install.
DESTDIR=
61

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

67
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
68 69
	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
	pngwtran.o pngmem.o pngerror.o pngpread.o
70

71 72 73 74 75 76 77
OBJSDLL = $(OBJS:.o=.pic.o)

.SUFFIXES:	.c .o .pic.o

.c.pic.o:
	$(CC) -c $(CFLAGS) +z -o $@ $*.c

78
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
79

80
# see scripts/pnglibconf.mak for more options
81 82
pnglibconf.h: scripts/pnglibconf.h.prebuilt
	cp scripts/pnglibconf.h.prebuilt $@
83

84
libpng.a: $(OBJS)
85
	$(AR_RC) $@ $(OBJS)
86
	$(RANLIB) $@
87

88
libpng.pc:
89 90 91 92
	cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
	-e s!@exec_prefix@!$(exec_prefix)! \
	-e s!@libdir@!$(LIBPATH)! \
	-e s!@includedir@!$(INCPATH)! \
93
	-e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
94

95 96 97
libpng-config:
	( cat scripts/libpng-config-head.in; \
	echo prefix=\"$(prefix)\"; \
98
	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
99
	echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
100
	echo L_opts=\"-L$(LIBPATH)\"; \
101
	echo libs=\"-lpng16 -lz -lm\"; \
102 103 104
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

105 106
$(LIBSO): $(LIBSOMAJ)
	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
107

108
$(LIBSOMAJ): $(OBJSDLL)
109
	$(LD) -b +s \
110
	+h $(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL)
111

112
pngtest: pngtest.o libpng.a
113
	$(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
114 115

test: pngtest
116
	./pngtest
117

118
install-headers: png.h pngconf.h pnglibconf.h pngconfig.h
119 120
	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
121 122 123
	cp png.h pngconf.h pnglibconf.h pngconfig.h $(DI)/$(LIBNAME)
	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h $(DI)/$(LIBNAME)/pngconfig.h
	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h $(DI)/pngconfig.h
124 125
	-@$(RM_F) $(DI)/libpng
	(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 130
	cp libpng.a $(DL)/$(LIBNAME).a
	chmod 644 $(DL)/$(LIBNAME).a
131 132
	-@$(RM_F) $(DL)/libpng.a
	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
133

134
install-shared: install-headers $(LIBSOMAJ) libpng.pc
135
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
136 137
	-@$(RM_F) $(DL)/$(LIBSO)
	-@$(RM_F) $(DL)/$(LIBSOREL)
138
	-@$(RM_F) $(DL)/$(OLDSO)
139 140
	cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
	chmod 755 $(DL)/$(LIBSOREL)
141
	(cd $(DL); \
142 143
	$(LN_SF) $(LIBSOREL) $(LIBSO); \
	$(LN_SF) $(LIBSO) $(OLDSO))
144 145 146
	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
147 148
	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
	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 153 154 155
	-@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
156 157
	cp libpng.3 $(DM)/man3
	cp libpngpf.3 $(DM)/man3
158 159
	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
	-@$(RM_F) $(DM)/man5/png.5
160
	cp png.5 $(DM)/man5
161

162
install-config: libpng-config
163 164 165
	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
	-@$(RM_F) $(DB)/libpng-config
	-@$(RM_F) $(DB)/$(LIBNAME)-config
166 167
	cp libpng-config $(DB)/$(LIBNAME)-config
	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 174 175 176 177 178 179
# 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).
	$(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 186 187 188

test-installed:
	echo
	echo Testing installed dynamic shared library.
	$(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)* \
197
	libpng.pc pnglibconf.h
198

199 200 201 202
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
	chmod a-w *.[ch35] $(DOCS) scripts/*

203 204
# DO NOT DELETE THIS LINE -- make depend depends on it.

205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h             pnginfo.h pngdebug.h pngconfig.h 
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h             pnginfo.h pngdebug.h pngconfig.h 
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h             pnginfo.h pngdebug.h pngconfig.h 
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h             pnginfo.h pngdebug.h pngconfig.h 
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h             pnginfo.h pngdebug.h pngconfig.h 
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h             pnginfo.h pngdebug.h pngconfig.h 
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h             pnginfo.h pngdebug.h pngconfig.h 
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h             pnginfo.h pngdebug.h pngconfig.h 
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h             pnginfo.h pngdebug.h pngconfig.h 
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h             pnginfo.h pngdebug.h pngconfig.h 
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h             pnginfo.h pngdebug.h pngconfig.h 
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h             pnginfo.h pngdebug.h pngconfig.h 
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h             pnginfo.h pngdebug.h pngconfig.h 
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h             pnginfo.h pngdebug.h pngconfig.h 
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h             pnginfo.h pngdebug.h pngconfig.h 

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