]> git.draconx.ca Git - slotifier.git/blob - Makefile.am
Use help formatting routines from dxcommon.
[slotifier.git] / Makefile.am
1 # Copyright © 2018, 2021 Nick Bowler
2 #
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.
6
7 ACLOCAL_AMFLAGS = -I m4 -I common/m4
8
9 CLEANFILES = $(EXTRA_LIBRARIES)
10 DISTCLEANFILES =
11 MOSTLYCLEANFILES =
12 MAINTAINERCLEANFILES =
13 EXTRA_LIBRARIES =
14 EXTRA_DIST = bootstrap common/scripts/fix-gnulib.pl m4/gnulib-cache.m4 \
15              INSTALL README.md
16
17 AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib \
18               -I$(DX_BASEDIR)/src -DLOCALEDIR=\"$(localedir)\"
19 AM_CFLAGS = $(LIBGERBV_CFLAGS) $(CNEARTREE_CFLAGS)
20
21 bin_PROGRAMS = slotifier
22
23 slotifier_SOURCES = src/slotifier.c src/options.h \
24                     common/src/help.c common/src/help.h
25 slotifier_LDADD = $(LIBGERBV_LIBS) $(CNEARTREE_LIBS) libgnu.a \
26                   $(LTLIBICONV) $(LTLIBINTL) $(HYPOT_LIBM)
27 $(slotifier_OBJECTS): $(gnulib_headers)
28 $(slotifier_OBJECTS): src/options.h
29
30 dist_man_MANS = doc/slotifier.1
31
32 # When running "make dist" in a VPATH build with a read-only srcdir, Automake
33 # will produce a distribution with all files read-only.  Moreover, the files
34 # are read-only in distdir when the dist hooks are run.  This hook will
35 # manually fix up the permissions.  All dist hooks that modify files in distdir
36 # should list unfuck-distdir as a prerequisite.
37 dist-hook: unfuck-distdir
38 unfuck-distdir:
39         find '$(distdir)' -type f -exec chmod u+w {} +
40 .PHONY: unfuck-distdir
41
42 GITLOG_FLAGS = --format='%s%n%n%b%n'
43
44 dist-hook: generate-changelog
45 generate-changelog: unfuck-distdir
46         -: "$${GIT_DIR=$(top_srcdir)/.git}"; \
47           export GIT_DIR; test -d "$$GIT_DIR" || exit 0; \
48           $(top_srcdir)/gitlog-to-changelog $(GITLOG_FLAGS) \
49             >'$(distdir)/ChangeLog.gen' && \
50           mv -f '$(distdir)/ChangeLog.gen' '$(distdir)/ChangeLog'
51         rm -f '$(distdir)/ChangeLog.gen'
52 .PHONY: generate-changelog
53
54 GENERIC_V   = $(GENERIC_V_@AM_V@)
55 GENERIC_V_  = $(GENERIC_V_@AM_DEFAULT_V@)
56 GENERIC_V_0 = @printf '%2.0s%$(DX_ALIGN_V)s %s\n'
57
58 TEST_DISTRIBUTION = false
59 TEST_DISTRIBUTION_OR_ERROR = if $(TEST_DISTRIBUTION); \
60   then echo 'Proceeding anyway...'; \
61   else echo 'Run $(MAKE) TEST_DISTRIBUTION=true to ignore this failure.'; \
62        false; \
63   fi
64
65 distcheck-hook:
66         $(GENERIC_V) : 'CHECK   ' ChangeLog; \
67           $(AWK) '/^Stub/ { print FILENAME ":" NR ":", $$0; exit 1 }' \
68             $(distdir)/ChangeLog || { \
69               echo 'ERROR: *** Packaged ChangeLog was not properly generated from git log.'; \
70               echo '       *** The source version was used instead, but this appears to'; \
71               echo '       *** be the stub from a git checkout.  The "git" and "perl"'; \
72               echo '       *** programs are required for ChangeLog generation to work.'; \
73               $(TEST_DISTRIBUTION_OR_ERROR); } >&2
74         $(GENERIC_V) : 'CHECK   ' NEWS; \
75           $(AWK) 'NR == 1 && $$NF != "$(PACKAGE_VERSION):" \
76             { print FILENAME ":" NR ":", $$0; exit 1}' \
77             $(distdir)/NEWS || { \
78               echo 'ERROR: *** First line of NEWS should match the package version'; \
79               echo '       *** $(PACKAGE_VERSION), but that does not appear to be the case.'; \
80               echo '       *** Remember to update NEWS before preparing a release.'; \
81               $(TEST_DISTRIBUTION_OR_ERROR); } >&2
82
83 OPTFILES = src/options.opt
84 .opt.h:
85         $(AM_V_GEN) $(AWK) -f $(DX_BASEDIR)/scripts/gen-options.awk $< >$@.tmp
86         $(AM_V_at) mv -f $@.tmp $@
87 $(OPTFILES:.opt=.h): $(DX_BASEDIR)/scripts/gen-options.awk
88 MAINTAINERCLEANFILES += $(OPTFILES:.opt=.h)
89 EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-options.awk $(OPTFILES)
90
91 # Supporting rules for gettext.
92 include $(top_srcdir)/common/snippet/gettext.mk
93 noinst_DATA = $(MOFILES)
94
95 EXTRA_DIST += po/$(PACKAGE).pot
96 MAINTAINERCLEANFILES += po/$(PACKAGE).pot
97
98 XGETTEXT_OPTS = -D $(builddir) -D $(srcdir) --from-code=utf-8 \
99                 --add-comments=TRANSLATORS: --foreign-user \
100                 --msgid-bugs-address=$(PACKAGE_BUGREPORT) \
101                 --package-version=$(PACKAGE_VERSION) \
102                 --package-name=$(PACKAGE) --keyword=_ \
103                 --keyword=N_ --keyword=PN_:1c,2
104
105 po/$(PACKAGE).pot: $(SOURCES)
106         $(AM_V_at)  $(MKDIR_P) $(@D)
107         $(AM_V_GEN) $(XGETTEXT) $(XGETTEXT_OPTS) -o $@.tmp $(SOURCES)
108         $(AM_V_at)  mv -f $@.tmp $@
109
110 include $(top_srcdir)/common/snippet/autotest.mk
111 include $(top_srcdir)/lib/gnulib.mk