makefile.hpux 6.4 KB
Newer Older
1
# makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
2
# Copyright (C) 1999-2002 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 9 10
# For conditions of distribution and use, see copyright notice in png.h

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

11 12 13 14 15 16 17
# 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

18 19
CC=cc
CFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
20
# Caution: be sure you have built zlib with the same CFLAGS.
21
CCFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
22 23 24
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm

RANLIB=ranlib
25

26
PNGMAJ = 0
27
PNGMIN = 1.2.8rc3
28
PNGVER = $(PNGMAJ).$(PNGMIN)
29
LIBNAME = libpng12
30

31
# where make install puts libpng.a, libpng12.sl, and png.h
32
prefix=/opt/libpng
33 34 35
INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib
MANPATH=$(prefix)/man
36
BINPATH=$(prefix)/bin
37 38 39 40 41 42 43

# 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
44
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
45 46
# you execute make install.
DESTDIR=
47

48 49 50 51
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
52

53
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
54 55
	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
	pngwtran.o pngmem.o pngerror.o pngpread.o
56

57 58 59 60 61 62 63
OBJSDLL = $(OBJS:.o=.pic.o)

.SUFFIXES:	.c .o .pic.o

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

64
all: libpng.a $(LIBNAME).sl pngtest libpng.pc libpng-config
65 66

libpng.a: $(OBJS)
67
	ar rc $@ $(OBJS)
68
	$(RANLIB) $@
69

70 71 72
libpng.pc:
	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc

73 74 75
libpng-config:
	( cat scripts/libpng-config-head.in; \
	echo prefix=\"$(prefix)\"; \
76
	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
77
	echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
78
	echo L_opts=\"-L$(LIBPATH)\"; \
79 80 81 82
	echo libs=\"-lpng12 -lz -lm\"; \
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

83
$(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
84
	ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
85

86
$(LIBNAME).sl.$(PNGMAJ): $(LIBNAME).sl.$(PNGVER)
87
	ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ)
88

89
$(LIBNAME).sl.$(PNGVER): $(OBJSDLL)
90
	$(LD) -b +s \
91
	+h $(LIBNAME).sl.$(PNGMAJ) -o $(LIBNAME).sl.$(PNGVER) $(OBJSDLL)
92

93
libpng.sl.3.$(PNGMIN): $(OBJSDLL)
94 95
	$(LD) -b +s \
	+h libpng.sl.3 -o libpng.sl.3.$(PNGMIN) $(OBJSDLL)
96

97
pngtest: pngtest.o libpng.a
98
	$(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
99 100

test: pngtest
101
	./pngtest
102

103
install-headers: png.h pngconf.h
104 105 106
	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
	cp png.h pngconf.h $(DI)/$(LIBNAME)
107
	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
108 109 110
	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
	-@/bin/rm -f $(DI)/libpng
	(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
111 112

install-static: install-headers libpng.a
113 114 115 116 117
	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
	cp libpng.a $(DL)/$(LIBNAME).a
	chmod 644 $(DL)/$(LIBNAME).a
	-@/bin/rm -f $(DL)/libpng.a
	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
118

119 120
install-shared: install-headers $(LIBNAME).sl.$(PNGVER) libpng.pc \
	libpng.sl.3.$(PNGMIN)
121
	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
122
	-@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGVER)* $(DL)/$(LIBNAME).sl
123
	-@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGMAJ)
124 125
	-@/bin/rm -f $(DL)/libpng.sl
	-@/bin/rm -f $(DL)/libpng.sl.3
126
	-@/bin/rm -f $(DL)/libpng.sl.3.$(PNGMIN)*
127
	cp $(LIBNAME).sl.$(PNGVER) $(DL)
128
	cp libpng.sl.3.$(PNGMIN) $(DL)
129
	chmod 755 $(DL)/$(LIBNAME).sl.$(PNGVER)
130
	chmod 755 $(DL)/libpng.sl.3.$(PNGMIN)
131
	(cd $(DL); \
132
	ln -sf libpng.sl.3.$(PNGMIN) libpng.sl.3; \
133
	ln -sf libpng.sl.3 libpng.sl; \
134 135
	ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
	ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
136 137 138 139 140 141
	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
	(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
142 143

install-man: libpng.3 libpngpf.3 png.5
144 145 146 147 148 149 150 151 152
	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
	-@/bin/rm -f $(DM)/man3/libpng.3
	-@/bin/rm -f $(DM)/man3/libpngpf.3
	cp libpng.3 $(DM)/man3
	cp libpngpf.3 $(DM)/man3
	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
	-@/bin/rm -f $(DM)/man5/png.5
	cp png.5 $(DM)/man5
153

154
install-config: libpng-config
155 156 157 158 159 160
	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
	-@/bin/rm -f $(DB)/libpng-config
	-@/bin/rm -f $(DB)/$(LIBNAME)-config
	cp libpng-config $(DB)/$(LIBNAME)-config
	chmod 755 $(DB)/$(LIBNAME)-config
	(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
161 162

install: install-static install-shared install-man install-config
163

164
# If you installed in $(DESTDIR), test-installed won't work until you
165 166 167 168 169 170 171 172 173 174 175
# 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) \
	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
	   -L$(DL) -L$(ZLIBLIB) \
	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
	./pngtestd pngtest.png
176 177 178 179 180

test-installed:
	echo
	echo Testing installed dynamic shared library.
	$(CC) $(CCFLAGS) \
181
	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
182
	   -L$(ZLIBLIB) \
183
	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
184
	./pngtesti pngtest.png
185

186
clean:
187
	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
188
	libpng-config $(LIBNAME).sl $(LIBNAME).sl.$(PNGMAJ)* \
189 190
	libpng.sl.3.$(PNGMIN) \
	libpng.pc
191

192 193 194 195
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
	chmod a-w *.[ch35] $(DOCS) scripts/*

196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
# 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
pngtest.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