makefile.hpgcc 7.1 KB
Newer Older
1
# makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
2
# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
3 4 5 6 7 8
# Copyright (C) 2001, Laurent faillie
# Copyright (C) 1998, 1999 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
# For conditions of distribution and use, see copyright notice in png.h

CC=gcc
9
LD=ld
10 11 12 13 14
AR_RC=ar rc
MKDIR_P=mkdir
LN_SF=ln -sf
RANLIB=ranlib
RM_F=/bin/rm -f
15

16
# where "make install" puts libpng.a, libpng.sl*, png.h and pngconf.h
17
prefix=/usr/local
18
exec_prefix=$prefix
19 20 21 22 23

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

24 25 26 27 28 29 30
# 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

31 32 33 34 35 36 37 38 39 40 41 42
ALIGN=
# for i386:
#ALIGN=-malign-loops=2 -malign-functions=2

WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
	-Wmissing-declarations -Wtraditional -Wcast-align \
	-Wstrict-prototypes -Wmissing-prototypes #-Wconversion

# for pgcc version 2.95.1, -O3 is buggy; don't use it.

CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \
	$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
43
#LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
44 45
LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm

46
PNGMAJ = 0
47
PNGMIN = 1.2.9beta8
48
PNGVER = $(PNGMAJ).$(PNGMIN)
49
LIBNAME = libpng12
50 51

INCPATH=$(prefix)/include
52
LIBPATH=$(exec_prefix)/lib
53
MANPATH=$(prefix)/man
54
BINPATH=$(exec_prefix)/bin
55 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 72 73 74 75 76 77 78 79 80 81
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
	pngwtran.o pngmem.o pngerror.o pngpread.o

OBJSDLL = $(OBJS:.o=.pic.o)

.SUFFIXES:      .c .o .pic.o

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

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

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

88 89 90
libpng.pc:
	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc

91 92 93
libpng-config:
	( cat scripts/libpng-config-head.in; \
	echo prefix=\"$(prefix)\"; \
94
	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
95 96 97 98
	echo libs=\"-lpng12 -lz -lm\"; \
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

99
$(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
100
	$(LN_SF) $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
101

102
$(LIBNAME).sl.$(PNGMAJ): $(LIBNAME).sl.$(PNGVER)
103
	$(LN_SF) $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ)
104

105
$(LIBNAME).sl.$(PNGVER): $(OBJSDLL)
106
	$(LD) -b +s \
107
	+h $(LIBNAME).sl.$(PNGMAJ) -o $(LIBNAME).sl.$(PNGVER) $(OBJSDLL)
108

109
libpng.sl.3.$(PNGMIN): $(OBJSDLL)
110
	$(LD) -b +s \
111
	+h libpng.sl.3 -o libpng.sl.3.$(PNGMIN) $(OBJSDLL)
112

113
pngtest: pngtest.o $(LIBNAME).sl
114 115 116 117 118
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)

test: pngtest
	./pngtest

119

120
install-headers: png.h pngconf.h
121 122
	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
123
	cp png.h pngconf.h $(DI)/$(LIBNAME)
124
	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
125 126 127
	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
	-@$(RM_F) $(DI)/libpng
	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
128 129

install-static: install-headers libpng.a
130
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
131 132
	cp libpng.a $(DL)/$(LIBNAME).a
	chmod 644 $(DL)/$(LIBNAME).a
133 134
	-@$(RM_F) $(DL)/libpng.a
	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
135

136 137
install-shared: install-headers $(LIBNAME).sl.$(PNGVER) libpng.pc \
	libpng.sl.3.$(PNGMIN)
138 139 140 141 142 143
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
	-@$(RM_F) $(DL)/$(LIBNAME).sl.$(PNGVER)* $(DL)/$(LIBNAME).sl
	-@$(RM_F) $(DL)/$(LIBNAME).sl.$(PNGMAJ)
	-@$(RM_F) $(DL)/libpng.sl
	-@$(RM_F) $(DL)/libpng.sl.3
	-@$(RM_F) $(DL)/libpng.sl.3.$(PNGMIN)*
144
	cp $(LIBNAME).sl.$(PNGVER) $(DL)
145
	cp libpng.sl.3.$(PNGMIN) $(DL)
146
	chmod 755 $(DL)/$(LIBNAME).sl.$(PNGVER)
147
	chmod 755 $(DL)/libpng.sl.3.$(PNGMIN)
148
	(cd $(DL); \
149 150 151 152 153 154 155
	$(LN_SF) libpng.sl.3.$(PNGMIN) libpng.sl.3; \
	$(LN_SF) libpng.sl.3 libpng.sl; \
	$(LN_SF) $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
	$(LN_SF) $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
156 157
	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
158
	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
159 160

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

171
install-config: libpng-config
172 173 174
	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
	-@$(RM_F) $(DB)/libpng-config
	-@$(RM_F) $(DB)/$(LIBNAME)-config
175 176
	cp libpng-config $(DB)/$(LIBNAME)-config
	chmod 755 $(DB)/$(LIBNAME)-config
177
	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
178 179

install: install-static install-shared install-man install-config
180

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

test-installed:
	echo
	echo Testing installed dynamic shared library.
	$(CC) -I$(ZLIBINC) \
198
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
199
	   -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
200
	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
201
	./pngtesti pngtest.png
202 203

clean:
204
	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
205
	libpng-config $(LIBNAME).sl $(LIBNAME).sl.$(PNGMAJ)* \
206 207
	libpng.sl.3.$(PNGMIN) \
	libpng.pc
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231

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

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

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

pngtest.o: png.h pngconf.h