makefile.dec 6.2 KB
Newer Older
1
# makefile for libpng on DEC Alpha Unix
2
# Copyright (C) 2000-2002, 2006 Glenn Randers-Pehrson
3
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
4
#
5
# This code is released under the libpng license.
6
# For conditions of distribution and use, see the disclaimer
7
# and license in png.h
8

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

# 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=cc
MKDIR_P=mkdir
LN_SF=ln -f -s
RANLIB=ranlib
RM_F=/bin/rm -f

31 32
# where make install puts libpng.a and png.h
prefix=/usr/local
33
exec_prefix=$(prefix)
34
INCPATH=$(prefix)/include
35
LIBPATH=$(exec_prefix)/lib
36
MANPATH=$(prefix)/man
37
BINPATH=$(exec_prefix)/bin
38 39 40 41 42 43 44

# 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
45
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
46 47
# you execute make install.
DESTDIR=
48

49 50 51 52
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
53

54 55 56 57 58 59
# Where the zlib library and include files are located
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
ZLIBLIB=../zlib
ZLIBINC=../zlib

60
CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
61 62
LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm

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

67
all: $(LIBSO) libpng.a pngtest libpng.pc libpng-config
68 69

libpng.a: $(OBJS)
70
	$(AR_RC) $@  $(OBJS)
71 72
	$(RANLIB) $@

73
libpng.pc:
74 75 76 77 78
	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
79

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

90 91
$(LIBSO): $(LIBSOMAJ)
	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
92

93 94
$(LIBSOMAJ): $(LIBSOVER)
	$(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
95

96
$(LIBSOVER): $(OBJS)
97
	$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
98
	-soname $(LIBSOMAJ)
99

100 101 102 103
$(OLDSOVER): $(OBJS)
	$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
	-soname $(OLDSOMAJ)

104
pngtest: pngtest.o libpng.a
105
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
106 107 108 109

test: pngtest
	./pngtest

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

install-static: install-headers libpng.a
120
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
121 122 123
	cp libpng.a $(DL)/$(LIBNAME).a
	chmod 644 $(DL)/$(LIBNAME).a
	-@/bin/rm -f $(DL)/libpng.a
124
	(cd $(DL); $(LN_SF)(LIBNAME).a libpng.a)
125

126 127
install-shared: install-headers $(LIBSOVER) libpng.pc \
	$(OLDSOVER)
128
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
129 130 131
	-@/bin/rm -f $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
	-@/bin/rm -f $(DL)/$(LIBSOMAJ)
	-@/bin/rm -f $(DL)/$(OLDSO)
132 133
	-@/bin/rm -f $(DL)/$(OLDSOMAJ)
	-@/bin/rm -f $(DL)/$(OLDSOVER)*
134
	cp $(LIBSOVER) $(DL)
135
	cp $(OLDSOVER) $(DL)
136
	chmod 755 $(DL)/$(LIBSOVER)
137
	chmod 755 $(DL)/$(OLDSOVER)
138
	(cd $(DL); \
139 140 141 142
	$(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
	$(LN_SF) $(OLDSOMAJ) $(OLDSO); \
	$(LN_SF)(LIBSOVER) $(LIBSOMAJ); \
	$(LN_SF)(LIBSOMAJ) $(LIBSO))
143
	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
144 145 146 147
	-@/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
148
	(cd $(DL)/pkgconfig; $(LN_SF)(LIBNAME).pc libpng.pc)
149 150

install-man: libpng.3 libpngpf.3 png.5
151 152
	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
153 154 155 156
	-@/bin/rm -f $(DM)/man3/libpng.3
	-@/bin/rm -f $(DM)/man3/libpngpf.3
	cp libpng.3 $(DM)/man3
	cp libpngpf.3 $(DM)/man3
157
	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
158 159
	-@/bin/rm -f $(DM)/man5/png.5
	cp png.5 $(DM)/man5
160

161
install-config: libpng-config
162
	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
163 164 165 166
	-@/bin/rm -f $(DB)/libpng-config
	-@/bin/rm -f $(DB)/$(LIBNAME)-config
	cp libpng-config $(DB)/$(LIBNAME)-config
	chmod 755 $(DB)/$(LIBNAME)-config
167
	(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
# 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) -w1 -I$(DI) -I$(ZLIBINC) \
179
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
180
	   -L$(DL) -L$(ZLIBLIB)  -R$(ZLIBLIB) -R$(DL) \
181
	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
182
	./pngtestd pngtest.png
183 184 185 186

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

193
clean:
194
	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
195
	libpng-config $(LIBSO) $(LIBSOMAJ)* \
196 197
	$(OLDSOVER) \
	libpng.pc
198 199 200

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

201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
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

217
pngtest.o: png.h pngconf.h