aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile81
1 files changed, 66 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index ab17f49..8305235 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,20 @@
1 1
2SHELL=/bin/sh 2SHELL=/bin/sh
3
4# To assist in cross-compiling
3CC=gcc 5CC=gcc
6AR=ar
7RANLIB=ranlib
8LDFLAGS=
9
10# Suitably paranoid flags to avoid bugs in gcc-2.7
4BIGFILES=-D_FILE_OFFSET_BITS=64 11BIGFILES=-D_FILE_OFFSET_BITS=64
5CFLAGS=-Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduce $(BIGFILES) 12CFLAGS=-Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduce $(BIGFILES)
6 13
14# Where you want it installed when you do 'make install'
15PREFIX=/usr
16
17
7OBJS= blocksort.o \ 18OBJS= blocksort.o \
8 huffman.o \ 19 huffman.o \
9 crctable.o \ 20 crctable.o \
@@ -15,20 +26,21 @@ OBJS= blocksort.o \
15all: libbz2.a bzip2 bzip2recover test 26all: libbz2.a bzip2 bzip2recover test
16 27
17bzip2: libbz2.a bzip2.o 28bzip2: libbz2.a bzip2.o
18 $(CC) $(CFLAGS) -o bzip2 bzip2.o -L. -lbz2 29 $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2
19 30
20bzip2recover: bzip2recover.o 31bzip2recover: bzip2recover.o
21 $(CC) $(CFLAGS) -o bzip2recover bzip2recover.o 32 $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o
22 33
23libbz2.a: $(OBJS) 34libbz2.a: $(OBJS)
24 rm -f libbz2.a 35 rm -f libbz2.a
25 ar cq libbz2.a $(OBJS) 36 $(AR) cq libbz2.a $(OBJS)
26 @if ( test -f /usr/bin/ranlib -o -f /bin/ranlib -o \ 37 @if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \
27 -f /usr/ccs/bin/ranlib ) ; then \ 38 -f /bin/ranlib -o -f /usr/ccs/bin/ranlib ) ; then \
28 echo ranlib libbz2.a ; \ 39 echo $(RANLIB) libbz2.a ; \
29 ranlib libbz2.a ; \ 40 $(RANLIB) libbz2.a ; \
30 fi 41 fi
31 42
43check: test
32test: bzip2 44test: bzip2
33 @cat words1 45 @cat words1
34 ./bzip2 -1 < sample1.ref > sample1.rb2 46 ./bzip2 -1 < sample1.ref > sample1.rb2
@@ -45,14 +57,12 @@ test: bzip2
45 cmp sample3.tst sample3.ref 57 cmp sample3.tst sample3.ref
46 @cat words3 58 @cat words3
47 59
48PREFIX=/usr
49
50install: bzip2 bzip2recover 60install: bzip2 bzip2recover
51 if ( test ! -d $(PREFIX)/bin ) ; then mkdir $(PREFIX)/bin ; fi 61 if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi
52 if ( test ! -d $(PREFIX)/lib ) ; then mkdir $(PREFIX)/lib ; fi 62 if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi
53 if ( test ! -d $(PREFIX)/man ) ; then mkdir $(PREFIX)/man ; fi 63 if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi
54 if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir $(PREFIX)/man/man1 ; fi 64 if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi
55 if ( test ! -d $(PREFIX)/include ) ; then mkdir $(PREFIX)/include ; fi 65 if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi
56 cp -f bzip2 $(PREFIX)/bin/bzip2 66 cp -f bzip2 $(PREFIX)/bin/bzip2
57 cp -f bzip2 $(PREFIX)/bin/bunzip2 67 cp -f bzip2 $(PREFIX)/bin/bunzip2
58 cp -f bzip2 $(PREFIX)/bin/bzcat 68 cp -f bzip2 $(PREFIX)/bin/bzcat
@@ -67,7 +77,26 @@ install: bzip2 bzip2recover
67 chmod a+r $(PREFIX)/include/bzlib.h 77 chmod a+r $(PREFIX)/include/bzlib.h
68 cp -f libbz2.a $(PREFIX)/lib 78 cp -f libbz2.a $(PREFIX)/lib
69 chmod a+r $(PREFIX)/lib/libbz2.a 79 chmod a+r $(PREFIX)/lib/libbz2.a
80 cp -f bzgrep $(PREFIX)/bin/bzgrep
81 ln $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep
82 ln $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep
83 chmod a+x $(PREFIX)/bin/bzgrep
84 cp -f bzmore $(PREFIX)/bin/bzmore
85 ln $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless
86 chmod a+x $(PREFIX)/bin/bzmore
87 cp -f bzdiff $(PREFIX)/bin/bzdiff
88 ln $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp
89 chmod a+x $(PREFIX)/bin/bzdiff
90 cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1
91 chmod a+r $(PREFIX)/man/man1/bzgrep.1
92 chmod a+r $(PREFIX)/man/man1/bzmore.1
93 chmod a+r $(PREFIX)/man/man1/bzdiff.1
94 echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzegrep.1
95 echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzfgrep.1
96 echo ".so man1/bzmore.1" > $(PREFIX)/man/man1/bzless.1
97 echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1
70 98
99distclean: clean
71clean: 100clean:
72 rm -f *.o libbz2.a bzip2 bzip2recover \ 101 rm -f *.o libbz2.a bzip2 bzip2recover \
73 sample1.rb2 sample2.rb2 sample3.rb2 \ 102 sample1.rb2 sample2.rb2 sample3.rb2 \
@@ -93,7 +122,7 @@ bzip2.o: bzip2.c
93bzip2recover.o: bzip2recover.c 122bzip2recover.o: bzip2recover.c
94 $(CC) $(CFLAGS) -c bzip2recover.c 123 $(CC) $(CFLAGS) -c bzip2recover.c
95 124
96DISTNAME=bzip2-1.0.1 125DISTNAME=bzip2-1.0.2
97tarfile: 126tarfile:
98 rm -f $(DISTNAME) 127 rm -f $(DISTNAME)
99 ln -sf . $(DISTNAME) 128 ln -sf . $(DISTNAME)
@@ -112,6 +141,7 @@ tarfile:
112 $(DISTNAME)/Makefile \ 141 $(DISTNAME)/Makefile \
113 $(DISTNAME)/manual.texi \ 142 $(DISTNAME)/manual.texi \
114 $(DISTNAME)/manual.ps \ 143 $(DISTNAME)/manual.ps \
144 $(DISTNAME)/manual.pdf \
115 $(DISTNAME)/LICENSE \ 145 $(DISTNAME)/LICENSE \
116 $(DISTNAME)/bzip2.1 \ 146 $(DISTNAME)/bzip2.1 \
117 $(DISTNAME)/bzip2.1.preformatted \ 147 $(DISTNAME)/bzip2.1.preformatted \
@@ -138,4 +168,25 @@ tarfile:
138 $(DISTNAME)/Y2K_INFO \ 168 $(DISTNAME)/Y2K_INFO \
139 $(DISTNAME)/unzcrash.c \ 169 $(DISTNAME)/unzcrash.c \
140 $(DISTNAME)/spewG.c \ 170 $(DISTNAME)/spewG.c \
171 $(DISTNAME)/mk251.c \
172 $(DISTNAME)/bzdiff \
173 $(DISTNAME)/bzdiff.1 \
174 $(DISTNAME)/bzmore \
175 $(DISTNAME)/bzmore.1 \
176 $(DISTNAME)/bzgrep \
177 $(DISTNAME)/bzgrep.1 \
141 $(DISTNAME)/Makefile-libbz2_so 178 $(DISTNAME)/Makefile-libbz2_so
179 gzip -v $(DISTNAME).tar
180
181# For rebuilding the manual from sources on my RedHat 7.2 box
182manual: manual.ps manual.pdf manual.html
183
184manual.ps: manual.texi
185 tex manual.texi
186 dvips -o manual.ps manual.dvi
187
188manual.pdf: manual.ps
189 ps2pdf manual.ps
190
191manual.html: manual.texi
192 texi2html -split_chapter manual.texi