makefile.sggcc 7.0 KB
Newer Older
1
# makefile for libpng.a and libpng14.so, SGI IRIX with 'cc'
2
# Copyright (C) 2001-2002, 2006 Glenn Randers-Pehrson
3
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
4
#
5
# This code is released under the zlib/libpng license.
6 7
# For conditions of distribution and use, see copyright notice, disclaimer,
# and license in png.h
8

9
# Library name:
10
LIBNAME=libpng14
11
PNGMAJ = 14
12
PNGMIN = 1.4.0beta65
13 14 15 16 17 18 19
PNGVER = $(PNGMAJ).$(PNGMIN)

# Shared library names:
LIBSO=$(LIBNAME).so
LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
LIBSOVER=$(LIBNAME).so.$(PNGVER)
OLDSO=libpng.so
20 21
OLDSOMAJ=libpng.so.14
OLDSOVER=libpng.so.14.$(PNGMIN)
22 23 24 25 26 27 28 29 30

# Utilities:
AR_RC=ar rc
CC=gcc
MKDIR_P=mkdir -p
LN_SF=ln -sf
RANLIB=echo
RM_F=/bin/rm -f

31
# Where make install puts libpng.a, libpng14.so, and libpng14/png.h
32 33
# Prefix must be a full pathname.

34
prefix=/usr/local
35
exec_prefix=$(prefix)
36 37

# Where the zlib library and include files are located
38 39 40 41 42 43 44
#ZLIBLIB=/usr/local/lib32
#ZLIBINC=/usr/local/include
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
ZLIBLIB=../zlib
ZLIBINC=../zlib

45 46 47 48
# 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=

49
WARNMORE= # -g -DPNG_DEBUG=5
50
CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -fPIC -mabi=n32
51
LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
52
LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \
53
  -set_version sgi$(PNGMAJ).0
54 55
LDLEGACY=cc $(ABI) -shared -soname $(OLDSOMAJ) \
  -set_version sgi$3.0
56
# See "man dso" for info about shared objects
57

58
INCPATH=$(prefix)/include
59 60
LIBPATH=$(exec_prefix)/lib
#LIBPATH=$(exec_prefix)/lib32
61
MANPATH=$(prefix)/man
62
BINPATH=$(exec_prefix)/bin
63 64 65 66 67 68 69

# 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
70
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
71 72
# you execute make install.
DESTDIR=
73

74 75 76 77
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
78

79
OBJS =  png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
80 81 82
	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
	pngwtran.o pngmem.o pngerror.o pngpread.o

83
all: libpng.a pngtest shared libpng.pc libpng-config
84 85

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

89
shared: $(LIBSOVER)
90

91
libpng.pc:
92 93 94 95 96
	cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
	-e s!@exec_prefix@!$(exec_prefix)! \
	-e s!@libdir@!$(LIBPATH)! \
	-e s!@includedir@!$(INCPATH)! \
	-e s!-lpng14!-lpng14\ -lz\ -lm! > libpng.pc
97

