makefile.sggcc 6.6 KB
Newer Older
1
# makefile for libpng.a and libpng12.so, SGI IRIX with 'cc'
2
# Copyright (C) 2001-2002, 2006 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
# Library name:
LIBNAME=libpng12
PNGMAJ = 0
9
PNGMIN = 1.2.19beta3
10 11 12 13 14 15 16
PNGVER = $(PNGMAJ).$(PNGMIN)

# Shared library names:
LIBSO=$(LIBNAME).so
LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
LIBSOVER=$(LIBNAME).so.$(PNGVER)
OLDSO=libpng.so
17 18
OLDSOMAJ=libpng.so.3
OLDSOVER=libpng.so.3.$(PNGMIN)
19 20 21 22 23 24 25 26 27

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

28 29 30
# Where make install puts libpng.a, libpng12.so, and libpng12/png.h
# Prefix must be a full pathname.

31
prefix=/usr/local
32
exec_prefix=$(prefix)
33 34

# Where the zlib library and include files are located
35 36 37 38 39 40 41
#ZLIBLIB=/usr/local/lib32
#ZLIBINC=/usr/local/include
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
ZLIBLIB=../zlib
ZLIBINC=../zlib

42 43 44 45
# 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=

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

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

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

71 72 73 74
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
75

76
OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
77 78 79
	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
	pngwtran.o pngmem.o pngerror.o pngpread.o

80
all: libpng.a pngtest shared libpng.pc libpng-config
81 82

libpng.a: $(OBJS)
83
	$(AR_RC) $@ $(OBJS)
84 85
	$(RANLIB) $@

86
shared: $(LIBSOVER)
87

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

91 92 93
libpng-config:
	( cat scripts/libpng-config-head.in; \
	echo prefix=\"$(prefix)\"; \
94 95 96
	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
	echo ccopts=\"$(ABI)\"; \
	echo ldopts=\"$(ABI)\"; \
97 98
	echo L_opts=\"-L$(LIBPATH)\"; \
	echo libdir=\"$(LIBPATH)\"; \
99 100 101 102
	echo libs=\"-lpng12 -lz -lm\"; \
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

103 104
$(LIBSO): $(LIBSOMAJ)
	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
105

106 107
$(LIBSOMAJ): $(LIBSOVER)
	$(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
108

109
$(LIBSOVER): $(OBJS)
110
	$(LDSHARED) -o $@ $(OBJS)
111
	$(RM_F) $(LIBSO) $(LIBSOMAJ)
112

113
$(OLDSOVER): $(OBJS)
114 115
	$(LDLEGACY) -o $@ $(OBJS)

116 117 118 119
pngtest: pngtest.o libpng.a
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)

test: pngtest
120 121
	echo
	echo Testing local static library.
122 123
	./pngtest

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

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

140 141
install-shared: install-headers $(LIBSOVER) libpng.pc \
	$(OLDSOVER)
142
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
143 144 145 146 147 148 149 150 151
	-@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
	-@$(RM_F) $(DL)/$(LIBSOMAJ)
	-@$(RM_F) $(DL)/$(OLDSO)
	-@$(RM_F) $(DL)/$(OLDSOMAJ)
	-@$(RM_F) $(DL)/$(OLDSOVER)*
	cp $(LIBSOVER) $(DL)
	cp $(OLDSOVER) $(DL)
	chmod 755 $(DL)/$(LIBSOVER)
	chmod 755 $(DL)/$(OLDSOVER)
152
	(cd $(DL); \
153 154 155 156
	$(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
	$(LN_SF) $(OLDSOMAJ) $(OLDSO); \
	$(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
	$(LN_SF) $(LIBSOMAJ) $(LIBSO))
157
	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
158 159
	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
160 161
	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
162
	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
163 164

install-man: libpng.3 libpngpf.3 png.5
165 166
	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
167 168
	-@$(RM_F) $(DM)/man3/libpng.3
	-@$(RM_F) $(DM)/man3/libpngpf.3
169 170
	cp libpng.3 $(DM)/man3
	cp libpngpf.3 $(DM)/man3
171
	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
172
	-@$(RM_F) $(DM)/man5/png.5
173
	cp png.5 $(DM)/man5
174

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

install: install-static install-shared install-man install-config
184

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

test-installed:
200 201
	echo
	echo Testing installed dynamic shared library.
202
	$(CC) -I$(ZLIBINC) \
203
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
204
	   -L$(ZLIBLIB) \
205 206
           -rpath $(ZLIBLIB):`$(BINPATH)/$(LIBNAME)-config --libdir` \
	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
207
	./pngtesti pngtest.png
208

209
clean:
210
	$(RM_F) libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
211 212
	$(LIBSO) $(LIBSOMAJ)* \
	$(OLDSOVER) \
213
	so_locations
214 215 216 217

DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
	chmod a-w *.[ch35] $(DOCS) scripts/*
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236

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