summaryrefslogtreecommitdiff
path: root/build-aux/Makefile.each.tail
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2017-01-30 18:42:31 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2017-01-30 18:42:31 -0500
commit4f9203808ef9607ae27eba3cf77079bbe661fd95 (patch)
tree4bd6bd4cc388dedbbc74f2b987682b684344f023 /build-aux/Makefile.each.tail
parent4abfdaa8c9fa4646f3ba7e9c1bb1f3eb47061f9d (diff)
parent16e8d3b92b5e35a5eaee40a7b7fc0279c342886a (diff)
Merge remote-tracking branch 'autothing/v3/master'
Diffstat (limited to 'build-aux/Makefile.each.tail')
-rw-r--r--build-aux/Makefile.each.tail/00-dist.mk1
-rw-r--r--build-aux/Makefile.each.tail/00-mod.mk44
-rw-r--r--build-aux/Makefile.each.tail/00-var.mk22
-rw-r--r--build-aux/Makefile.each.tail/10-files.mk52
-rw-r--r--build-aux/Makefile.each.tail/10-nested.mk21
-rw-r--r--build-aux/Makefile.each.tail/10-std.mk46
-rw-r--r--build-aux/Makefile.each.tail/11-texinfo.mk38
7 files changed, 178 insertions, 46 deletions
diff --git a/build-aux/Makefile.each.tail/00-dist.mk b/build-aux/Makefile.each.tail/00-dist.mk
new file mode 100644
index 0000000..b023e80
--- /dev/null
+++ b/build-aux/Makefile.each.tail/00-dist.mk
@@ -0,0 +1 @@
+_dist.files := $(strip $(_dist.files) $(call at.addprefix,$(srcdir),$(filter-out $(files.src.int),$(files.src))))
diff --git a/build-aux/Makefile.each.tail/00-mod.mk b/build-aux/Makefile.each.tail/00-mod.mk
new file mode 100644
index 0000000..d6514dd
--- /dev/null
+++ b/build-aux/Makefile.each.tail/00-mod.mk
@@ -0,0 +1,44 @@
+# Copyright (C) 2016 Luke Shumaker
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# 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/>.
+
+$(outdir)/at-variables $(outdir)/at-variables-local: _mod.VARIABLES := $(filter-out $(call quote.pattern,$(_at.VARIABLES)),$(.VARIABLES))
+$(outdir)/at-variables-global:
+ @printf '%s\n' $(call quote.shell-each,$(sort $(.VARIABLES)))
+$(outdir)/at-variables-local:
+ @printf '%s\n' $(call quote.shell-each,$(sort $(_mod.VARIABLES)))
+$(outdir)/at-variables $(outdir)/at-values:
+ @printf '%s\n' $(call quote.shell-each,$(sort $(.VARIABLES),$(_mod.VARIABLES)))
+$(outdir)/at-variables/%:
+ @printf '%s\n' $(call quote.shell,$($*))
+$(outdir)/at-values/%:
+ @printf '%s\n' $(call quote.shell,$(value $*))
+.PHONY: $(addprefix $(outdir)/, at-variables-global at-variables-local at-variables at-values)
+at.targets += $(addprefix $(outdir)/, at-variables-global at-variables-local at-variables at-values at-variables/% at-values/%)
+
+$(outdir)/at-modules:
+ @printf 'Autothing modules used in this project:\n'
+ @printf ' - %s\n' $(foreach _mod.tmp,$(_mod.modules),$(call quote.shell,$(_mod.tmp) $(mod.$(_mod.tmp).description) $(if $(mod.$(_mod.tmp).doc),(more))))|column -t -s $$'\t'
+$(addprefix $(outdir)/at-modules/,$(_mod.modules)): $(outdir)/at-modules/%:
+ @printf 'Name : %s\n' $(call quote.shell,$*)
+ @printf 'Description : %s\n' $(call quote.shell,$(mod.$*.description))
+ @echo 'Depends on :' $(sort $(mod.$*.depends))
+ @echo 'Files :'
+ @printf ' %s\n' $(call quote.shell-each,$(call at.relto,$(topsrcdir),$(sort $(mod.$*.files) $(wildcard $(topsrcdir)/build-aux/Makefile.*/??-$*.mk))))
+ @echo 'Documentation :'
+ @printf '%s\n' $(call quote.shell,$(mod.$*.doc)) | sed -e 's/^# / /' -e 's/^#//'
+
+$(outdir)/at-noop:
+.PHONY: $(outdir)/at-noop
+at.targets += $(outdir)/at-noop
diff --git a/build-aux/Makefile.each.tail/00-var.mk b/build-aux/Makefile.each.tail/00-var.mk
new file mode 100644
index 0000000..954defb
--- /dev/null
+++ b/build-aux/Makefile.each.tail/00-var.mk
@@ -0,0 +1,22 @@
+# Copyright (C) 2016-2017 Luke Shumaker
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# 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.var.depends += files quote write-ifchanged
+
+$(outdir)/.var.%: _var.FORCE
+ @printf '%s' $(call quote.shell,$($*)) | sed 's/^/#/' | $(WRITE_IFCHANGED) $@
+-include $(wildcard $(outdir)/.var.*)
+
+files.out.int += .var.*
diff --git a/build-aux/Makefile.each.tail/10-files.mk b/build-aux/Makefile.each.tail/10-files.mk
new file mode 100644
index 0000000..787a3bd
--- /dev/null
+++ b/build-aux/Makefile.each.tail/10-files.mk
@@ -0,0 +1,52 @@
+# Copyright (C) 2015-2017 Luke Shumaker
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# 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/>.
+# Add some more defaults to the *_files variables
+
+$(eval \
+ $(foreach _files.var,$(filter files.src files.src.%,$(.VARIABLES)),\
+ _$(_files.var) = $$(call at.addprefix,$$(srcdir),$$($(_files.var)))$(at.nl))\
+ $(foreach _files.var,$(filter files.out files.out.%,$(.VARIABLES)),\
+ _$(_files.var) = $$(call at.addprefix,$$(outdir),$$($(_files.var)))$(at.nl))\
+ $(foreach _files.var,$(filter files.sys files.sys.%,$(.VARIABLES)),\
+ _$(_files.var) = $$(addprefix $$(DESTDIR),$$($(_files.var)))$(at.nl)))
+
+_files.all = $(_files.src) $(_files.out) $(_files.sys)
+
+at.targets += $(subst *,%,$(_files.all))
+
+# Creative targets
+$(outdir)/$(files.generate): $(_files.src.gen) $(_files.src.cfg)
+$(outdir)/install: $(_files.sys.$(files.default))
+$(outdir)/installdirs: $(sort $(dir $(_files.sys)))
+$(eval \
+ $(foreach _files.g,$(files.groups),\
+ $$(outdir)/$(_files.g): $$(_files.out.$(_files.g))$(at.nl))\
+ $(foreach _files.g,$(filter-out $(files.default),$(files.groups)),\
+ $$(outdir)/install-$(_files.g): $$(_files.sys.$(_files.g))$(at.nl)))
+
+# Destructive targets
+_files.uninstall = $(_files.sys)
+_files.mostlyclean = $(filter-out $(_files.out.slow) $(_files.out.cfg),$(_files.out))
+_files.clean = $(filter-out $(_files.out.cfg),$(_files.out))
+_files.distclean = $(_files.out)
+_files.maintainer-clean = $(_files.distclean) $(filter-out $(_files.src.cfg) $(_files.src.src),$(_files.src))
+_files.$(files.vcsclean) = $(_files.distclean) $(filter-out $(_files.src.src),$(_files.src))
+$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean $(files.vcsclean)): %: %-hook
+ $(call _files.XARGS,$(RM) --, $(sort $(wildcard $(filter-out %/,$(_files.$(@F))))) )
+ $(call _files.XARGS,$(RM) -r --, $(sort $(wildcard $(filter %/,$(_files.$(@F))))) )
+ $(call _files.XARGS,$(RMDIR_P) --,$(filter-out ./,$(sort $(wildcard $(dir $(_files.$(@F)))))))
+$(addprefix $(outdir)/,maintainer-clean $(files.vcsclean)): _files.maintainer-clean-warning
+$(foreach t,uninstall mostlyclean clean distclean maintainer-clean $(files.vcsclean), $(outdir)/$t-hook)::
+.PHONY: $(foreach t,uninstall mostlyclean clean distclean maintainer-clean $(files.vcsclean), $(outdir)/$t-hook)
diff --git a/build-aux/Makefile.each.tail/10-nested.mk b/build-aux/Makefile.each.tail/10-nested.mk
new file mode 100644
index 0000000..667ec6f
--- /dev/null
+++ b/build-aux/Makefile.each.tail/10-nested.mk
@@ -0,0 +1,21 @@
+# Copyright (C) 2016-2017 Luke Shumaker
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# 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/>.
+
+$(eval $(foreach _tmp.nested,$(nested.targets),\
+ $$(outdir)/$(_tmp.nested): $$(addsuffix /$(_tmp.nested),$$(call at.addprefix,$$(outdir),$$(nested.subdirs)))$(at.nl)))
+.PHONY: $(addprefix $(outdir)/,$(nested.targets))
+
+at.subdirs += $(nested.subdirs)
+at.targets += $(addprefix $(outdir)/,$(nested.targets))
diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk
deleted file mode 100644
index 5150a71..0000000
--- a/build-aux/Makefile.each.tail/10-std.mk
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (C) 2015-2016 Luke Shumaker
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# 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/>.
-# Add some more defaults to the *_files variables
-std.clean_files += $(std.gen_files) $(std.cfg_files) $(std.out_files)
-
-# Fix each variable at its current value to avoid any weirdness
-$(foreach c,src gen cfg out sys clean slow,$(eval std.$c_files := $$(std.$c_files)))
-
-# Make each of the standard variables relative to the correct directory
-std.src_files := $(patsubst ./%,%,$(addprefix $(srcdir)/,$(std.src_files)))
-std.gen_files := $(patsubst ./%,%,$(addprefix $(srcdir)/,$(std.gen_files)))
-std.cfg_files := $(patsubst ./%,%,$(addprefix $(outdir)/,$(std.cfg_files)))
-std.out_files := $(patsubst ./%,%,$(addprefix $(outdir)/,$(std.out_files)))
-std.sys_files := $(addprefix $(DESTDIR),$(std.sys_files))
-std.clean_files := $(patsubst ./%,%,$(addprefix $(outdir)/,$(std.clean_files)))
-std.slow_files := $(patsubst ./%,%,$(addprefix $(outdir)/,$(std.slow_files)))
-
-# Creative targets
-$(outdir)/build : $(std.out_files)
-$(outdir)/install : $(std.sys_files)
-$(outdir)/installdirs: $(sort $(dir $(std.sys_files)))
-
-# Destructive targets
-_std.uninstall/$(outdir) := $(std.sys_files)
-_std.mostlyclean/$(outdir) := $(filter-out $(std.slow_files) $(std.cfg_files) $(std.gen_files) $(std.src_files),$(std.clean_files))
-_std.clean/$(outdir) := $(filter-out $(std.cfg_files) $(std.gen_files) $(std.src_files),$(std.clean_files))
-_std.distclean/$(outdir) := $(filter-out $(std.gen_files) $(std.src_files),$(std.clean_files))
-_std.maintainer-clean/$(outdir) := $(filter-out $(std.src_files),$(std.clean_files))
-$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean): %: %-hook
- $(RM) -- $(sort $(filter-out %/,$(_std.$(@F)/$(@D))))
- $(RM) -r -- $(sort $(filter %/,$(_std.$(@F)/$(@D))))
- $(RMDIR_P) $(sort $(dir $(_std.$(@F)/$(@D)))) 2>/dev/null || $(TRUE)
-$(foreach t,uninstall mostlyclean clean distclean maintainer-clean, $(outdir)/$t-hook)::
-.PHONY: $(foreach t,uninstall mostlyclean clean distclean maintainer-clean, $(outdir)/$t-hook)
diff --git a/build-aux/Makefile.each.tail/11-texinfo.mk b/build-aux/Makefile.each.tail/11-texinfo.mk
new file mode 100644
index 0000000..1ee5843
--- /dev/null
+++ b/build-aux/Makefile.each.tail/11-texinfo.mk
@@ -0,0 +1,38 @@
+# Copyright (C) 2016 Luke Shumaker
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# 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/>.
+
+$(outdir)/info : $(addsuffix .info,$(texinfo.docs))
+files.src.gen += $(addsuffix .info,$(texinfo.docs))
+files.out.dvi += $(addsuffix .dvi ,$(texinfo.docs))
+files.out.html += $(addsuffix .html,$(texinfo.docs))
+files.out.pdf += $(addsuffix .pdf ,$(texinfo.docs))
+files.out.ps += $(addsuffix .ps ,$(texinfo.docs))
+
+files.sys.all += $(foreach f,$(texinfo.docs), $(infodir)/$f.info )
+files.sys.dvi += $(foreach f,$(texinfo.docs), $(dvidir)/$f.dvi )
+files.sys.html += $(foreach f,$(texinfo.docs), $(htmldir)/$f.html )
+files.sys.pdf += $(foreach f,$(texinfo.docs), $(pdfdir)/$f.pdf )
+files.sys.ps += $(foreach f,$(texinfo.docs), $(psdir)/$f.ps )
+
+$(outdir)/%.info: $(srcdir)/%.texi; $(MAKEINFO) -o $(@D) $<
+$(outdir)/%.info: $(outdir)/%.texi; $(MAKEINFO) -o $(@D) $<
+$(outdir)/%.dvi : $(srcdir)/%.texi; $(TEXI2DVI) -o $(@D) $<
+$(outdir)/%.dvi : $(outdir)/%.texi; $(TEXI2DVI) -o $(@D) $<
+$(outdir)/%.html: $(srcdir)/%.texi; $(TEXI2HTML) -o $(@D) $<
+$(outdir)/%.html: $(outdir)/%.texi; $(TEXI2HTML) -o $(@D) $<
+$(outdir)/%.pdf : $(srcdir)/%.texi; $(TEXI2PDF) -o $(@D) $<
+$(outdir)/%.pdf : $(outdir)/%.texi; $(TEXI2PDF) -o $(@D) $<
+$(outdir)/%.ps : $(srcdir)/%.texi; $(TEXI2PS) -o $(@D) $<
+$(outdir)/%.ps : $(outdir)/%.texi; $(TEXI2PS) -o $(@D) $<