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