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