1
2lib_LTLIBRARIES = libbz2.la
3libbz2_la_LDFLAGS = -version-info 1:8:0
4
5libbz2_la_SOURCES = blocksort.c  \
6                    huffman.c    \
7                    crctable.c   \
8                    randtable.c  \
9                    compress.c   \
10                    decompress.c \
11                    bzlib.c
12
13bin_PROGRAMS = bzip2 bzip2recover
14
15bzip2_SOURCES = bzip2.c
16bzip2_LDADD = libbz2.la
17bzip2_DEPENDENCIES = libbz2.la
18
19include_HEADERS = bzlib.h
20
21bzip2recover_SOURCES = bzip2recover.c
22bzip2recover_LDADD = libbz2.la
23bzip2recover_DEPENDENCIES = libbz2.la
24
25bin_SCRIPTS = bzgrep bzmore bzdiff
26
27man_MANS = bzip2.1 bzgrep.1 bzmore.1 bzdiff.1
28EXTRA_DIST = $(man_MANS)
29
30runtest:
31	./bzip2 -1  < sample1.ref > sample1.rb2
32	./bzip2 -2  < sample2.ref > sample2.rb2
33	./bzip2 -3  < sample3.ref > sample3.rb2
34	./bzip2 -d  < sample1.bz2 > sample1.tst
35	./bzip2 -d  < sample2.bz2 > sample2.tst
36	./bzip2 -ds < sample3.bz2 > sample3.tst
37	@if cmp sample1.bz2 sample1.rb2; then echo "PASS: sample1 compress";\
38	else echo "FAIL: sample1 compress"; fi
39	@if cmp sample2.bz2 sample2.rb2; then echo "PASS: sample2 compress";\
40	else echo "FAIL: sample2 compress"; fi
41	@if cmp sample3.bz2 sample3.rb2; then echo "PASS: sample3 compress";\
42	else echo "FAIL: sample3 compress"; fi
43	@if cmp sample1.tst sample1.ref; then echo "PASS: sample1 decompress";\
44	else echo "FAIL: sample1 decompress"; fi
45	@if cmp sample2.tst sample2.ref; then echo "PASS: sample2 decompress";\
46	else echo "FAIL: sample2 decompress"; fi
47	@if cmp sample3.tst sample3.ref; then echo "PASS: sample3 decompress";\
48	else echo "FAIL: sample3 decompress"; fi
49	./bzip2-tests/run-tests.sh --without-valgrind --tests-dir="$(PWD)/bzip2-tests"
50
51install-ptest:
52	sed  -n '/^runtest:/,/^install-ptest:/{/^install-ptest:/!p}' \
53           $(srcdir)/Makefile.am      > $(DESTDIR)/Makefile
54	cp $(srcdir)/sample1.ref	$(DESTDIR)/
55	cp $(srcdir)/sample2.ref	$(DESTDIR)/
56	cp $(srcdir)/sample3.ref	$(DESTDIR)/
57	cp $(srcdir)/sample1.bz2	$(DESTDIR)/
58	cp $(srcdir)/sample2.bz2	$(DESTDIR)/
59	cp $(srcdir)/sample3.bz2	$(DESTDIR)/
60	ln -s $(bindir)/bzip2		$(DESTDIR)/bzip2
61
62install-exec-hook:
63	ln -s $(bindir)/bzip2$(EXEEXT) $(DESTDIR)$(bindir)/bunzip2$(EXEEXT)
64	ln -s $(bindir)/bzip2$(EXEEXT) $(DESTDIR)$(bindir)/bzcat$(EXEEXT)
65	ln -s $(bindir)/bzgrep$(EXEEXT) $(DESTDIR)$(bindir)/bzegrep$(EXEEXT)
66	ln -s $(bindir)/bzgrep$(EXEEXT) $(DESTDIR)$(bindir)/bzfgrep$(EXEEXT)
67	ln -s $(bindir)/bzmore$(EXEEXT) $(DESTDIR)$(bindir)/bzless$(EXEEXT)
68	ln -s $(bindir)/bzdiff$(EXEEXT) $(DESTDIR)$(bindir)/bzcmp$(EXEEXT)
69
70install-data-hook:
71	echo ".so man1/bzgrep.1" > $(DESTDIR)$(mandir)/man1/bzegrep.1
72	echo ".so man1/bzgrep.1" > $(DESTDIR)$(mandir)/man1/bzfgrep.1
73	echo ".so man1/bzmore.1" > $(DESTDIR)$(mandir)/man1/bzless.1
74	echo ".so man1/bzdiff.1" > $(DESTDIR)$(mandir)/man1/bzcmp.1
75