4 # To assist in cross-compiling
10 BIGFILES=-D_FILE_OFFSET_BITS=64
11 CFLAGS=-Wall -Winline -O -g $(BIGFILES)
13 # Where you want it installed when you do 'make install'
25 all: libbz2.a bzip2 bzip2recover test
27 bzip2: libbz2.a bzip2.o
28 $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2
30 bzip2recover: bzip2recover.o
31 $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o
35 $(AR) cq libbz2.a $(OBJS)
36 @if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \
37 -f /bin/ranlib -o -f /usr/ccs/bin/ranlib ) ; then \
38 echo $(RANLIB) libbz2.a ; \
39 $(RANLIB) libbz2.a ; \
45 ./bzip2 -1 < sample1.ref > sample1.rb2
46 ./bzip2 -2 < sample2.ref > sample2.rb2
47 ./bzip2 -3 < sample3.ref > sample3.rb2
48 ./bzip2 -d < sample1.bz2 > sample1.tst
49 ./bzip2 -d < sample2.bz2 > sample2.tst
50 ./bzip2 -ds < sample3.bz2 > sample3.tst
51 cmp sample1.bz2 sample1.rb2
52 cmp sample2.bz2 sample2.rb2
53 cmp sample3.bz2 sample3.rb2
54 cmp sample1.tst sample1.ref
55 cmp sample2.tst sample2.ref
56 cmp sample3.tst sample3.ref
59 install: bzip2 bzip2recover
60 if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi
61 if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi
62 if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi
63 if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi
64 if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi
65 cp -f bzip2 $(PREFIX)/bin/bzip2
66 cp -f bzip2 $(PREFIX)/bin/bunzip2
67 cp -f bzip2 $(PREFIX)/bin/bzcat
68 cp -f bzip2recover $(PREFIX)/bin/bzip2recover
69 chmod a+x $(PREFIX)/bin/bzip2
70 chmod a+x $(PREFIX)/bin/bunzip2
71 chmod a+x $(PREFIX)/bin/bzcat
72 chmod a+x $(PREFIX)/bin/bzip2recover
73 cp -f bzip2.1 $(PREFIX)/man/man1
74 chmod a+r $(PREFIX)/man/man1/bzip2.1
75 cp -f bzlib.h $(PREFIX)/include
76 chmod a+r $(PREFIX)/include/bzlib.h
77 cp -f libbz2.a $(PREFIX)/lib
78 chmod a+r $(PREFIX)/lib/libbz2.a
79 cp -f bzgrep $(PREFIX)/bin/bzgrep
80 ln $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep
81 ln $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep
82 chmod a+x $(PREFIX)/bin/bzgrep
83 cp -f bzmore $(PREFIX)/bin/bzmore
84 ln $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless
85 chmod a+x $(PREFIX)/bin/bzmore
86 cp -f bzdiff $(PREFIX)/bin/bzdiff
87 ln $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp
88 chmod a+x $(PREFIX)/bin/bzdiff
89 cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1
90 chmod a+r $(PREFIX)/man/man1/bzgrep.1
91 chmod a+r $(PREFIX)/man/man1/bzmore.1
92 chmod a+r $(PREFIX)/man/man1/bzdiff.1
93 echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzegrep.1
94 echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzfgrep.1
95 echo ".so man1/bzmore.1" > $(PREFIX)/man/man1/bzless.1
96 echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1
99 rm -f *.o libbz2.a bzip2 bzip2recover \
100 sample1.rb2 sample2.rb2 sample3.rb2 \
101 sample1.tst sample2.tst sample3.tst
103 blocksort.o: blocksort.c
105 $(CC) $(CFLAGS) -c blocksort.c
107 $(CC) $(CFLAGS) -c huffman.c
108 crctable.o: crctable.c
109 $(CC) $(CFLAGS) -c crctable.c
110 randtable.o: randtable.c
111 $(CC) $(CFLAGS) -c randtable.c
112 compress.o: compress.c
113 $(CC) $(CFLAGS) -c compress.c
114 decompress.o: decompress.c
115 $(CC) $(CFLAGS) -c decompress.c
117 $(CC) $(CFLAGS) -c bzlib.c
119 $(CC) $(CFLAGS) -c bzip2.c
120 bzip2recover.o: bzip2recover.c
121 $(CC) $(CFLAGS) -c bzip2recover.c
125 rm -f manual.ps manual.html manual.pdf
131 tar cvf $(DISTNAME).tar \
132 $(DISTNAME)/blocksort.c \
133 $(DISTNAME)/huffman.c \
134 $(DISTNAME)/crctable.c \
135 $(DISTNAME)/randtable.c \
136 $(DISTNAME)/compress.c \
137 $(DISTNAME)/decompress.c \
138 $(DISTNAME)/bzlib.c \
139 $(DISTNAME)/bzip2.c \
140 $(DISTNAME)/bzip2recover.c \
141 $(DISTNAME)/bzlib.h \
142 $(DISTNAME)/bzlib_private.h \
143 $(DISTNAME)/Makefile \
144 $(DISTNAME)/LICENSE \
145 $(DISTNAME)/bzip2.1 \
146 $(DISTNAME)/bzip2.1.preformatted \
147 $(DISTNAME)/bzip2.txt \
152 $(DISTNAME)/sample1.ref \
153 $(DISTNAME)/sample2.ref \
154 $(DISTNAME)/sample3.ref \
155 $(DISTNAME)/sample1.bz2 \
156 $(DISTNAME)/sample2.bz2 \
157 $(DISTNAME)/sample3.bz2 \
158 $(DISTNAME)/dlltest.c \
159 $(DISTNAME)/manual.html \
160 $(DISTNAME)/manual.pdf \
161 $(DISTNAME)/manual.ps \
163 $(DISTNAME)/README.COMPILATION.PROBLEMS \
164 $(DISTNAME)/README.XML.STUFF \
165 $(DISTNAME)/CHANGES \
166 $(DISTNAME)/libbz2.def \
167 $(DISTNAME)/libbz2.dsp \
168 $(DISTNAME)/dlltest.dsp \
169 $(DISTNAME)/makefile.msc \
170 $(DISTNAME)/Y2K_INFO \
171 $(DISTNAME)/unzcrash.c \
172 $(DISTNAME)/spewG.c \
173 $(DISTNAME)/mk251.c \
175 $(DISTNAME)/bzdiff.1 \
177 $(DISTNAME)/bzmore.1 \
179 $(DISTNAME)/bzgrep.1 \
180 $(DISTNAME)/Makefile-libbz2_so \
181 $(DISTNAME)/bz-common.xsl \
182 $(DISTNAME)/bz-fo.xsl \
183 $(DISTNAME)/bz-html.xsl \
184 $(DISTNAME)/bzip.css \
185 $(DISTNAME)/entities.xml \
186 $(DISTNAME)/manual.xml \
187 $(DISTNAME)/format.pl \
188 $(DISTNAME)/xmlproc.sh
189 gzip -v $(DISTNAME).tar
191 # For rebuilding the manual from sources on my SuSE 9.1 box
193 MANUAL_SRCS= bz-common.xsl bz-fo.xsl bz-html.xsl bzip.css \
194 entities.xml manual.xml
196 manual: manual.html manual.ps manual.pdf
198 manual.ps: $(MANUAL_SRCS)
199 ./xmlproc.sh -ps manual.xml
201 manual.pdf: $(MANUAL_SRCS)
202 ./xmlproc.sh -pdf manual.xml
204 manual.html: $(MANUAL_SRCS)
205 ./xmlproc.sh -html manual.xml