]> git.draconx.ca Git - rarpd-dx.git/blob - Makefile.am
Add NEWS.
[rarpd-dx.git] / Makefile.am
1 # Copyright © 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
8
9 AM_CPPFLAGS = -DIPUTILS_VERSION='PACKAGE_STRING,'
10
11 EXTRA_DIST = COPYING COPYING.WTFPL2 INSTALL README.md bootstrap
12
13 XSLTPROC_MAN = $(XSLTPROC) -o $@ --nonet \
14                --stringparam man.output.quietly 1 \
15                --stringparam funcsynopsis.style ansi \
16                --stringparam man.th.extra1.suppress 1 \
17                --stringparam iputils.version 'rarpd' \
18                $(XSLTPROCFLAGS) $(srcdir)/doc/custom-man.xsl
19
20 DEV_TOOL_ERROR = { \
21   echo "ERROR: *** $$tool is missing on your system."; \
22   echo "       *** Because of this, I cannot compile $$toolsrc, but"; \
23   echo "       *** (perhaps because you modified it) the sources appear out"; \
24   echo "       *** of date.  If $$tool is installed but was not detected by"; \
25   echo "       *** configure, consired setting $$toolvar and re-running configure."; \
26   echo "       *** See config.log for more details."; } >&2; false
27
28 dist_man_MANS = doc/rarpd.8
29 .xml.8:
30 if !HAVE_XSLTPROC
31         $(AM_V_GEN)tool=xsltproc toolvar=XSLTPROC toolsrc=$<; \
32           $(DEV_TOOL_ERROR)
33 endif
34         $(AM_V_GEN) $(XSLTPROC_MAN) $<
35 $(dist_man_MANS): $(srcdir)/doc/custom-man.xsl
36 MAINTAINERCLEANFILES = $(dist_man_MANS)
37 EXTRA_DIST += $(dist_man_MANS:.8=.xml) $(srcdir)/doc/custom-man.xsl
38
39 sbin_PROGRAMS = rarpd
40 rarpd_SOURCES = src/rarpd.c src/iputils_common.c src/iputils_common.h
41
42 # When running "make dist" in a VPATH build with a read-only srcdir, Automake
43 # will produce a distribution with all files read-only.  Moreover, the files
44 # are read-only in distdir when the dist hooks are run.  This hook will fix
45 # up the permissions.  All dist hooks that modify files in distdir should list
46 # unfuck-distdir as a prerequisite.
47 dist-hook: unfuck-distdir
48 unfuck-distdir:
49         find '$(distdir)' -type f -exec chmod u+w {} +
50 .PHONY: unfuck-distdir
51
52 GITLOG_FLAGS = --format='%s%n%n%b%n'
53
54 dist-hook: generate-changelog
55 generate-changelog: unfuck-distdir
56         -: "$${GIT_DIR=$(top_srcdir)/.git}"; \
57           export GIT_DIR; test -d "$$GIT_DIR" || exit 0; { \
58             $(top_srcdir)/gitlog-to-changelog $(GITLOG_FLAGS) && \
59             echo && \
60             cat $(top_srcdir)/ChangeLog.iputils; \
61           } >$(distdir)/ChangeLog.gen && \
62           mv -f '$(distdir)/ChangeLog.gen' '$(distdir)/ChangeLog'
63         rm -f '$(distdir)/ChangeLog.gen'
64 .PHONY: generate-changelog
65
66
67 GENERIC_V   = $(GENERIC_V_@AM_V@)
68 GENERIC_V_  = $(GENERIC_V_@AM_DEFAULT_V@)
69 GENERIC_V_0 = @printf '%2.0s%$(DX_ALIGN_V)s %s\n'
70
71 TEST_DISTRIBUTION = false
72 TEST_DISTRIBUTION_OR_ERROR = if $(TEST_DISTRIBUTION); \
73   then echo 'Proceeding anyway...'; \
74   else echo 'Run $(MAKE) TEST_DISTRIBUTION=true to ignore this failure.'; \
75     false; \
76   fi
77
78 distcheck-hook:
79         $(GENERIC_V) : 'CHECK   ' ChangeLog; \
80           $(AWK) '/^Stub/ { print FILENAME ":" NR ":", $$0; exit 1 }' \
81             $(distdir)/ChangeLog || { \
82               echo 'ERROR: *** Packaged ChangeLog was not properly generated from git log.'; \
83               echo '       *** The source version was used instead, but this appears to'; \
84               echo '       *** be the stub from a git checkout.  The "git" and "perl"'; \
85               echo '       *** programs are required for ChangeLog generation to work.'; \
86               $(TEST_DISTRIBUTION_OR_ERROR); } >&2
87         $(GENERIC_V) : 'CHECK   ' NEWS; \
88           $(AWK) 'NR == 1 && $$NF != "$(PACKAGE_VERSION):" \
89             { print FILENAME ":" NR ":", $$0; exit 1}' \
90             $(distdir)/NEWS || { \
91               echo 'ERROR: *** First line of NEWS should match the package version'; \
92               echo '       *** $(PACKAGE_VERSION), but that does not appear to be the case.'; \
93               echo '       *** Remember to update NEWS before preparing a release.'; \
94               $(TEST_DISTRIBUTION_OR_ERROR); } >&2