1 # Copyright © 2018, 2021 Nick Bowler
3 # License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 # This is free software: you are free to do what the fuck you want to.
5 # There is NO WARRANTY, to the extent permitted by law.
7 ACLOCAL_AMFLAGS = -I m4 -I common/m4
9 CLEANFILES = $(EXTRA_LIBRARIES)
12 MAINTAINERCLEANFILES =
14 EXTRA_DIST = bootstrap common/scripts/fix-gnulib.pl m4/gnulib-cache.m4 \
17 AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib \
18 -DLOCALEDIR=\"$(localedir)\"
19 AM_CFLAGS = $(LIBGERBV_CFLAGS) $(CNEARTREE_CFLAGS)
21 bin_PROGRAMS = slotifier
23 slotifier_SOURCES = src/slotifier.c
24 slotifier_LDADD = $(LIBGERBV_LIBS) $(CNEARTREE_LIBS) libgnu.a \
25 $(LTLIBICONV) $(LTLIBINTL) $(HYPOT_LIBM)
26 $(slotifier_OBJECTS): $(gnulib_headers)
28 dist_man_MANS = doc/slotifier.1
30 # When running "make dist" in a VPATH build with a read-only srcdir, Automake
31 # will produce a distribution with all files read-only. Moreover, the files
32 # are read-only in distdir when the dist hooks are run. This hook will
33 # manually fix up the permissions. All dist hooks that modify files in distdir
34 # should list unfuck-distdir as a prerequisite.
35 dist-hook: unfuck-distdir
37 find '$(distdir)' -type f -exec chmod u+w {} +
38 .PHONY: unfuck-distdir
40 GITLOG_FLAGS = --format='%s%n%n%b%n'
42 dist-hook: generate-changelog
43 generate-changelog: unfuck-distdir
44 -: "$${GIT_DIR=$(top_srcdir)/.git}"; \
45 export GIT_DIR; test -d "$$GIT_DIR" || exit 0; \
46 $(top_srcdir)/gitlog-to-changelog $(GITLOG_FLAGS) \
47 >'$(distdir)/ChangeLog.gen' && \
48 mv -f '$(distdir)/ChangeLog.gen' '$(distdir)/ChangeLog'
49 rm -f '$(distdir)/ChangeLog.gen'
50 .PHONY: generate-changelog
52 GENERIC_V = $(GENERIC_V_@AM_V@)
53 GENERIC_V_ = $(GENERIC_V_@AM_DEFAULT_V@)
54 GENERIC_V_0 = @printf '%2.0s%$(DX_ALIGN_V)s %s\n'
56 TEST_DISTRIBUTION = false
57 TEST_DISTRIBUTION_OR_ERROR = if $(TEST_DISTRIBUTION); \
58 then echo 'Proceeding anyway...'; \
59 else echo 'Run $(MAKE) TEST_DISTRIBUTION=true to ignore this failure.'; \
64 $(GENERIC_V) : 'CHECK ' ChangeLog; \
65 $(AWK) '/^Stub/ { print FILENAME ":" NR ":", $$0; exit 1 }' \
66 $(distdir)/ChangeLog || { \
67 echo 'ERROR: *** Packaged ChangeLog was not properly generated from git log.'; \
68 echo ' *** The source version was used instead, but this appears to'; \
69 echo ' *** be the stub from a git checkout. The "git" and "perl"'; \
70 echo ' *** programs are required for ChangeLog generation to work.'; \
71 $(TEST_DISTRIBUTION_OR_ERROR); } >&2
72 $(GENERIC_V) : 'CHECK ' NEWS; \
73 $(AWK) 'NR == 1 && $$NF != "$(PACKAGE_VERSION):" \
74 { print FILENAME ":" NR ":", $$0; exit 1}' \
75 $(distdir)/NEWS || { \
76 echo 'ERROR: *** First line of NEWS should match the package version'; \
77 echo ' *** $(PACKAGE_VERSION), but that does not appear to be the case.'; \
78 echo ' *** Remember to update NEWS before preparing a release.'; \
79 $(TEST_DISTRIBUTION_OR_ERROR); } >&2
81 # Supporting rules for gettext.
82 include $(top_srcdir)/common/snippet/gettext.mk
83 noinst_DATA = $(MOFILES)
85 EXTRA_DIST += po/$(PACKAGE).pot
86 MAINTAINERCLEANFILES += po/$(PACKAGE).pot
88 XGETTEXT_OPTS = -D $(builddir) -D $(srcdir) --from-code=utf-8 \
89 --add-comments=TRANSLATORS: --foreign-user \
90 --msgid-bugs-address=$(PACKAGE_BUGREPORT) \
91 --package-version=$(PACKAGE_VERSION) \
92 --package-name=$(PACKAGE) --keyword=_
94 po/$(PACKAGE).pot: $(SOURCES)
95 $(AM_V_at) $(MKDIR_P) $(@D)
96 $(AM_V_GEN) $(XGETTEXT) $(XGETTEXT_OPTS) -o $@.tmp $(SOURCES)
97 $(AM_V_at) mv -f $@.tmp $@
99 include $(top_srcdir)/common/snippet/autotest.mk
100 include $(top_srcdir)/lib/gnulib.mk