1167974Sdelphij# ------------------------------------------------------------------
2167974Sdelphij# This file is part of bzip2/libbzip2, a program and library for
3167974Sdelphij# lossless, block-sorting data compression.
4167974Sdelphij#
5215041Sobrien# bzip2/libbzip2 version 1.0.6 of 6 September 2010
6215041Sobrien# Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
7167974Sdelphij#
8167974Sdelphij# Please read the WARNING, DISCLAIMER and PATENTS sections in the 
9167974Sdelphij# README file.
10167974Sdelphij#
11167974Sdelphij# This program is released under the terms of the license contained
12167974Sdelphij# in the file LICENSE.
13167974Sdelphij# ------------------------------------------------------------------
1478556Sobrien
1578556SobrienSHELL=/bin/sh
1690067Ssobomax
1790067Ssobomax# To assist in cross-compiling
1878556SobrienCC=gcc
1990067SsobomaxAR=ar
2090067SsobomaxRANLIB=ranlib
2190067SsobomaxLDFLAGS=
2290067Ssobomax
2378556SobrienBIGFILES=-D_FILE_OFFSET_BITS=64
24167974SdelphijCFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
2578556Sobrien
2690067Ssobomax# Where you want it installed when you do 'make install'
27167974SdelphijPREFIX=/usr/local
2890067Ssobomax
2990067Ssobomax
3078556SobrienOBJS= blocksort.o  \
3178556Sobrien      huffman.o    \
3278556Sobrien      crctable.o   \
3378556Sobrien      randtable.o  \
3478556Sobrien      compress.o   \
3578556Sobrien      decompress.o \
3678556Sobrien      bzlib.o
3778556Sobrien
3878556Sobrienall: libbz2.a bzip2 bzip2recover test
3978556Sobrien
4078556Sobrienbzip2: libbz2.a bzip2.o
4190067Ssobomax	$(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2
4278556Sobrien
4378556Sobrienbzip2recover: bzip2recover.o
4490067Ssobomax	$(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o
4578556Sobrien
4678556Sobrienlibbz2.a: $(OBJS)
4778556Sobrien	rm -f libbz2.a
4890067Ssobomax	$(AR) cq libbz2.a $(OBJS)
4990067Ssobomax	@if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \
5090067Ssobomax		-f /bin/ranlib -o -f /usr/ccs/bin/ranlib ) ; then \
5190067Ssobomax		echo $(RANLIB) libbz2.a ; \
5290067Ssobomax		$(RANLIB) libbz2.a ; \
5378556Sobrien	fi
5478556Sobrien
5590067Ssobomaxcheck: test
5678556Sobrientest: bzip2
5778556Sobrien	@cat words1
5878556Sobrien	./bzip2 -1  < sample1.ref > sample1.rb2
5978556Sobrien	./bzip2 -2  < sample2.ref > sample2.rb2
6078556Sobrien	./bzip2 -3  < sample3.ref > sample3.rb2
6178556Sobrien	./bzip2 -d  < sample1.bz2 > sample1.tst
6278556Sobrien	./bzip2 -d  < sample2.bz2 > sample2.tst
6378556Sobrien	./bzip2 -ds < sample3.bz2 > sample3.tst
6478556Sobrien	cmp sample1.bz2 sample1.rb2 
6578556Sobrien	cmp sample2.bz2 sample2.rb2
6678556Sobrien	cmp sample3.bz2 sample3.rb2
6778556Sobrien	cmp sample1.tst sample1.ref
6878556Sobrien	cmp sample2.tst sample2.ref
6978556Sobrien	cmp sample3.tst sample3.ref
7078556Sobrien	@cat words3
7178556Sobrien
7278556Sobrieninstall: bzip2 bzip2recover
7390067Ssobomax	if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi
7490067Ssobomax	if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi
7590067Ssobomax	if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi
7690067Ssobomax	if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi
7790067Ssobomax	if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi
7878556Sobrien	cp -f bzip2 $(PREFIX)/bin/bzip2
7978556Sobrien	cp -f bzip2 $(PREFIX)/bin/bunzip2
8078556Sobrien	cp -f bzip2 $(PREFIX)/bin/bzcat
8178556Sobrien	cp -f bzip2recover $(PREFIX)/bin/bzip2recover
8278556Sobrien	chmod a+x $(PREFIX)/bin/bzip2
8378556Sobrien	chmod a+x $(PREFIX)/bin/bunzip2
8478556Sobrien	chmod a+x $(PREFIX)/bin/bzcat
8578556Sobrien	chmod a+x $(PREFIX)/bin/bzip2recover
8678556Sobrien	cp -f bzip2.1 $(PREFIX)/man/man1
8778556Sobrien	chmod a+r $(PREFIX)/man/man1/bzip2.1
8878556Sobrien	cp -f bzlib.h $(PREFIX)/include
8978556Sobrien	chmod a+r $(PREFIX)/include/bzlib.h
9078556Sobrien	cp -f libbz2.a $(PREFIX)/lib
9178556Sobrien	chmod a+r $(PREFIX)/lib/libbz2.a
9290067Ssobomax	cp -f bzgrep $(PREFIX)/bin/bzgrep
93167974Sdelphij	ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep
94167974Sdelphij	ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep
9590067Ssobomax	chmod a+x $(PREFIX)/bin/bzgrep
9690067Ssobomax	cp -f bzmore $(PREFIX)/bin/bzmore
97167974Sdelphij	ln -s -f $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless
9890067Ssobomax	chmod a+x $(PREFIX)/bin/bzmore
9990067Ssobomax	cp -f bzdiff $(PREFIX)/bin/bzdiff
100167974Sdelphij	ln -s -f $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp
10190067Ssobomax	chmod a+x $(PREFIX)/bin/bzdiff
10290067Ssobomax	cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1
10390067Ssobomax	chmod a+r $(PREFIX)/man/man1/bzgrep.1
10490067Ssobomax	chmod a+r $(PREFIX)/man/man1/bzmore.1
10590067Ssobomax	chmod a+r $(PREFIX)/man/man1/bzdiff.1
10690067Ssobomax	echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzegrep.1
10790067Ssobomax	echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzfgrep.1
10890067Ssobomax	echo ".so man1/bzmore.1" > $(PREFIX)/man/man1/bzless.1
10990067Ssobomax	echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1
11078556Sobrien
11178556Sobrienclean: 
11278556Sobrien	rm -f *.o libbz2.a bzip2 bzip2recover \
11378556Sobrien	sample1.rb2 sample2.rb2 sample3.rb2 \
11478556Sobrien	sample1.tst sample2.tst sample3.tst
11578556Sobrien
11678556Sobrienblocksort.o: blocksort.c
11778556Sobrien	@cat words0
11878556Sobrien	$(CC) $(CFLAGS) -c blocksort.c
11978556Sobrienhuffman.o: huffman.c
12078556Sobrien	$(CC) $(CFLAGS) -c huffman.c
12178556Sobriencrctable.o: crctable.c
12278556Sobrien	$(CC) $(CFLAGS) -c crctable.c
12378556Sobrienrandtable.o: randtable.c
12478556Sobrien	$(CC) $(CFLAGS) -c randtable.c
12578556Sobriencompress.o: compress.c
12678556Sobrien	$(CC) $(CFLAGS) -c compress.c
12778556Sobriendecompress.o: decompress.c
12878556Sobrien	$(CC) $(CFLAGS) -c decompress.c
12978556Sobrienbzlib.o: bzlib.c
13078556Sobrien	$(CC) $(CFLAGS) -c bzlib.c
13178556Sobrienbzip2.o: bzip2.c
13278556Sobrien	$(CC) $(CFLAGS) -c bzip2.c
13378556Sobrienbzip2recover.o: bzip2recover.c
13478556Sobrien	$(CC) $(CFLAGS) -c bzip2recover.c
13578556Sobrien
136146293Sobrien
137146293Sobriendistclean: clean
138146293Sobrien	rm -f manual.ps manual.html manual.pdf
139146293Sobrien
140215041SobrienDISTNAME=bzip2-1.0.6
141146293Sobriendist: check manual
14278556Sobrien	rm -f $(DISTNAME)
143167974Sdelphij	ln -s -f . $(DISTNAME)
14478556Sobrien	tar cvf $(DISTNAME).tar \
14578556Sobrien	   $(DISTNAME)/blocksort.c \
14678556Sobrien	   $(DISTNAME)/huffman.c \
14778556Sobrien	   $(DISTNAME)/crctable.c \
14878556Sobrien	   $(DISTNAME)/randtable.c \
14978556Sobrien	   $(DISTNAME)/compress.c \
15078556Sobrien	   $(DISTNAME)/decompress.c \
15178556Sobrien	   $(DISTNAME)/bzlib.c \
15278556Sobrien	   $(DISTNAME)/bzip2.c \
15378556Sobrien	   $(DISTNAME)/bzip2recover.c \
15478556Sobrien	   $(DISTNAME)/bzlib.h \
15578556Sobrien	   $(DISTNAME)/bzlib_private.h \
15678556Sobrien	   $(DISTNAME)/Makefile \
15778556Sobrien	   $(DISTNAME)/LICENSE \
15878556Sobrien	   $(DISTNAME)/bzip2.1 \
15978556Sobrien	   $(DISTNAME)/bzip2.1.preformatted \
16078556Sobrien	   $(DISTNAME)/bzip2.txt \
16178556Sobrien	   $(DISTNAME)/words0 \
16278556Sobrien	   $(DISTNAME)/words1 \
16378556Sobrien	   $(DISTNAME)/words2 \
16478556Sobrien	   $(DISTNAME)/words3 \
16578556Sobrien	   $(DISTNAME)/sample1.ref \
16678556Sobrien	   $(DISTNAME)/sample2.ref \
16778556Sobrien	   $(DISTNAME)/sample3.ref \
16878556Sobrien	   $(DISTNAME)/sample1.bz2 \
16978556Sobrien	   $(DISTNAME)/sample2.bz2 \
17078556Sobrien	   $(DISTNAME)/sample3.bz2 \
17178556Sobrien	   $(DISTNAME)/dlltest.c \
172146293Sobrien	   $(DISTNAME)/manual.html \
173146293Sobrien	   $(DISTNAME)/manual.pdf \
174146293Sobrien	   $(DISTNAME)/manual.ps \
17578556Sobrien	   $(DISTNAME)/README \
17678556Sobrien	   $(DISTNAME)/README.COMPILATION.PROBLEMS \
177146293Sobrien	   $(DISTNAME)/README.XML.STUFF \
17878556Sobrien	   $(DISTNAME)/CHANGES \
17978556Sobrien	   $(DISTNAME)/libbz2.def \
18078556Sobrien	   $(DISTNAME)/libbz2.dsp \
18178556Sobrien	   $(DISTNAME)/dlltest.dsp \
18278556Sobrien	   $(DISTNAME)/makefile.msc \
18378556Sobrien	   $(DISTNAME)/unzcrash.c \
18478556Sobrien	   $(DISTNAME)/spewG.c \
18590067Ssobomax	   $(DISTNAME)/mk251.c \
18690067Ssobomax	   $(DISTNAME)/bzdiff \
18790067Ssobomax	   $(DISTNAME)/bzdiff.1 \
18890067Ssobomax	   $(DISTNAME)/bzmore \
18990067Ssobomax	   $(DISTNAME)/bzmore.1 \
19090067Ssobomax	   $(DISTNAME)/bzgrep \
19190067Ssobomax	   $(DISTNAME)/bzgrep.1 \
192146293Sobrien	   $(DISTNAME)/Makefile-libbz2_so \
193146293Sobrien	   $(DISTNAME)/bz-common.xsl \
194146293Sobrien	   $(DISTNAME)/bz-fo.xsl \
195146293Sobrien	   $(DISTNAME)/bz-html.xsl \
196146293Sobrien	   $(DISTNAME)/bzip.css \
197146293Sobrien	   $(DISTNAME)/entities.xml \
198146293Sobrien	   $(DISTNAME)/manual.xml \
199146293Sobrien	   $(DISTNAME)/format.pl \
200146293Sobrien	   $(DISTNAME)/xmlproc.sh
20190067Ssobomax	gzip -v $(DISTNAME).tar
20290067Ssobomax
203146293Sobrien# For rebuilding the manual from sources on my SuSE 9.1 box
20490067Ssobomax
205146293SobrienMANUAL_SRCS= 	bz-common.xsl bz-fo.xsl bz-html.xsl bzip.css \
206146293Sobrien		entities.xml manual.xml 
20790067Ssobomax
208146293Sobrienmanual: manual.html manual.ps manual.pdf
20990067Ssobomax
210146293Sobrienmanual.ps: $(MANUAL_SRCS)
211146293Sobrien	./xmlproc.sh -ps manual.xml
212146293Sobrien
213146293Sobrienmanual.pdf: $(MANUAL_SRCS)
214146293Sobrien	./xmlproc.sh -pdf manual.xml
215146293Sobrien
216146293Sobrienmanual.html: $(MANUAL_SRCS)
217146293Sobrien	./xmlproc.sh -html manual.xml
218