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