makefile.sggcc 6.2 KB
Newer Older
1 2
# makefile for libpng.a and libpng12.so, SGI IRIX with 'cc'
# Copyright (C) 2001-2002 Glenn Randers-Pehrson
3 4 5
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h

6 7 8
# Where make install puts libpng.a, libpng12.so, and libpng12/png.h
# Prefix must be a full pathname.

9 10 11
prefix=/usr/local

# Where the zlib library and include files are located
12 13 14 15 16 17 18 19 20
#ZLIBLIB=/usr/local/lib32
#ZLIBINC=/usr/local/include
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
ZLIBLIB=../zlib
ZLIBINC=../zlib

LIBNAME=libpng12
PNGMAJ = 0
21
PNGMIN = 1.2.5
22 23
PNGVER = $(PNGMAJ).$(PNGMIN)
CC=gcc
24

25 26 27 28
# ABI can be blank to use default for your system, -32, -o32, -n32, or -64
# See "man abi".  zlib must be built with the same ABI.
ABI=

29
WARNMORE= # -g -DPNG_DEBUG=5
30 31
CFLAGS=$(ABI) -I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32
LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
32 33 34 35
LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ) \
  -set_version sgi$(PNGMAJ).0
LDLEGACY=cc $(ABI) -shared -soname libpng.so.3 \
  -set_version sgi$3.0
36
# See "man dso" for info about shared objects
37

38 39 40
RANLIB=echo
#RANLIB=ranlib

41
INCPATH=$(prefix)/include
42 43
LIBPATH=$(prefix)/lib
#LIBPATH=$(prefix)/lib32
44
MANPATH=$(prefix)/man
45
BINPATH=$(prefix)/bin
46 47 48 49 50 51 52

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

57 58 59 60
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
61

62
OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
63 64 65
	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
	pngwtran.o pngmem.o pngerror.o pngpread.o

66
all: libpng.a pngtest shared libpng.pc libpng-config
67 68

libpng.a: $(OBJS)
69
	ar rc $@ $(OBJS)
70 71
	$(RANLIB) $@

72 73
shared: $(LIBNAME).so.$(PNGVER)

74
libpng.pc:
75
	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
76

77 78 79
libpng-config:
	( cat scripts/libpng-config-head.in; \
	echo prefix=\"$(prefix)\"; \
80 81 82
	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
	echo ccopts=\"$(ABI)\"; \
	echo ldopts=\"$(ABI)\"; \
83 84
	echo L_opts=\"-L$(LIBPATH)\"; \
	echo libdir=\"$(LIBPATH)\"; \
85 86 87 88
	echo libs=\"-lpng12 -lz -lm\"; \
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

89 90 91 92 93 94
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so

$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)

95
$(LIBNAME).so.$(PNGVER): $(OBJS)
96
	$(LDSHARED) -o $@ $(OBJS)
97
	rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
98

99 100 101
libpng.so.3.$(PNGMIN): $(OBJS)
	$(LDLEGACY) -o $@ $(OBJS)

102 103 104 105
pngtest: pngtest.o libpng.a
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)

test: pngtest
106 107
	echo
	echo Testing local static library.
108 109
	./pngtest

110
install-headers: png.h pngconf.h
111 112 113
	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
	cp png.h pngconf.h $(DI)/$(LIBNAME)
114
	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
115 116
	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
	-@/bin/rm -f $(DI)/libpng
117
	(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
118 119

install-static: install-headers libpng.a
120 121 122 123 124
	-@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)
125

126 127
install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
	libpng.so.3.$(PNGMIN)
128
	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
129
	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
130 131
	-@/bin/rm -f $(DL)/libpng.so
	-@/bin/rm -f $(DL)/libpng.so.3
132
	-@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
133
	cp $(LIBNAME).so.$(PNGVER) $(DL)
134
	cp libpng.so.3.$(PNGMIN) $(DL)
135
	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
136
	chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
137
	(cd $(DL); \
138
	ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \
139
	ln -sf libpng.so.3 libpng.so; \
140 141
	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
142 143 144 145 146 147
	-@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)
148 149

install-man: libpng.3 libpngpf.3 png.5
150 151 152 153 154 155 156 157 158
	-@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
159

160
install-config: libpng-config
161 162 163 164 165 166
	-@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)
167 168

install: install-static install-shared install-man install-config
169

170 171 172 173
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.

test-installed:
174 175
	echo
	echo Testing installed dynamic shared library.
176
	$(CC) -I$(ZLIBINC) \
177 178 179
	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
	   -L$(ZLIBLIB) -rpath $(ZLIBLIB):`$(BINPATH)/libpng12-config --libdir` \
	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
180
	./pngtesti pngtest.png
181

182
clean:
183
	rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
184 185 186
	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
	libpng.so.3.$(PNGMIN) \
	so_locations
187 188 189 190

DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
	chmod a-w *.[ch35] $(DOCS) scripts/*
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209

# 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
210
pnggccrd.o: png.h pngconf.h
211