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.5beta2
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
LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ)
33
LDLEGACY=cc $(ABI) -shared -soname libpng.so.3
34
# See "man dso" for info about shared objects
35

36 37 38
RANLIB=echo
#RANLIB=ranlib

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

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

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

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

64
all: libpng.a pngtest shared libpng.pc libpng-config
65 66

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

70 71
shared: $(LIBNAME).so.$(PNGVER)

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

75 76 77
libpng-config:
	( cat scripts/libpng-config-head.in; \
	echo prefix=\"$(prefix)\"; \
78
	echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_USE_PNGGCCRD \
79 80
		-DPNG_NO_ASSEMBLER_CODE\"; \
	echo cflags=\"$(ABI)\"; \
81 82
	echo ldflags=\"-L$(LIBPATH) \"; \
	echo rpath=\"$(LIBPATH) \"; \
83 84 85 86
	echo libs=\"-lpng12 -lz -lm\"; \
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

87 88 89 90 91 92
$(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)

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

97 98 99
libpng.so.3.$(PNGMIN): $(OBJS)
	$(LDLEGACY) -o $@ $(OBJS)

100 101 102 103
pngtest: pngtest.o libpng.a
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)

test: pngtest
104 105
	echo
	echo Testing local static library.
106 107
	./pngtest

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

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

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

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

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

install: install-static install-shared install-man install-config
167

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

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

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

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

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