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 AM_CPPFLAGS = -DIPUTILS_VERSION='PACKAGE_STRING,'
11 EXTRA_DIST = COPYING COPYING.WTFPL2 INSTALL README.md bootstrap
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
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
28 dist_man_MANS = doc/rarpd.8
31 $(AM_V_GEN)tool=xsltproc toolvar=XSLTPROC toolsrc=$<; \
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
40 rarpd_SOURCES = src/rarpd.c src/iputils_common.c src/iputils_common.h
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
49 find '$(distdir)' -type f -exec chmod u+w {} +
50 .PHONY: unfuck-distdir
52 GITLOG_FLAGS = --format='%s%n%n%b%n'
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) && \
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
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'
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.'; \
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