makefile.sggcc 6.6 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.8rc2
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
CFLAGS=$(ABI) -I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32
31
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
	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
131 132
	-@/bin/rm -f $(DL)/libpng.so
	-@/bin/rm -f $(DL)/libpng.so.3
133
	-@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
134
	cp $(LIBNAME).so.$(PNGVER) $(DL)
135
	cp libpng.so.3.$(PNGMIN) $(DL)
136
	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
137
	chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
138
	(cd $(DL); \
139
	ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \
140
	ln -sf libpng.so.3 libpng.so; \
141 142
	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
143 144 145 146 147 148
	-@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)
149 150

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

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

install: install-static install-shared install-man install-config
170

171
# If you installed in $(DESTDIR), test-installed won't work until you
172 173 174 175 176 177 178 179 180 181 182 183
# 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) \
	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
	   -L$(DL) -L$(ZLIBLIB) \
           -rpath $(ZLIBLIB):$(DL)\
	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
	./pngtestd pngtest.png
184 185

test-installed:
186 187
	echo
	echo Testing installed dynamic shared library.
188
	$(CC) -I$(ZLIBINC) \
189
	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
190 191
	   -L$(ZLIBLIB) \
           -rpath $(ZLIBLIB):`$(BINPATH)/libpng12-config --libdir` \
192
	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
193
	./pngtesti pngtest.png
194

195
clean:
196
	rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
197 198 199
	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
	libpng.so.3.$(PNGMIN) \
	so_locations
200 201 202 203

DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
	chmod a-w *.[ch35] $(DOCS) scripts/*
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222

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