1# ------------------------------------------------------------------ 2# This file is part of bzip2/libbzip2, a program and library for 3# lossless, block-sorting data compression. 4# 5# bzip2/libbzip2 version 1.0.8 of 13 July 2019 6# Copyright (C) 1996-2019 Julian Seward <jseward@acm.org> 7# 8# Please read the WARNING, DISCLAIMER and PATENTS sections in the 9# README file. 10# 11# This program is released under the terms of the license contained 12# in the file LICENSE. 13# ------------------------------------------------------------------ 14 15SHELL=/bin/sh 16 17# To assist in cross-compiling 18CC?=gcc 19AR=ar 20RANLIB=ranlib 21LDFLAGS= 22 23BIGFILES=-D_FILE_OFFSET_BITS=64 24CFLAGS?=-O2 25CFLAGS+=-Wall -Winline -fomit-frame-pointer -fno-strength-reduce $(BIGFILES) 26SOFLAGS=-fPIC -fpic -DPIC 27 28# Where you want it installed when you do 'make install' 29PREFIX=/usr/local 30 31 32OBJS= blocksort.o \ 33 huffman.o \ 34 crctable.o \ 35 randtable.o \ 36 compress.o \ 37 decompress.o \ 38 bzlib.o 39 40SO_OBJS= blocksort.so \ 41 huffman.so \ 42 crctable.so \ 43 randtable.so \ 44 compress.so \ 45 decompress.so \ 46 bzlib.so 47 48all: libbz2.so.1 libbz2.a bzip2 bzip2recover test 49 50bzip2: libbz2.so.1 libbz2.a bzip2.o 51 $(CC) $(CFLAGS) -o bzip2 bzip2.o libbz2.a 52 53bzip2recover: bzip2recover.o 54 $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o 55 56libbz2.a: $(OBJS) 57 rm -f libbz2.a 58 $(AR) cq libbz2.a $(OBJS) 59 @if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \ 60 -f /bin/ranlib -o -f /usr/ccs/bin/ranlib ) ; then \ 61 echo $(RANLIB) libbz2.a ; \ 62 $(RANLIB) libbz2.a ; \ 63 fi 64 65libbz2.so.1: $(SO_OBJS) 66 $(CC) -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1 $(SO_OBJS) 67 ln -sf libbz2.so.1 libbz2.so 68 69check: test 70test: bzip2 71 @cat words1 72 ./bzip2 -1 < sample1.ref > sample1.rb2 73 ./bzip2 -2 < sample2.ref > sample2.rb2 74 ./bzip2 -3 < sample3.ref > sample3.rb2 75 ./bzip2 -d < sample1.bz2 > sample1.tst 76 ./bzip2 -d < sample2.bz2 > sample2.tst 77 ./bzip2 -ds < sample3.bz2 > sample3.tst 78 cmp sample1.bz2 sample1.rb2 79 cmp sample2.bz2 sample2.rb2 80 cmp sample3.bz2 sample3.rb2 81 cmp sample1.tst sample1.ref 82 cmp sample2.tst sample2.ref 83 cmp sample3.tst sample3.ref 84 @cat words3 85 86install: bzip2 bzip2recover 87 if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi 88 if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi 89 if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi 90 if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi 91 if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi 92 cp -f bzip2 $(PREFIX)/bin/bzip2 93 cp -f bzip2 $(PREFIX)/bin/bunzip2 94 cp -f bzip2 $(PREFIX)/bin/bzcat 95 cp -f bzip2recover $(PREFIX)/bin/bzip2recover 96 chmod a+x $(PREFIX)/bin/bzip2 97 chmod a+x $(PREFIX)/bin/bunzip2 98 chmod a+x $(PREFIX)/bin/bzcat 99 chmod a+x $(PREFIX)/bin/bzip2recover 100 cp -f bzip2.1 $(PREFIX)/man/man1 101 chmod a+r $(PREFIX)/man/man1/bzip2.1 102 cp -f bzlib.h $(PREFIX)/include 103 chmod a+r $(PREFIX)/include/bzlib.h 104 cp -f libbz2.a $(PREFIX)/lib 105 chmod a+r $(PREFIX)/lib/libbz2.a 106 cp -f bzgrep $(PREFIX)/bin/bzgrep 107 ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep 108 ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep 109 chmod a+x $(PREFIX)/bin/bzgrep 110 cp -f bzmore $(PREFIX)/bin/bzmore 111 ln -s -f $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless 112 chmod a+x $(PREFIX)/bin/bzmore 113 cp -f bzdiff $(PREFIX)/bin/bzdiff 114 ln -s -f $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp 115 chmod a+x $(PREFIX)/bin/bzdiff 116 cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1 117 chmod a+r $(PREFIX)/man/man1/bzgrep.1 118 chmod a+r $(PREFIX)/man/man1/bzmore.1 119 chmod a+r $(PREFIX)/man/man1/bzdiff.1 120 echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzegrep.1 121 echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzfgrep.1 122 echo ".so man1/bzmore.1" > $(PREFIX)/man/man1/bzless.1 123 echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1 124 125clean: 126 rm -f *.o *.so libbz2.a libbz2.so.1 bzip2 bzip2recover \ 127 sample1.rb2 sample2.rb2 sample3.rb2 \ 128 sample1.tst sample2.tst sample3.tst 129 130blocksort.so: blocksort.c 131 @cat words0 132 $(CC) $(CFLAGS) $(SOFLAGS) -c blocksort.c -o blocksort.so 133huffman.so: huffman.c 134 $(CC) $(CFLAGS) $(SOFLAGS) -c huffman.c -o huffman.so 135crctable.so: crctable.c 136 $(CC) $(CFLAGS) $(SOFLAGS) -c crctable.c -o crctable.so 137randtable.so: randtable.c 138 $(CC) $(CFLAGS) $(SOFLAGS) -c randtable.c -o randtable.so 139compress.so: compress.c 140 $(CC) $(CFLAGS) $(SOFLAGS) -c compress.c -o compress.so 141decompress.so: decompress.c 142 $(CC) $(CFLAGS) $(SOFLAGS) -c decompress.c -o decompress.so 143bzlib.so: bzlib.c 144 $(CC) $(CFLAGS) $(SOFLAGS) -c bzlib.c -o bzlib.so 145 146blocksort.o: blocksort.c 147 @cat words0 148 $(CC) $(CFLAGS) -c blocksort.c 149huffman.o: huffman.c 150 $(CC) $(CFLAGS) -c huffman.c 151crctable.o: crctable.c 152 $(CC) $(CFLAGS) -c crctable.c 153randtable.o: randtable.c 154 $(CC) $(CFLAGS) -c randtable.c 155compress.o: compress.c 156 $(CC) $(CFLAGS) -c compress.c 157decompress.o: decompress.c 158 $(CC) $(CFLAGS) -c decompress.c 159bzlib.o: bzlib.c 160 $(CC) $(CFLAGS) -c bzlib.c 161bzip2.o: bzip2.c 162 $(CC) $(CFLAGS) -c bzip2.c 163bzip2recover.o: bzip2recover.c 164 $(CC) $(CFLAGS) -c bzip2recover.c 165 166 167distclean: clean 168 rm -f manual.ps manual.html manual.pdf 169 170DISTNAME=bzip2-1.0.8 171dist: check manual 172 rm -f $(DISTNAME) 173 ln -s -f . $(DISTNAME) 174 tar cvf $(DISTNAME).tar \ 175 $(DISTNAME)/blocksort.c \ 176 $(DISTNAME)/huffman.c \ 177 $(DISTNAME)/crctable.c \ 178 $(DISTNAME)/randtable.c \ 179 $(DISTNAME)/compress.c \ 180 $(DISTNAME)/decompress.c \ 181 $(DISTNAME)/bzlib.c \ 182 $(DISTNAME)/bzip2.c \ 183 $(DISTNAME)/bzip2recover.c \ 184 $(DISTNAME)/bzlib.h \ 185 $(DISTNAME)/bzlib_private.h \ 186 $(DISTNAME)/Makefile \ 187 $(DISTNAME)/LICENSE \ 188 $(DISTNAME)/bzip2.1 \ 189 $(DISTNAME)/bzip2.1.preformatted \ 190 $(DISTNAME)/bzip2.txt \ 191 $(DISTNAME)/words0 \ 192 $(DISTNAME)/words1 \ 193 $(DISTNAME)/words2 \ 194 $(DISTNAME)/words3 \ 195 $(DISTNAME)/sample1.ref \ 196 $(DISTNAME)/sample2.ref \ 197 $(DISTNAME)/sample3.ref \ 198 $(DISTNAME)/sample1.bz2 \ 199 $(DISTNAME)/sample2.bz2 \ 200 $(DISTNAME)/sample3.bz2 \ 201 $(DISTNAME)/dlltest.c \ 202 $(DISTNAME)/manual.html \ 203 $(DISTNAME)/manual.pdf \ 204 $(DISTNAME)/manual.ps \ 205 $(DISTNAME)/README \ 206 $(DISTNAME)/README.COMPILATION.PROBLEMS \ 207 $(DISTNAME)/README.XML.STUFF \ 208 $(DISTNAME)/CHANGES \ 209 $(DISTNAME)/libbz2.def \ 210 $(DISTNAME)/libbz2.dsp \ 211 $(DISTNAME)/dlltest.dsp \ 212 $(DISTNAME)/makefile.msc \ 213 $(DISTNAME)/unzcrash.c \ 214 $(DISTNAME)/spewG.c \ 215 $(DISTNAME)/mk251.c \ 216 $(DISTNAME)/bzdiff \ 217 $(DISTNAME)/bzdiff.1 \ 218 $(DISTNAME)/bzmore \ 219 $(DISTNAME)/bzmore.1 \ 220 $(DISTNAME)/bzgrep \ 221 $(DISTNAME)/bzgrep.1 \ 222 $(DISTNAME)/Makefile-libbz2_so \ 223 $(DISTNAME)/bz-common.xsl \ 224 $(DISTNAME)/bz-fo.xsl \ 225 $(DISTNAME)/bz-html.xsl \ 226 $(DISTNAME)/bzip.css \ 227 $(DISTNAME)/entities.xml \ 228 $(DISTNAME)/manual.xml \ 229 $(DISTNAME)/format.pl \ 230 $(DISTNAME)/xmlproc.sh 231 gzip -v $(DISTNAME).tar 232 233# For rebuilding the manual from sources on my SuSE 9.1 box 234 235MANUAL_SRCS= bz-common.xsl bz-fo.xsl bz-html.xsl bzip.css \ 236 entities.xml manual.xml 237 238manual: manual.html manual.ps manual.pdf 239 240manual.ps: $(MANUAL_SRCS) 241 ./xmlproc.sh -ps manual.xml 242 243manual.pdf: $(MANUAL_SRCS) 244 ./xmlproc.sh -pdf manual.xml 245 246manual.html: $(MANUAL_SRCS) 247 ./xmlproc.sh -html manual.xml 248