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