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