diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 89 |
1 files changed, 73 insertions, 16 deletions
| @@ -1,6 +1,7 @@ | |||
| 1 | 1 | ||
| 2 | SHELL=/bin/sh | ||
| 2 | CC=gcc | 3 | CC=gcc |
| 3 | CFLAGS=-Wall -O2 -fomit-frame-pointer -fno-strength-reduce | 4 | CFLAGS=-Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduce |
| 4 | 5 | ||
| 5 | OBJS= blocksort.o \ | 6 | OBJS= 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 | ||
| 13 | all: lib bzip2 test | 14 | all: libbz2.a bzip2 bzip2recover test |
| 14 | 15 | ||
| 15 | bzip2: lib | 16 | bzip2: 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 | ||
| 20 | lib: $(OBJS) | 19 | bzip2recover: bzip2recover.o |
| 20 | $(CC) $(CFLAGS) -o bzip2recover bzip2recover.o | ||
| 21 | |||
| 22 | libbz2.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 | ||
| 24 | test: bzip2 | 31 | test: 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 | ||
| 47 | PREFIX=/usr | ||
| 48 | |||
| 49 | install: 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 | ||
| 38 | clean: | 70 | clean: |
| 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 | 75 | blocksort.o: blocksort.c |
| 42 | $(CC) $(CFLAGS) -c $*.c -o $*.o | 76 | $(CC) $(CFLAGS) -c blocksort.c |
| 77 | huffman.o: huffman.c | ||
| 78 | $(CC) $(CFLAGS) -c huffman.c | ||
| 79 | crctable.o: crctable.c | ||
| 80 | $(CC) $(CFLAGS) -c crctable.c | ||
| 81 | randtable.o: randtable.c | ||
| 82 | $(CC) $(CFLAGS) -c randtable.c | ||
| 83 | compress.o: compress.c | ||
| 84 | $(CC) $(CFLAGS) -c compress.c | ||
| 85 | decompress.o: decompress.c | ||
| 86 | $(CC) $(CFLAGS) -c decompress.c | ||
| 87 | bzlib.o: bzlib.c | ||
| 88 | $(CC) $(CFLAGS) -c bzlib.c | ||
| 89 | bzip2.o: bzip2.c | ||
| 90 | $(CC) $(CFLAGS) -c bzip2.c | ||
| 91 | bzip2recover.o: bzip2recover.c | ||
| 92 | $(CC) $(CFLAGS) -c bzip2recover.c | ||
| 43 | 93 | ||
| 44 | tarfile: | 94 | tarfile: |
| 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 | ||
