summaryrefslogtreecommitdiff
path: root/build-aux/Makefile.once.head
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-08-10 11:22:38 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-08-10 11:22:38 -0400
commitf22246a490fcb1e8d60f8ae0759b3f1daca7c061 (patch)
tree6ddfb70728fbc2a4920da544c5d4971958bea900 /build-aux/Makefile.once.head
parent1cfeca882ebbd2de350a62e97e7ace35d3a57644 (diff)
fix build system
Diffstat (limited to 'build-aux/Makefile.once.head')
-rw-r--r--build-aux/Makefile.once.head/10-dist.mk4
-rw-r--r--build-aux/Makefile.once.head/10-files.mk5
-rw-r--r--build-aux/Makefile.once.head/10-lt.mk8
-rw-r--r--build-aux/Makefile.once.head/10-write-ifchanged.mk3
-rw-r--r--build-aux/Makefile.once.head/20-sd.mk16
-rw-r--r--build-aux/Makefile.once.head/30-am.mk22
-rw-r--r--build-aux/Makefile.once.head/zz-mod.mk32
7 files changed, 63 insertions, 27 deletions
diff --git a/build-aux/Makefile.once.head/10-dist.mk b/build-aux/Makefile.once.head/10-dist.mk
index 0e13ea2e28..e139096576 100644
--- a/build-aux/Makefile.once.head/10-dist.mk
+++ b/build-aux/Makefile.once.head/10-dist.mk
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-mod.dist.description = Make distribution tarballs
+mod.dist.description = `dist` target for distribution tarballs
# Developer configuration
@@ -28,6 +28,8 @@ ifeq ($(dist.version),)
$(error Autothing module: dist: dist.version must be set)
endif
+_dist.files =
+
# User configuration
CP ?= cp
diff --git a/build-aux/Makefile.once.head/10-files.mk b/build-aux/Makefile.once.head/10-files.mk
index 2af7bf8f20..54417356ee 100644
--- a/build-aux/Makefile.once.head/10-files.mk
+++ b/build-aux/Makefile.once.head/10-files.mk
@@ -24,7 +24,10 @@ files.generate ?= files.generate
.DEFAULT_GOAL = $(files.default)
# Standard creative PHONY targets
-nested.targets += $(foreach g,$(files.groups), $g install-$g install-$gdirs)
+nested.targets += $(files.generate)
+nested.targets += install installdirs
+nested.targets += $(foreach g,$(files.groups),$g)
+nested.targets += $(foreach g,$(filter-out $(files.default),$(files.groups)),install-$g install-$gdirs)
# Standard destructive PHONY targets
nested.targets += uninstall mostlyclean clean distclean maintainer-clean
diff --git a/build-aux/Makefile.once.head/10-lt.mk b/build-aux/Makefile.once.head/10-lt.mk
index c8410d4e38..b014a0f2a4 100644
--- a/build-aux/Makefile.once.head/10-lt.mk
+++ b/build-aux/Makefile.once.head/10-lt.mk
@@ -1,12 +1,12 @@
-mod.lt.description = Easy handling of libtool dependencies
+mod.lt.description = (systemd) Easy handling of libtool dependencies
mod.lt.deps += files
_lt.dups = $(sort $(foreach l,$1,$(if $(filter-out 1,$(words $(filter $l,$1))),$l)))
-_lt.patsubst-all = $(if $1,$(call _sd.patsubst-all,$(wordlist 2,$(words $1),$1),$2,$(patsubst $(firstword $1),$2,$3)),$3)
-_lt.unLIBPATTERNS = $(foreach _lt.tmp,$1,$(if $(filter $(.LIBPATTERNS),$(_lt.tmp)),$(call _lt.patsubst-all,$(.LIBPATTERNS),-l%,$(_lt.tmp)),$(_lt.tmp)))
+_lt.patsubst-all = $(if $1,$(call _lt.patsubst-all,$(wordlist 2,$(words $1),$1),$2,$(patsubst $(firstword $1),$2,$3)),$3)
+_lt.unLIBPATTERNS = $(foreach _lt.tmp,$1,$(if $(filter $(.LIBPATTERNS),$(notdir $(_lt.tmp))),$(call _lt.patsubst-all,$(.LIBPATTERNS),-l%,$(notdir $(_lt.tmp))),$(_lt.tmp)))
# The semantics for the de-dup bit are a bit weird. My head hurts thinking
# about them. TODO: clarify/simplify/something
lt.rpath = $(dir $(patsubst $(DESTDIR)%,%,$(filter %/$(@F),$(files.sys))))
-_lt.link_files = $(filter %.o %.lo %.la -l%,$(call _lt.unLIBPATTERNS$,$^))
+_lt.link_files = $(filter %.o %.lo %.la -l%,$(call _lt.unLIBPATTERNS,$^))
lt.link_files = $(filter-out $(call _lt.dups,$(_lt.link_files)),$(_lt.link_files))
diff --git a/build-aux/Makefile.once.head/10-write-ifchanged.mk b/build-aux/Makefile.once.head/10-write-ifchanged.mk
index 7917201159..b0a5ac478f 100644
--- a/build-aux/Makefile.once.head/10-write-ifchanged.mk
+++ b/build-aux/Makefile.once.head/10-write-ifchanged.mk
@@ -1,3 +1,4 @@
-mod.write-ifchanged.description = build-aux/write-ifchanged helper script
+mod.write-ifchanged.description = `write-ifchanged` auxiliary build script
+mod.write-ifchanged.files += $(topsrcdir)/build-aux/write-ifchanged
WRITE_IFCHANGED ?= $(topsrcdir)/build-aux/write-ifchanged
diff --git a/build-aux/Makefile.once.head/20-sd.mk b/build-aux/Makefile.once.head/20-sd.mk
index 6c943978e3..6b8dd580cc 100644
--- a/build-aux/Makefile.once.head/20-sd.mk
+++ b/build-aux/Makefile.once.head/20-sd.mk
@@ -21,7 +21,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
-mod.sd.description = systemd build rules
+mod.sd.description = (systemd) shared build rules
mod.sd.depends += am
TESTS ?=
@@ -47,10 +47,11 @@ sd.COMPILE = $(CC) $(sd.ALL_CPPFLAGS) $(sd.ALL_CFLAGS)
sd.LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=compile $(CC) $(sd.ALL_CPPFLAGS) $(sd.ALL_CFLAGS)
sd.LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=link $(CCLD) $(sd.ALL_CFLAGS) $(sd.ALL_LDFLAGS) -o $@
-am.INSTALL_PROGRAM = $(AM_V_PROG)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $< $@
-am.INSTALL_SCRIPT = $(AM_V_SCRIPT)$(INSTALL_SCRIPT) $< $@
-am.INSTALL_LTLIBRARY = $(AM_V_LIB)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL) $< $@
-am.INSTALL_DATA = $(AM_V_DATA)$(INSTALL_DATA) $< $@
+am.INSTALL_PROGRAMS = $(AM_V_PROG)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $< $@
+am.INSTALL_SCRIPTS = $(AM_V_SCRIPT)$(INSTALL_SCRIPT) $< $@
+am.INSTALL_LTLIBRARIES = $(AM_V_LIB)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL) $< $@
+am.INSTALL_DATA = $(AM_V_DATA)$(INSTALL_DATA) $< $@
+am.INSTALL_HEADERS = $(AM_V_HEADER)$(INSTALL_DATA) $< $@
CC ?= c99
CCLD ?= c99
@@ -133,6 +134,11 @@ AM_V_LIB_ ?= $(AM_V_LIB_$(AM_DEFAULT_VERBOSITY))
AM_V_LIB_0 ?= @echo " LIB " $@;
AM_V_LIB_1 ?=
+AM_V_HEADER ?= $(AM_V_HEADER_$(V))
+AM_V_HEADER_ ?= $(AM_V_HEADER_$(AM_DEFAULT_VERBOSITY))
+AM_V_HEADER_0 ?= @echo " HEADER " $@;
+AM_V_HEADER_1 ?=
+
AM_V_at ?= $(AM_V_at_$(V))
AM_V_at_ ?= $(AM_V_at_$(AM_DEFAULT_VERBOSITY))
AM_V_at_0 ?= @
diff --git a/build-aux/Makefile.once.head/30-am.mk b/build-aux/Makefile.once.head/30-am.mk
index 52504c6dcb..65cbc33ed0 100644
--- a/build-aux/Makefile.once.head/30-am.mk
+++ b/build-aux/Makefile.once.head/30-am.mk
@@ -1,10 +1,12 @@
-mod.am.description = Support for Automake variables (systemd specific)
+mod.am.description = (systemd) Automake-to-Autothing magic
mod.am.depends += gnuconf
am.inst2noinst_DATA = $(notdir \
$(patsubst $(sysusersdir)/%.conf,%.sysusers,\
$(patsubst $(sysctldir)/%.conf,%.sysctl,\
$1)))
+am.inst2noinst_HEADERS = $(abspath $(addprefix $(srcdir)/include/,$(notdir $1)))
+
am.var_PROGRAMS = $1_SOURCES nodist_$1_SOURCES $1_CFLAGS $1_CPPFLAGS $1_LDFLAGS $1_LDADD
am.var_LTLIBRARIES = $1_SOURCES nodist_$1_SOURCES $1_CFLAGS $1_CPPFLAGS $1_LDFLAGS $1_LIBADD
@@ -21,7 +23,7 @@ $(eval $(foreach p,$(am.primaries),am.inst2noinst_$p ?= $$(notdir $$1)$(at.nl)))
am.primary2dirs = $(filter $(patsubst %dir,%,$(filter %dir,$(.VARIABLES))),\
$(patsubst %_$1,%,$(filter %_$1,$(.VARIABLES))))
-am.inst2dirs = $(sort $(dir $(foreach p,$(am.primaries),$(am.inst_$p))))
+am.inst2dirs = $(sort $(patsubst %/,%,$(dir $(foreach p,$(am.primaries),$(am.inst_$p)))))
am.file2var = $(subst -,_,$(subst .,_,$1))
am.file2sources = $(addprefix $(srcdir)/,$(notdir $($(am.file2var)_SOURCES)))
@@ -35,13 +37,11 @@ define _am.per_primary
noinst_$1 ?=
check_$1 ?=
-am.inst_$1 := $$(foreach d,$$(call am.primary2dirs,$1),$$($$d_$1))
+am.inst_$1 := $$(foreach d,$$(call am.primary2dirs,$1),$$(addprefix $$($$ddir)/,$$(notdir $$($$d_$1))))
am.noinst_$1 := $$(noinst_$1)
am.check_$1 := $$(check_$1)
$(foreach d,$(call am.primary2dirs,$1) noinst check,undefine $d_$1$(at.nl))
-ifneq ($$(am.inst_$1),)
-$$(am.inst_$1): private am.INSTALL = $$(am.INSTALL_$1)
-endif
+$$(addprefix $$(DESTDIR),$$(am.inst_$1)): private am.INSTALL = $$(am.INSTALL_$1)
am.$1 = $$(am.check_$1) $$(am.noinst_$1) $$(call am.inst2noinst_$1,$$(am.inst_$1))
endef
########################################################################
@@ -89,4 +89,12 @@ $$(DESTDIR)$1/%: $$(srcdir)/%
@$$(NORMAL_INSTALL)
$$(am.INSTALL)
endef
-
+########################################################################
+define _am.per_include_directory
+$$(DESTDIR)$1/%: $$(outdir)/include/%
+ @$$(NORMAL_INSTALL)
+ $$(am.INSTALL)
+$$(DESTDIR)$1/%: $$(srcdir)/include/%
+ @$$(NORMAL_INSTALL)
+ $$(am.INSTALL)
+endef
diff --git a/build-aux/Makefile.once.head/zz-mod.mk b/build-aux/Makefile.once.head/zz-mod.mk
index 7e526063c3..438f01e2ae 100644
--- a/build-aux/Makefile.once.head/zz-mod.mk
+++ b/build-aux/Makefile.once.head/zz-mod.mk
@@ -13,14 +13,30 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-mod.mod.description = Print information about Autothing modules
+mod.mod.description = Display information about Autothing modules
-_mod.target = at-mod-info
-_mod.modules := $(sort $(patsubst %.mk,%,$(filter %.mk,$(subst -, ,$(notdir $(wildcard $(topsrcdir)/build-aux/Makefile.*/??-*.mk))))))
-_mod.quote = '$(subst ','\'',$1)'
+# The trickery that is _mod.empty/_mod.space is from ยง6.2 of the GNU Make
+# manual, "The Two Flavors of Variables".
+_mod.empty :=
+_mod.space := $(_mod.empty) #
+undefine _mod.empty
+# _mod.rest is equivalent to GMSL rest.
+_mod.rest = $(wordlist 2,$(words $1),$1)
-$(eval $(foreach _mod.tmp,$(_mod.modules),mod.$(_mod.tmp).description ?=$(at.nl)mod.$(_mod.tmp).depends ?=$(at.nl)))
+_mod.file2mod = $(foreach _mod.tmp,$(patsubst %.mk,%,$(notdir $1)),$(subst $(_mod.space),-,$(call _mod.rest,$(subst -, ,$(_mod.tmp)))))
-_mod.vars = $(filter $(addsuffix .%,$(_mod.modules)),$(.VARIABLES))
-_mod.once := $(_mod.vars)
-_mod.each :=
+_mod.modules := $(sort $(call _mod.file2mod,$(wildcard $(topsrcdir)/build-aux/Makefile.*/??-*.mk)))
+undefine _mod.rest
+undefine _mod.file2mod
+
+$(eval $(foreach _mod.tmp,$(_mod.modules),\
+ mod.$(_mod.tmp).description ?=$(at.nl)\
+ mod.$(_mod.tmp).depends ?=$(at.nl)\
+ mod.$(_mod.tmp).files ?=$(at.nl)))
+
+_mod.quote-pattern = $(subst %,\%,$(subst \,\\,$1))
+_mod.quote-shell-each = $(foreach _mod.tmp,$1,$(call _mod.quote-shell,$(_mod.tmp)))
+
+# I put this as the last line in the file because it confuses Emacs syntax
+# highlighting and makes the remainder of the file difficult to edit.
+_mod.quote-shell = $(subst $(at.nl),'$$'\n'','$(subst ','\'',$1)')