98 99 100
libpng-config:
	( cat scripts/libpng-config-head.in; \
	echo prefix=\"$(prefix)\"; \
101 102
	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
	echo ccopts=\"$(ABI)\"; \
103
	echo cppflags=\"\"; \
104
	echo ldopts=\"$(ABI)\"; \
105 106
	echo L_opts=\"-L$(LIBPATH)\"; \
	echo libdir=\"$(LIBPATH)\"; \
107
	echo libs=\"-lpng14 -lz -lm\"; \
108 109 110
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

111 112
$(LIBSO): $(LIBSOMAJ)
	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
113

114 115
$(LIBSOMAJ): $(LIBSOVER)
	$(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
116

117
$(LIBSOVER): $(OBJS)
118
	$(LDSHARED) -o $@ $(OBJS)
119
	$(RM_F) $(LIBSO) $(LIBSOMAJ)
120

121 122 123
$(OLDSOVER): $(OBJS)
	$(LDLEGACY) -o $@ $(OBJS)

124 125 126 127
pngtest: pngtest.o libpng.a
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)

test: pngtest
128 129
	echo
	echo Testing local static library.
130 131
	./pngtest

132
install-headers: png.h pngconf.h
133 134
	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
135
	cp png.h pngconf.h $(DI)/$(LIBNAME)
136
	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
137
	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
138
	-@$(RM_F) $(DI)/libpng
139
	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
140 141

install-static: install-headers libpng.a
142
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
143 144
	cp libpng.a $(DL)/$(LIBNAME).a
	chmod 644 $(DL)/$(LIBNAME).a
145
	-@$(RM_F) $(DL)/libpng.a
146
	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
147

148 149
install-shared: install-headers $(LIBSOVER) libpng.pc \
	$(OLDSOVER)
150
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
151 152 153
	-@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
	-@$(RM_F) $(DL)/$(LIBSOMAJ)
	-@$(RM_F) $(DL)/$(OLDSO)
154 155
	-@$(RM_F) $(DL)/$(OLDSOMAJ)
	-@$(RM_F) $(DL)/$(OLDSOVER)*
156
	cp $(LIBSOVER) $(DL)
157
	cp $(OLDSOVER) $(DL)
158
	chmod 755 $(DL)/$(LIBSOVER)
159
	chmod 755 $(DL)/$(OLDSOVER)
160
	(cd $(DL); \
161 162
	$(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
	$(LN_SF) $(OLDSOMAJ) $(OLDSO); \
163
	$(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
164
	$(LN_SF) $(LIBSOMAJ) $(LIBSO))
165
	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
166 167
	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
168 169
	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
170
	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
171 172

install-man: libpng.3 libpngpf.3 png.5
173 174
	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
175 176
	-@$(RM_F) $(DM)/man3/libpng.3
	-@$(RM_F) $(DM)/man3/libpngpf.3
177 178
	cp libpng.3 $(DM)/man3
	cp libpngpf.3 $(DM)/man3
179
	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
180
	-@$(RM_F) $(DM)/man5/png.5
181
	cp png.5 $(DM)/man5
182

183
install-config: libpng-config
184
	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
185 186
	-@$(RM_F) $(DB)/libpng-config
	-@$(RM_F) $(DB)/$(LIBNAME)-config
187 188
	cp libpng-config $(DB)/$(LIBNAME)-config
	chmod 755 $(DB)/$(LIBNAME)-config
189
	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
190 191

install: install-static install-shared install-man install-config
192

193
# If you installed in $(DESTDIR), test-installed won't work until you
194 195 196 197 198 199 200
# 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) \
201
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
202
	   -L$(DL) -L$(ZLIBLIB) \
203
           -rpath $(ZLIBLIB):$(DL) \
204
	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
205
	./pngtestd pngtest.png
206 207

test-installed:
208 209
	echo
	echo Testing installed dynamic shared library.
210
	$(CC) -I$(ZLIBINC) \
211
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
212
	   -L$(ZLIBLIB) \
213 214
           -rpath $(ZLIBLIB):`$(BINPATH)/$(LIBNAME)-config --libdir` \
	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
215
	./pngtesti pngtest.png
216

217
clean:
218 219
	$(RM_F) libpng.a pngtest pngtesti pngout.png libpng.pc \
        so_locations libpng-config $(LIBSO) $(LIBSOMAJ)* $(OLDSOVER)
220 221 222 223

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

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

227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
png.o: png.h pngconf.h pngpriv.h
pngerror.o: png.h pngconf.h pngpriv.h
pngrio.o: png.h pngconf.h pngpriv.h
pngwio.o: png.h pngconf.h pngpriv.h
pngmem.o: png.h pngconf.h pngpriv.h
pngset.o: png.h pngconf.h pngpriv.h
pngget.o: png.h pngconf.h pngpriv.h
pngread.o: png.h pngconf.h pngpriv.h
pngrtran.o: png.h pngconf.h pngpriv.h
pngrutil.o: png.h pngconf.h pngpriv.h
pngtrans.o: png.h pngconf.h pngpriv.h
pngwrite.o: png.h pngconf.h pngpriv.h
pngwtran.o: png.h pngconf.h pngpriv.h
pngwutil.o: png.h pngconf.h pngpriv.h
pngpread.o: png.h pngconf.h pngpriv.h

pngtest.o: png.h pngconf.h pngpriv.h