| 1 | ACLOCAL_AMFLAGS = -I build-aux |
| 2 | |
| 3 | AM_CFLAGS = -I$(top_srcdir)/include |
| 4 | |
| 5 | EXTRA_DIST = LICENSE 3rdparty/libsais-LICENSE PORTING.md README.md build-aux/git-version-gen CMakeLists.txt |
| 6 | |
| 7 | pkgconfig_DATA = bzip3.pc |
| 8 | |
| 9 | include_HEADERS = include/libbz3.h |
| 10 | noinst_HEADERS = include/common.h \ |
| 11 | include/libsais.h \ |
| 12 | include/yarg.h |
| 13 | |
| 14 | lib_LTLIBRARIES = libbzip3.la |
| 15 | libbzip3_la_SOURCES = src/libbz3.c |
| 16 | libbzip3_la_LDFLAGS = -no-undefined -version-info 1:0:0 |
| 17 | |
| 18 | bin_PROGRAMS = bzip3 |
| 19 | bzip3_CFLAGS = $(AM_CFLAGS) |
| 20 | bzip3_SOURCES = src/main.c |
| 21 | if ENABLE_STATIC |
| 22 | bzip3_SOURCES += $(libbzip3_la_SOURCES) |
| 23 | else |
| 24 | bzip3_LDADD = libbzip3.la |
| 25 | endif |
| 26 | |
| 27 | dist_man_MANS = bzip3.1 bz3cat.1 bz3more.1 bz3less.1 bz3most.1 bz3grep.1 bunzip3.1 |
| 28 | |
| 29 | dist_bin_SCRIPTS = bz3cat bz3more bz3less bz3most bz3grep bunzip3 |
| 30 | |
| 31 | CLEANFILES = $(bin_PROGRAMS) |
| 32 | |
| 33 | # End standard generic autotools stuff |
| 34 | |
| 35 | # Begin special handling for autoconf VERSION being updated on commit |
| 36 | |
| 37 | BUILT_SOURCES = .version |
| 38 | CLEANFILES += $(BUILT_SOURCES) .version-prev |
| 39 | |
| 40 | src/bzip3-main.$(OBJEXT): .version |
| 41 | |
| 42 | _BRANCH_REF != $(AWK) '{print ".git/" $$2}' .git/HEAD 2>/dev/null ||: |
| 43 | |
| 44 | .version: $(_BRANCH_REF) |
| 45 | @if [ -e "$(srcdir)/.tarball-version" ]; then \ |
| 46 | printf "$(VERSION)" > $@; \ |
| 47 | else \ |
| 48 | touch "$@-prev"; \ |
| 49 | if [ -e "$@" ]; then \ |
| 50 | cp "$@" "$@-prev"; \ |
| 51 | fi; \ |
| 52 | ./build-aux/git-version-gen "$(srcdir)/.tarball-version" > $@; \ |
| 53 | cmp -s "$@" "$@-prev" || autoreconf configure.ac --force; \ |
| 54 | fi |
| 55 | |
| 56 | dist-hook: |
| 57 | printf "$(VERSION)" > "$(distdir)/.tarball-version" |
| 58 | |
| 59 | # Begin developer convenience targets |
| 60 | |
| 61 | .PHONY: format |
| 62 | format: $(bzip3_SOURCES) $(libbzip3_la_SOURCES) $(include_HEADERS) $(noinst_HEADERS) |
| 63 | clang-format -i $^ examples/*.c |
| 64 | |
| 65 | .PHONY: cloc |
| 66 | cloc: $(bzip3_SOURCES) $(libbzip3_la_SOURCES) $(include_HEADERS) $(noinst_HEADERS) |
| 67 | cloc $^ |
| 68 | |
| 69 | CLEANFILES += LICENSE2 |
| 70 | .PHONY: roundtrip |
| 71 | |
| 72 | BZIP3 := bzip3$(EXEEXT) |
| 73 | |
| 74 | roundtrip: $(BZIP3) |
| 75 | rm -f $(builddir)/LICENSE2 |
| 76 | ./$(BZIP3) -v -feb 6 $(srcdir)/LICENSE $(builddir)/LICENSE.bz3 |
| 77 | ./$(BZIP3) -v -d $(builddir)/LICENSE.bz3 $(builddir)/LICENSE2 |
| 78 | cmp $(srcdir)/LICENSE $(builddir)/LICENSE2 |
| 79 | -command -v md5sum >/dev/null 2>&1 && md5sum $(builddir)/LICENSE.bz3 |
| 80 | |
| 81 | .PHONY: test |
| 82 | test: $(BZIP3) |
| 83 | ./$(BZIP3) -d < $(srcdir)/examples/shakespeare.txt.bz3 | cmp - $(srcdir)/examples/shakespeare.txt |