makefile.hpux 6.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 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 7 8
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# 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 22 23
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
24
PNGMIN = 1.2.42beta02
25 26 27 28 29 30 31
PNGVER = $(PNGMAJ).$(PNGMIN)

# Shared library names:
LIBSO=$(LIBNAME).sl
LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ)
LIBSOVER=$(LIBNAME).sl.$(PNGVER)
OLDSO=libpng.sl
32 33
OLDSOMAJ=libpng.sl.3
OLDSOVER=libpng.sl.3.$(PNGMIN)
34 35

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

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

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

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

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

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

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

.SUFFIXES:	.c .o .pic.o

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

82
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
83 84

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

88
libpng.pc:
89 90 91
	cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
	-e s!@exec_prefix@!$(exec_prefix)! \
	-e s!@libdir@!$(LIBPATH)! \
92 93
	-e s!@includedir@!$(INCPATH)! \
	-e s!-lpng12!-lpng12\ -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 102 103 104
	echo libs=\"-lpng12 -lz -lm\"; \
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

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

108 109
$(LIBSOMAJ): $(LIBSOVER)
	$(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
110

111
$(LIBSOVER): $(OBJSDLL)
112
	$(LD) -b +s \
113
	+h $(LIBSOMAJ) -o $(LIBSOVER) $(OBJSDLL)
114

115
$(OLDSOVER): $(OBJSDLL)
116
	$(LD) -b +s \
117
	+h $(OLDSOMAJ) -o $(OLDSOVER) $(OBJSDLL)
118

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

test: pngtest
123
	./pngtest
124

125
install-headers: png.h pngconf.h
126 127
	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
128
	cp png.h pngconf.h $(DI)/$(LIBNAME)
129
	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
130 131 132
	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
	-@$(RM_F) $(DI)/libpng
	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
133 134

install-static: install-headers libpng.a
135
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
136 137
	cp libpng.a $(DL)/$(LIBNAME).a
	chmod 644 $(DL)/$(LIBNAME).a
138 139
	-@$(RM_F) $(DL)/libpng.a
	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
140

141 142
install-shared: install-headers $(LIBSOVER) libpng.pc \
	$(OLDSOVER)
143
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
144 145 146 147 148 149 150 151 152
	-@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
	-@$(RM_F) $(DL)/$(LIBSOMAJ)
	-@$(RM_F) $(DL)/$(OLDSO)
	-@$(RM_F) $(DL)/$(OLDSOMAJ)
	-@$(RM_F) $(DL)/$(OLDSOVER)*
	cp $(LIBSOVER) $(DL)
	cp $(OLDSOVER) $(DL)
	chmod 755 $(DL)/$(LIBSOVER)
	chmod 755 $(DL)/$(OLDSOVER)
153
	(cd $(DL); \
154 155 156 157
	$(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
	$(LN_SF) $(OLDSOMAJ) $(OLDSO); \
	$(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
	$(LN_SF) $(LIBSOMAJ) $(LIBSO))
158 159 160
	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
161 162
	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
163
	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
164 165

install-man: libpng.3 libpngpf.3 png.5
166 167 168 169
	-@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
170 171
	cp libpng.3 $(DM)/man3
	cp libpngpf.3 $(DM)/man3
172 173
	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
	-@$(RM_F) $(DM)/man5/png.5
174
	cp png.5 $(DM)/man5
175

176
install-config: libpng-config
177 178 179
	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
	-@$(RM_F) $(DB)/libpng-config
	-@$(RM_F) $(DB)/$(LIBNAME)-config
180 181
	cp libpng-config $(DB)/$(LIBNAME)-config
	chmod 755 $(DB)/$(LIBNAME)-config
182
	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
183 184

install: install-static install-shared install-man install-config
185

186
# If you installed in $(DESTDIR), test-installed won't work until you
187 188 189 190 191 192 193
# 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) \
194
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
195
	   -L$(DL) -L$(ZLIBLIB) \
196
	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
197
	./pngtestd pngtest.png
198 199 200 201 202

test-installed:
	echo
	echo Testing installed dynamic shared library.
	$(CC) $(CCFLAGS) \
203
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
204
	   -L$(ZLIBLIB) \
205
	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
206
	./pngtesti pngtest.png
207

208
clean:
209
	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
210 211
	libpng-config $(LIBSO) $(LIBSOMAJ)* \
	$(OLDSOVER) \
212
	libpng.pc
213

214 215 216 217
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
	chmod a-w *.[ch35] $(DOCS) scripts/*

218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
# DO NOT DELETE THIS LINE -- make depend depends on it.

png.o: png.h pngconf.h
pngerror.o: png.h pngconf.h
pngrio.o: png.h pngconf.h
pngwio.o: png.h pngconf.h
pngmem.o: png.h pngconf.h
pngset.o: png.h pngconf.h
pngget.o: png.h pngconf.h
pngread.o: png.h pngconf.h
pngrtran.o: png.h pngconf.h
pngrutil.o: png.h pngconf.h
pngtrans.o: png.h pngconf.h
pngwrite.o: png.h pngconf.h
pngwtran.o: png.h pngconf.h
pngwutil.o: png.h pngconf.h
pngpread.o: png.h pngconf.h
235 236

pngtest.o: png.h pngconf.h