4 # To assist in cross-compiling
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)
14 # Where you want it installed when you do 'make install'
26 all: libbz2.a bzip2 bzip2recover test
28 bzip2: libbz2.a bzip2.o
29 $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2
31 bzip2recover: bzip2recover.o
32 $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o
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 ; \
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
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
101 rm -f *.o libbz2.a bzip2 bzip2recover \
102 sample1.rb2 sample2.rb2 sample3.rb2 \
103 sample1.tst sample2.tst sample3.tst
105 blocksort.o: blocksort.c
107 $(CC) $(CFLAGS) -c blocksort.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
119 $(CC) $(CFLAGS) -c bzlib.c
121 $(CC) $(CFLAGS) -c bzip2.c
122 bzip2recover.o: bzip2recover.c
123 $(CC) $(CFLAGS) -c bzip2recover.c
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 \
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 \
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 \
173 $(DISTNAME)/bzdiff.1 \
175 $(DISTNAME)/bzmore.1 \
177 $(DISTNAME)/bzgrep.1 \
178 $(DISTNAME)/Makefile-libbz2_so
179 gzip -v $(DISTNAME).tar
181 # For rebuilding the manual from sources on my RedHat 7.2 box
182 manual: manual.ps manual.pdf manual.html
184 manual.ps: manual.texi
186 dvips -o manual.ps manual.dvi
188 manual.pdf: manual.ps
191 manual.html: manual.texi
192 texi2html -split_chapter manual.texi