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 21 22# Where you want it installed when you do 'make install' 23PREFIX=/usr/local 24 25 26OBJS= blocksort.o \ 27 huffman.o \ 28 crctable.o \ 29 randtable.o \ 30 compress.o \ 31 decompress.o \ 32 bzlib.o 33 34all: libbz2.a bzip2 bzip2recover test 35 36bzip2: libbz2.a bzip2.o 37 $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2 38 39bzip2recover: bzip2recover.o 40 $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o 41 42libbz2.a: $(OBJS) 43 rm -f libbz2.a 44 $(AR) cq libbz2.a $(OBJS) 45 @if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \ 46 -f /bin/ranlib -o -f /usr/ccs/bin/ranlib ) ; then \ 47 echo $(RANLIB) libbz2.a ; \ 48 $(RANLIB) libbz2.a ; \ 49 fi 50 51check: test 52test: bzip2 53 @cat words1 54 ./bzip2 -1 < sample1.ref > sample1.rb2 55 ./bzip2 -2 < sample2.ref > sample2.rb2 56 ./bzip2 -3 < sample3.ref > sample3.rb2 57 ./bzip2 -d < sample1.bz2 > sample1.tst 58 ./bzip2 -d < sample2.bz2 > sample2.tst 59 ./bzip2 -ds < sample3.bz2 > sample3.tst 60 cmp sample1.bz2 sample1.rb2 61 cmp sample2.bz2 sample2.rb2 62 cmp sample3.bz2 sample3.rb2 63 cmp sample1.tst sample1.ref 64 cmp sample2.tst sample2.ref 65 cmp sample3.tst sample3.ref 66 @cat words3 67 68install: bzip2 bzip2recover 69 if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi 70 if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi 71 if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi 72 if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi 73 if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi 74 cp -f bzip2 $(PREFIX)/bin/bzip2 75 cp -f bzip2 $(PREFIX)/bin/bunzip2 76 cp -f bzip2 $(PREFIX)/bin/bzcat 77 cp -f bzip2recover $(PREFIX)/bin/bzip2recover 78 chmod a+x $(PREFIX)/bin/bzip2 79 chmod a+x $(PREFIX)/bin/bunzip2 80 chmod a+x $(PREFIX)/bin/bzcat 81 chmod a+x $(PREFIX)/bin/bzip2recover 82 cp -f bzip2.1 $(PREFIX)/man/man1 83 chmod a+r $(PREFIX)/man/man1/bzip2.1 84 cp -f bzlib.h $(PREFIX)/include 85 chmod a+r $(PREFIX)/include/bzlib.h 86 cp -f libbz2.a $(PREFIX)/lib 87 chmod a+r $(PREFIX)/lib/libbz2.a 88 cp -f bzgrep $(PREFIX)/bin/bzgrep 89 ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep 90 ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep 91 chmod a+x $(PREFIX)/bin/bzgrep 92 cp -f bzmore $(PREFIX)/bin/bzmore 93 ln -s -f $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless 94 chmod a+x $(PREFIX)/bin/bzmore 95 cp -f bzdiff $(PREFIX)/bin/bzdiff 96 ln -s -f $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp 97 chmod a+x $(PREFIX)/bin/bzdiff 98 cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1 99 chmod a+r $(PREFIX)/man/man1/bzgrep.1 100 chmod a+r $(PREFIX)/man/man1/bzmore.1 101 chmod a+r $(PREFIX)/man/man1/bzdiff.1 102 echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzegrep.1 103 echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzfgrep.1 104 echo ".so man1/bzmore.1" > $(PREFIX)/man/man1/bzless.1 105 echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1 106 107clean: 108 rm -f *.o libbz2.a bzip2 bzip2recover \ 109 sample1.rb2 sample2.rb2 sample3.rb2 \ 110 sample1.tst sample2.tst sample3.tst 111 112blocksort.o: blocksort.c 113 @cat words0 114 $(CC) $(CFLAGS) -c blocksort.c 115huffman.o: huffman.c 116 $(CC) $(CFLAGS) -c huffman.c 117crctable.o: crctable.c 118 $(CC) $(CFLAGS) -c crctable.c 119randtable.o: randtable.c 120 $(CC) $(CFLAGS) -c randtable.c 121compress.o: compress.c 122 $(CC) $(CFLAGS) -c compress.c 123decompress.o: decompress.c 124 $(CC) $(CFLAGS) -c decompress.c 125bzlib.o: bzlib.c 126 $(CC) $(CFLAGS) -c bzlib.c 127bzip2.o: bzip2.c 128 $(CC) $(CFLAGS) -c bzip2.c 129bzip2recover.o: bzip2recover.c 130 $(CC) $(CFLAGS) -c bzip2recover.c 131 132 133distclean: clean 134 rm -f manual.ps manual.html manual.pdf 135 136DISTNAME=bzip2-1.0.8 137dist: check manual 138 rm -f $(DISTNAME) 139 ln -s -f . $(DISTNAME) 140 tar cvf $(DISTNAME).tar \ 141 $(DISTNAME)/blocksort.c \ 142 $(DISTNAME)/huffman.c \ 143 $(DISTNAME)/crctable.c \ 144 $(DISTNAME)/randtable.c \ 145 $(DISTNAME)/compress.c \ 146 $(DISTNAME)/decompress.c \ 147 $(DISTNAME)/bzlib.c \ 148 $(DISTNAME)/bzip2.c \ 149 $(DISTNAME)/bzip2recover.c \ 150 $(DISTNAME)/bzlib.h \ 151 $(DISTNAME)/bzlib_private.h \ 152 $(DISTNAME)/Makefile \ 153 $(DISTNAME)/LICENSE \ 154 $(DISTNAME)/bzip2.1 \ 155 $(DISTNAME)/bzip2.1.preformatted \ 156 $(DISTNAME)/bzip2.txt \ 157 $(DISTNAME)/words0 \ 158 $(DISTNAME)/words1 \ 159 $(DISTNAME)/words2 \ 160 $(DISTNAME)/words3 \ 161 $(DISTNAME)/sample1.ref \ 162 $(DISTNAME)/sample2.ref \ 163 $(DISTNAME)/sample3.ref \ 164 $(DISTNAME)/sample1.bz2 \ 165 $(DISTNAME)/sample2.bz2 \ 166 $(DISTNAME)/sample3.bz2 \ 167 $(DISTNAME)/dlltest.c \ 168 $(DISTNAME)/manual.html \ 169 $(DISTNAME)/manual.pdf \ 170 $(DISTNAME)/manual.ps \ 171 $(DISTNAME)/README \ 172 $(DISTNAME)/README.COMPILATION.PROBLEMS \ 173 $(DISTNAME)/README.XML.STUFF \ 174 $(DISTNAME)/CHANGES \ 175 $(DISTNAME)/libbz2.def \ 176 $(DISTNAME)/libbz2.dsp \ 177 $(DISTNAME)/dlltest.dsp \ 178 $(DISTNAME)/makefile.msc \ 179 $(DISTNAME)/unzcrash.c \ 180 $(DISTNAME)/spewG.c \ 181 $(DISTNAME)/mk251.c \ 182 $(DISTNAME)/bzdiff \ 183 $(DISTNAME)/bzdiff.1 \ 184 $(DISTNAME)/bzmore \ 185 $(DISTNAME)/bzmore.1 \ 186 $(DISTNAME)/bzgrep \ 187 $(DISTNAME)/bzgrep.1 \ 188 $(DISTNAME)/Makefile-libbz2_so \ 189 $(DISTNAME)/bz-common.xsl \ 190 $(DISTNAME)/bz-fo.xsl \ 191 $(DISTNAME)/bz-html.xsl \ 192 $(DISTNAME)/bzip.css \ 193 $(DISTNAME)/entities.xml \ 194 $(DISTNAME)/manual.xml \ 195 $(DISTNAME)/format.pl \ 196 $(DISTNAME)/xmlproc.sh 197 gzip -v $(DISTNAME).tar 198 199# For rebuilding the manual from sources on my SuSE 9.1 box 200 201MANUAL_SRCS= bz-common.xsl bz-fo.xsl bz-html.xsl bzip.css \ 202 entities.xml manual.xml 203 204manual: manual.html manual.ps manual.pdf 205 206manual.ps: $(MANUAL_SRCS) 207 ./xmlproc.sh -ps manual.xml 208 209manual.pdf: $(MANUAL_SRCS) 210 ./xmlproc.sh -pdf manual.xml 211 212manual.html: $(MANUAL_SRCS) 213 ./xmlproc.sh -html manual.xml 214