aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile89
1 files changed, 73 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 8ebea66..8a1235d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
1 1
2SHELL=/bin/sh
2CC=gcc 3CC=gcc
3CFLAGS=-Wall -O2 -fomit-frame-pointer -fno-strength-reduce 4CFLAGS=-Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduce
4 5
5OBJS= blocksort.o \ 6OBJS= blocksort.o \
6 huffman.o \ 7 huffman.o \
@@ -10,37 +11,93 @@ OBJS= blocksort.o \
10 decompress.o \ 11 decompress.o \
11 bzlib.o 12 bzlib.o
12 13
13all: lib bzip2 test 14all: libbz2.a bzip2 bzip2recover test
14 15
15bzip2: lib 16bzip2: libbz2.a bzip2.o
16 $(CC) $(CFLAGS) -c bzip2.c
17 $(CC) $(CFLAGS) -o bzip2 bzip2.o -L. -lbz2 17 $(CC) $(CFLAGS) -o bzip2 bzip2.o -L. -lbz2
18 $(CC) $(CFLAGS) -o bzip2recover bzip2recover.c
19 18
20lib: $(OBJS) 19bzip2recover: bzip2recover.o
20 $(CC) $(CFLAGS) -o bzip2recover bzip2recover.o
21
22libbz2.a: $(OBJS)
21 rm -f libbz2.a 23 rm -f libbz2.a
22 ar clq libbz2.a $(OBJS) 24 ar cq libbz2.a $(OBJS)
25 @if ( test -f /usr/bin/ranlib -o -f /bin/ranlib -o \
26 -f /usr/ccs/bin/ranlib ) ; then \
27 echo ranlib libbz2.a ; \
28 ranlib libbz2.a ; \
29 fi
23 30
24test: bzip2 31test: bzip2
25 @cat words1 32 @cat words1
26 ./bzip2 -1 < sample1.ref > sample1.rb2 33 ./bzip2 -1 < sample1.ref > sample1.rb2
27 ./bzip2 -2 < sample2.ref > sample2.rb2 34 ./bzip2 -2 < sample2.ref > sample2.rb2
28 ./bzip2 -d < sample1.bz2 > sample1.tst 35 ./bzip2 -3 < sample3.ref > sample3.rb2
29 ./bzip2 -d < sample2.bz2 > sample2.tst 36 ./bzip2 -d < sample1.bz2 > sample1.tst
30 @cat words2 37 ./bzip2 -d < sample2.bz2 > sample2.tst
38 ./bzip2 -ds < sample3.bz2 > sample3.tst
31 cmp sample1.bz2 sample1.rb2 39 cmp sample1.bz2 sample1.rb2
32 cmp sample2.bz2 sample2.rb2 40 cmp sample2.bz2 sample2.rb2
41 cmp sample3.bz2 sample3.rb2
33 cmp sample1.tst sample1.ref 42 cmp sample1.tst sample1.ref
34 cmp sample2.tst sample2.ref 43 cmp sample2.tst sample2.ref
44 cmp sample3.tst sample3.ref
35 @cat words3 45 @cat words3
36 46
47PREFIX=/usr
48
49install: bzip2 bzip2recover
50 if ( test ! -d $(PREFIX)/bin ) ; then mkdir $(PREFIX)/bin ; fi
51 if ( test ! -d $(PREFIX)/lib ) ; then mkdir $(PREFIX)/lib ; fi
52 if ( test ! -d $(PREFIX)/man ) ; then mkdir $(PREFIX)/man ; fi
53 if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir $(PREFIX)/man/man1 ; fi
54 if ( test ! -d $(PREFIX)/include ) ; then mkdir $(PREFIX)/include ; fi
55 cp -f bzip2 $(PREFIX)/bin/bzip2
56 cp -f bzip2 $(PREFIX)/bin/bunzip2
57 cp -f bzip2 $(PREFIX)/bin/bzcat
58 cp -f bzip2recover $(PREFIX)/bin/bzip2recover
59 chmod a+x $(PREFIX)/bin/bzip2
60 chmod a+x $(PREFIX)/bin/bunzip2
61 chmod a+x $(PREFIX)/bin/bzcat
62 chmod a+x $(PREFIX)/bin/bzip2recover
63 cp -f bzip2.1 $(PREFIX)/man/man1
64 chmod a+r $(PREFIX)/man/man1/bzip2.1
65 cp -f bzlib.h $(PREFIX)/include
66 chmod a+r $(PREFIX)/include/bzlib.h
67 cp -f libbz2.a $(PREFIX)/lib
68 chmod a+r $(PREFIX)/lib/libbz2.a
37 69
38clean: 70clean:
39 rm -f *.o libbz2.a bzip2 bzip2recover sample1.rb2 sample2.rb2 sample1.tst sample2.tst 71 rm -f *.o libbz2.a bzip2 bzip2recover \
72 sample1.rb2 sample2.rb2 sample3.rb2 \
73 sample1.tst sample2.tst sample3.tst
40 74
41.c.o: $*.o bzlib.h bzlib_private.h 75blocksort.o: blocksort.c
42 $(CC) $(CFLAGS) -c $*.c -o $*.o 76 $(CC) $(CFLAGS) -c blocksort.c
77huffman.o: huffman.c
78 $(CC) $(CFLAGS) -c huffman.c
79crctable.o: crctable.c
80 $(CC) $(CFLAGS) -c crctable.c
81randtable.o: randtable.c
82 $(CC) $(CFLAGS) -c randtable.c
83compress.o: compress.c
84 $(CC) $(CFLAGS) -c compress.c
85decompress.o: decompress.c
86 $(CC) $(CFLAGS) -c decompress.c
87bzlib.o: bzlib.c
88 $(CC) $(CFLAGS) -c bzlib.c
89bzip2.o: bzip2.c
90 $(CC) $(CFLAGS) -c bzip2.c
91bzip2recover.o: bzip2recover.c
92 $(CC) $(CFLAGS) -c bzip2recover.c
43 93
44tarfile: 94tarfile:
45 tar cvf interim.tar *.c *.h Makefile manual.texi manual.ps LICENSE bzip2.1 bzip2.1.preformatted bzip2.txt words1 words2 words3 sample1.ref sample2.ref sample1.bz2 sample2.bz2 *.html README CHANGES libbz2.def libbz2.dsp dlltest.dsp 95 tar cvf interim.tar blocksort.c huffman.c crctable.c \
96 randtable.c compress.c decompress.c bzlib.c bzip2.c \
97 bzip2recover.c bzlib.h bzlib_private.h Makefile manual.texi \
98 manual.ps LICENSE bzip2.1 bzip2.1.preformatted bzip2.txt \
99 words1 words2 words3 sample1.ref sample2.ref sample3.ref \
100 sample1.bz2 sample2.bz2 sample3.bz2 dlltest.c \
101 *.html README CHANGES libbz2.def libbz2.dsp \
102 dlltest.dsp makefile.msc Y2K_INFO
46 103