makefile.dec 5.9 KB
Newer Older
1
# makefile for libpng on DEC Alpha Unix
2
# Copyright (C) 2000-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
# where make install puts libpng.a and png.h
prefix=/usr/local
8
exec_prefix=$prefix
9
INCPATH=$(prefix)/include
10
LIBPATH=$(exec_prefix)/lib
11
MANPATH=$(prefix)/man
12
BINPATH=$(exec_prefix)/bin
13 14 15 16 17 18 19

# 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
20
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
21 22
# you execute make install.
DESTDIR=
23

24 25 26 27
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
28

29 30 31 32 33 34
# Where the zlib library and include files are located
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
ZLIBLIB=../zlib
ZLIBINC=../zlib

35
PNGMAJ = 0
36
PNGMIN = 1.2.9beta7
37
PNGVER = $(PNGMAJ).$(PNGMIN)
38
LIBNAME = libpng12
39

40
AR_RC=ar rc
41
CC=cc
42 43 44 45 46
MKDIR_P=mkdir
LN_SF=ln -f -s
RANLIB=ranlib
RM_F=/bin/rm -f

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

50 51 52 53
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

54
all: $(LIBNAME).so libpng.a pngtest libpng.pc libpng-config
55 56

libpng.a: $(OBJS)
57
	$(AR_RC) $@  $(OBJS)
58 59
	$(RANLIB) $@

60 61 62
libpng.pc:
	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc

63 64 65
libpng-config:
	( cat scripts/libpng-config-head.in; \
	echo prefix=\"$(prefix)\"; \
66 67 68
	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
	echo ccopts=\"-std\"; \
	echo L_opts=\"-L$(LIBPATH)\"; \
69 70 71 72
	echo libs=\"-lpng12 -lz -lm\"; \
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

73
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
74
	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
75

76
$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
77
	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
78

79
$(LIBNAME).so.$(PNGVER): $(OBJS)
80
	$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
81
	-soname $(LIBNAME).so.$(PNGMAJ)
82

83
libpng.so.0.$(PNGMIN): $(OBJS)
84
	$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
85
	-soname libpng.so.0
86

87
pngtest: pngtest.o libpng.a
88
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
89 90 91 92

test: pngtest
	./pngtest

93
install-headers: png.h pngconf.h
94 95 96
	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
	cp png.h pngconf.h $(DI)/$(LIBNAME)
97
	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
98 99
	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
	-@/bin/rm -f $(DI)/libpng
100
	(cd $(DI); $(LN_SF)(LIBNAME) libpng; $(LN_SF)(LIBNAME)/* .)
101 102

install-static: install-headers libpng.a
103 104 105 106
	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
	cp libpng.a $(DL)/$(LIBNAME).a
	chmod 644 $(DL)/$(LIBNAME).a
	-@/bin/rm -f $(DL)/libpng.a
107
	(cd $(DL); $(LN_SF)(LIBNAME).a libpng.a)
108

109
install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
110
	libpng.so.0.$(PNGMIN)
111
	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
112
	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
113
	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
114
	-@/bin/rm -f $(DL)/libpng.so
115 116
	-@/bin/rm -f $(DL)/libpng.so.0
	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
117
	cp $(LIBNAME).so.$(PNGVER) $(DL)
118
	cp libpng.so.0.$(PNGMIN) $(DL)
119
	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
120
	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
121
	(cd $(DL); \
122 123 124 125
	$(LN_SF) libpng.so.0.$(PNGMIN) libpng.so.0; \
	$(LN_SF) libpng.so.0 libpng.so; \
	$(LN_SF)(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
	$(LN_SF)(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
126 127 128 129 130
	-@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
131
	(cd $(DL)/pkgconfig; $(LN_SF)(LIBNAME).pc libpng.pc)
132 133

install-man: libpng.3 libpngpf.3 png.5
134 135 136 137 138 139 140 141 142
	-@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
143

144
install-config: libpng-config
145 146 147 148 149
	-@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
150
	(cd $(DB); $(LN_SF)(LIBNAME)-config libpng-config)
151 152

install: install-static install-shared install-man install-config
153

154
# If you installed in $(DESTDIR), test-installed won't work until you
155 156 157 158 159 160 161
# 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) \
162
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
163
	   -L$(DL) -L$(ZLIBLIB)  -R$(ZLIBLIB) -R$(DL) \
164
	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
165
	./pngtestd pngtest.png
166 167 168 169

test-installed:
	echo
	echo Testing installed dynamic shared library.
170
	$(CC) -w1 -I$(ZLIBINC) \
171
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
172
	   -L$(ZLIBLIB) -R$(ZLIBLIB) \
173
	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
174
	./pngtesti pngtest.png
175

176
clean:
177
	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
178
	libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
179
	libpng.so.0.$(PNGMIN) \
180
	libpng.pc
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200

# 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