1 | |
---|
2 | SHELL=/bin/sh |
---|
3 | |
---|
4 | # To assist in cross-compiling |
---|
5 | CC=gcc |
---|
6 | AR=ar |
---|
7 | RANLIB=ranlib |
---|
8 | LDFLAGS= |
---|
9 | |
---|
10 | # Suitably paranoid flags to avoid bugs in gcc-2.7 |
---|
11 | BIGFILES=-D_FILE_OFFSET_BITS=64 |
---|
12 | CFLAGS=-Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduce $(BIGFILES) |
---|
13 | |
---|
14 | # Where you want it installed when you do 'make install' |
---|
15 | PREFIX=/usr |
---|
16 | |
---|
17 | |
---|
18 | OBJS= blocksort.o \ |
---|
19 | huffman.o \ |
---|
20 | crctable.o \ |
---|
21 | randtable.o \ |
---|
22 | compress.o \ |
---|
23 | decompress.o \ |
---|
24 | bzlib.o |
---|
25 | |
---|
26 | all: libbz2.a bzip2 bzip2recover test |
---|
27 | |
---|
28 | bzip2: libbz2.a bzip2.o |
---|
29 | $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2 |
---|
30 | |
---|
31 | bzip2recover: bzip2recover.o |
---|
32 | $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o |
---|
33 | |
---|
34 | libbz2.a: $(OBJS) |
---|
35 | rm -f libbz2.a |
---|
36 | $(AR) cq libbz2.a $(OBJS) |
---|
37 | @if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \ |
---|
38 | -f /bin/ranlib -o -f /usr/ccs/bin/ranlib ) ; then \ |
---|
39 | echo $(RANLIB) libbz2.a ; \ |
---|
40 | $(RANLIB) libbz2.a ; \ |
---|
41 | fi |
---|
42 | |
---|
43 | check: test |
---|
44 | test: bzip2 |
---|
45 | @cat words1 |
---|
46 | ./bzip2 -1 < sample1.ref > sample1.rb2 |
---|
47 | ./bzip2 -2 < sample2.ref > sample2.rb2 |
---|
48 | ./bzip2 -3 < sample3.ref > sample3.rb2 |
---|
49 | ./bzip2 -d < sample1.bz2 > sample1.tst |
---|
50 | ./bzip2 -d < sample2.bz2 > sample2.tst |
---|
51 | ./bzip2 -ds < sample3.bz2 > sample3.tst |
---|
52 | cmp sample1.bz2 sample1.rb2 |
---|
53 | cmp sample2.bz2 sample2.rb2 |
---|
54 | cmp sample3.bz2 sample3.rb2 |
---|
55 | cmp sample1.tst sample1.ref |
---|
56 | cmp sample2.tst sample2.ref |
---|
57 | cmp sample3.tst sample3.ref |
---|
58 | @cat words3 |
---|
59 | |
---|
60 | install: bzip2 bzip2recover |
---|
61 | if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi |
---|
62 | if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi |
---|
63 | if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi |
---|
64 | if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi |
---|
65 | if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi |
---|
66 | cp -f bzip2 $(PREFIX)/bin/bzip2 |
---|
67 | cp -f bzip2 $(PREFIX)/bin/bunzip2 |
---|
68 | cp -f bzip2 $(PREFIX)/bin/bzcat |
---|
69 | cp -f bzip2recover $(PREFIX)/bin/bzip2recover |
---|
70 | chmod a+x $(PREFIX)/bin/bzip2 |
---|
71 | chmod a+x $(PREFIX)/bin/bunzip2 |
---|
72 | chmod a+x $(PREFIX)/bin/bzcat |
---|
73 | chmod a+x $(PREFIX)/bin/bzip2recover |
---|
74 | cp -f bzip2.1 $(PREFIX)/man/man1 |
---|
75 | chmod a+r $(PREFIX)/man/man1/bzip2.1 |
---|
76 | cp -f bzlib.h $(PREFIX)/include |
---|
77 | chmod a+r $(PREFIX)/include/bzlib.h |
---|
78 | cp -f libbz2.a $(PREFIX)/lib |
---|
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 |
---|
98 | |
---|
99 | distclean: clean |
---|
100 | clean: |
---|
101 | rm -f *.o libbz2.a bzip2 bzip2recover \ |
---|
102 | sample1.rb2 sample2.rb2 sample3.rb2 \ |
---|
103 | sample1.tst sample2.tst sample3.tst |
---|
104 | |
---|
105 | blocksort.o: blocksort.c |
---|
106 | @cat words0 |
---|
107 | $(CC) $(CFLAGS) -c blocksort.c |
---|
108 | huffman.o: huffman.c |
---|
109 | $(CC) $(CFLAGS) -c huffman.c |
---|
110 | crctable.o: crctable.c |
---|
111 | $(CC) $(CFLAGS) -c crctable.c |
---|
112 | randtable.o: randtable.c |
---|
113 | $(CC) $(CFLAGS) -c randtable.c |
---|
114 | compress.o: compress.c |
---|
115 | $(CC) $(CFLAGS) -c compress.c |
---|
116 | decompress.o: decompress.c |
---|
117 | $(CC) $(CFLAGS) -c decompress.c |
---|
118 | bzlib.o: bzlib.c |
---|
119 | $(CC) $(CFLAGS) -c bzlib.c |
---|
120 | bzip2.o: bzip2.c |
---|
121 | $(CC) $(CFLAGS) -c bzip2.c |
---|
122 | bzip2recover.o: bzip2recover.c |
---|
123 | $(CC) $(CFLAGS) -c bzip2recover.c |
---|
124 | |
---|
125 | DISTNAME=bzip2-1.0.2 |
---|
126 | tarfile: |
---|
127 | rm -f $(DISTNAME) |
---|
128 | ln -sf . $(DISTNAME) |
---|
129 | tar cvf $(DISTNAME).tar \ |
---|
130 | $(DISTNAME)/blocksort.c \ |
---|
131 | $(DISTNAME)/huffman.c \ |
---|
132 | $(DISTNAME)/crctable.c \ |
---|
133 | $(DISTNAME)/randtable.c \ |
---|
134 | $(DISTNAME)/compress.c \ |
---|
135 | $(DISTNAME)/decompress.c \ |
---|
136 | $(DISTNAME)/bzlib.c \ |
---|
137 | $(DISTNAME)/bzip2.c \ |
---|
138 | $(DISTNAME)/bzip2recover.c \ |
---|
139 | $(DISTNAME)/bzlib.h \ |
---|
140 | $(DISTNAME)/bzlib_private.h \ |
---|
141 | $(DISTNAME)/Makefile \ |
---|
142 | $(DISTNAME)/manual.texi \ |
---|
143 | $(DISTNAME)/manual.ps \ |
---|
144 | $(DISTNAME)/manual.pdf \ |
---|
145 | $(DISTNAME)/LICENSE \ |
---|
146 | $(DISTNAME)/bzip2.1 \ |
---|
147 | $(DISTNAME)/bzip2.1.preformatted \ |
---|
148 | $(DISTNAME)/bzip2.txt \ |
---|
149 | $(DISTNAME)/words0 \ |
---|
150 | $(DISTNAME)/words1 \ |
---|
151 | $(DISTNAME)/words2 \ |
---|
152 | $(DISTNAME)/words3 \ |
---|
153 | $(DISTNAME)/sample1.ref \ |
---|
154 | $(DISTNAME)/sample2.ref \ |
---|
155 | $(DISTNAME)/sample3.ref \ |
---|
156 | $(DISTNAME)/sample1.bz2 \ |
---|
157 | $(DISTNAME)/sample2.bz2 \ |
---|
158 | $(DISTNAME)/sample3.bz2 \ |
---|
159 | $(DISTNAME)/dlltest.c \ |
---|
160 | $(DISTNAME)/*.html \ |
---|
161 | $(DISTNAME)/README \ |
---|
162 | $(DISTNAME)/README.COMPILATION.PROBLEMS \ |
---|
163 | $(DISTNAME)/CHANGES \ |
---|
164 | $(DISTNAME)/libbz2.def \ |
---|
165 | $(DISTNAME)/libbz2.dsp \ |
---|
166 | $(DISTNAME)/dlltest.dsp \ |
---|
167 | $(DISTNAME)/makefile.msc \ |
---|
168 | $(DISTNAME)/Y2K_INFO \ |
---|
169 | $(DISTNAME)/unzcrash.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 \ |
---|
178 | $(DISTNAME)/Makefile-libbz2_so |
---|
179 | gzip -v $(DISTNAME).tar |
---|
180 | |
---|
181 | # For rebuilding the manual from sources on my RedHat 7.2 box |
---|
182 | manual: manual.ps manual.pdf manual.html |
---|
183 | |
---|
184 | manual.ps: manual.texi |
---|
185 | tex manual.texi |
---|
186 | dvips -o manual.ps manual.dvi |
---|
187 | |
---|
188 | manual.pdf: manual.ps |
---|
189 | ps2pdf manual.ps |
---|
190 | |
---|
191 | manual.html: manual.texi |
---|
192 | texi2html -split_chapter manual.texi |
---|