summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--automake.tail.mk139
-rw-r--r--build-aux/Makefile.README.txt (renamed from automake.txt)0
-rw-r--r--build-aux/Makefile.head.mk (renamed from automake.head.mk)37
-rw-r--r--build-aux/Makefile.tail.mk52
4 files changed, 67 insertions, 161 deletions
diff --git a/automake.tail.mk b/automake.tail.mk
deleted file mode 100644
index a24820b..0000000
--- a/automake.tail.mk
+++ /dev/null
@@ -1,139 +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/>.
-
-include $(topsrcdir)/common.each.tail.mk
-
-
-# Aggregate variables
-
-# Add some more defaults to the *_files variables
-$(_am)clean_files += $($(_am)gen_files) $($(_am)cfg_files) $($(_am)out_files)
-
-# Now namespace the *_files variables
-define _am_save_variables
-_am_src_files/$(outdir) = $(addprefix $(srcdir)/,$($(_am)src_files))
-_am_gen_files/$(outdir) = $(addprefix $(srcdir)/,$($(_am)gen_files))
-_am_cfg_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)cfg_files))
-_am_out_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)out_files))
-_am_sys_files/$(outdir) = $(addprefix $(DESTDIR),$($(_am)sys_files))
-_am_clean_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)clean_files))
-_am_slow_files/$(outdir) = $(addprefix $(outdir)/,$($(_am)slow_files))
-_am_subdirs/$(outdir) = $($(_am)subdirs)
-endef
-$(eval $(_am_save_variables))
-
-# And add them to the $(parent)_*_files variables (if applicable)
-define _am_add_subdir
-_am_src_files/%(outdir) += $(_am_src_files/%(subdir))
-_am_gen_files/%(outdir) += $(_am_gen_files/%(subdir))
-_am_cfg_files/%(outdir) += $(_am_cfg_files/%(subdir))
-_am_out_files/%(outdir) += $(_am_out_files/%(subdir))
-_am_sys_files/%(outdir) += $(_am_sys_files/%(subdir))
-_am_clean_files/%(outdir) += $(_am_clean_files/%(subdir))
-_am_slow_files/%(outdir) += $(_am_slow_files/%(subdir))
-endef
-$(foreach subdir,$(call _am_path,$(addprefix $(outdir)/,$($(_am)subdirs))),$(eval $(subst %(outdir),$(outdir),$(subst %(subdir),$(subdir),$(value _am_add_subdir)))))
-
-_am_outdirs := $(_am_outdirs) $(outdir)
-
-
-# Do some per-directory magic
-
-_am_phony = build install uninstall mostlyclean clean distclean maintainer-clean check
-
-.PHONY: $(addprefix $(outdir)/,$(_am_phony))
-
-$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean)::
- $(RM) -- $(sort $(_am_$(@F)/$(@D)))
- $(RMDIRS) $(sort $(dir $(_am_$(@F)/$(@D)))) 2>/dev/null || $(TRUE)
-
-# 'build' and 'install' must be defined later, because the
-# am_*_files/* variables might not be complete yet.
-
-
-# Include Makefiles from other directories
-
-define _am_nl
-
-
-endef
-
-$(foreach _am_NO_ONCE,y,\
- $(foreach makefile,$(foreach dir,$($(_am)subdirs) $($(_am)depdirs),$(call _am_path,$(outdir)/$(dir)/Makefile)),\
- $(eval include $(filter-out $(_am_included_makefiles),$(makefile)))))
-
-
-# This only gets evaluated once, after all of the other Makefiles are read
-ifeq ($(_am_NO_ONCE),)
-# Empty directory-level variables
-outdir = /bogus
-srcdir = /bogus
-
-$(_am)subdirs =
-$(_am)depdirs =
-
-$(_am)src_files =
-$(_am)gen_files =
-$(_am)cfg_files =
-$(_am)out_files =
-$(_am)sys_files =
-$(_am)clean_files =
-$(_am)slow_files =
-
-_am_clean_files/$(topoutdir) += $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz
-$(addprefix $(topoutdir)/,mostlyclean clean distclean maintainer-clean) ::
- $(RM) -r -- $(topoutdir)/$(PACKAGE)-$(VERSION)
-
-define _am_directory_rules
-# Constructive phony targets
-$(outdir)/build : $(_am_out_files/%(outdir))
-$(outdir)/install: $(_am_sys_files/%(outdir))
-# Destructive phony targets
-_am_uninstall/%(outdir) = $(_am_sys_files/%(outdir))
-_am_mostlyclean/%(outdir) = $(filter-out $(_am_slow_files/%(outdir)) $(_am_cfg_files/%(outdir)) $(_am_gen_files/%(outdir)) $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir)))
-_am_clean/%(outdir) = $(filter-out $(_am_cfg_files/%(outdir)) $(_am_gen_files/%(outdir)) $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir)))
-_am_distclean/%(outdir) = $(filter-out $(_am_gen_files/%(outdir)) $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir)))
-_am_maintainer-clean/%(outdir) = $(filter-out $(_am_src_files/%(outdir)),$(_am_clean_files/%(outdir)))
-endef
-$(foreach outdir,$(_am_outdirs),$(eval $(subst %(outdir),$(outdir),$(value _am_directory_rules))))
-
-# Add the `dist` target
-.PHONY: dist
-dist: $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz
-$(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz: $(topoutdir)/$(PACKAGE)-$(VERSION)
- $(TAR) czf $@ -C $(<D) $(<F)
-_am_copyfile = $(MKDIRS) $(dir $2) && $(CP) -T $1 $2
-_am_addfile = $(call _am_copyfile,$3,$2/$(call _am_relto,$1,$3))
-$(topoutdir)/$(PACKAGE)-$(VERSION): $(_am_src_files/$(topoutdir)) $(_am_gen_files/$(topoutdir))
- $(RM) -r $@
- @PS4='' && set -x && \
- $(MKDIR) $(@D)/tmp.$(@F).$$$$ && \
- $(foreach f,$^,$(call _am_addfile,$(topsrcdir),$(@D)/tmp.$(@F).$$$$,$f) &&) \
- $(MV) $(@D)/tmp.$(@F).$$$$ $@ || $(RM) -r $(@D)/tmp.$(@F).$$$$
-
-include $(topsrcdir)/common.once.tail.mk
-
-# For some reason I can't explain, RM doesn't really get set with ?=
-CP ?= cp
-MKDIR ?= mkdir
-MKDIRS ?= mkdir -p
-MV ?= mv
-RM = rm -f
-RMDIRS ?= rmdir -p
-TAR ?= tar
-TRUE ?= true
-
-.PHONY: noop
-endif
diff --git a/automake.txt b/build-aux/Makefile.README.txt
index 935af5f..935af5f 100644
--- a/automake.txt
+++ b/build-aux/Makefile.README.txt
diff --git a/automake.head.mk b/build-aux/Makefile.head.mk
index 431f14d..e4ae329 100644
--- a/automake.head.mk
+++ b/build-aux/Makefile.head.mk
@@ -12,6 +12,9 @@
#
# 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/>.
+
+# This bit only gets evaluated once, at the very beginning
+ifeq ($(_am_NO_ONCE),)
_am = am_
@@ -23,34 +26,24 @@ _am_relto_helper = $(if $(call _am_is_subdir,$1,$2),$(patsubst $1/%,%,$(addsuffi
_am_relto = $(call _am_noslash,$(call _am_relto_helper,$(call _am_noslash,$(abspath $1)),$(call _am_noslash,$(abspath $2))))
# Note that _am_is_subdir says that a directory is a subdirectory of
# itself.
-_am_path = $(call _am_relto,.,$1)
am_path = $(foreach p,$1,$(call _am_relto,.,$p))
-## Declare the default target
-all: build
-.PHONY: all
+$(_am)dirlocal += $(_am)subdirs
+$(_am)dirlocal += $(_am)depdirs
-## Set outdir and srcdir (assumes that topoutdir and topsrcdir are
-## already set)
-outdir := $(call _am_path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST)))))
-srcdir := $(call _am_path,$(topsrcdir)/$(call _am_relto,$(topoutdir),$(outdir)))
+include $(topsrcdir)/common.once.head.mk
-_am_included_makefiles := $(_am_included_makefiles) $(call _am_path,$(outdir)/Makefile)
+endif # _am_NO_ONCE
+
+# This bit gets evaluated for each Makefile
-## Empty variables for use by each Makefile
-$(_am)subdirs =
-$(_am)depdirs =
+## Set outdir and srcdir (assumes that topoutdir and topsrcdir are
+## already set)
+outdir := $(call am_path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST)))))
+srcdir := $(call am_path,$(topsrcdir)/$(call _am_relto,$(topoutdir),$(outdir)))
-$(_am)src_files =
-$(_am)gen_files =
-$(_am)cfg_files =
-$(_am)out_files =
-$(_am)sys_files =
+_am_included_makefiles := $(_am_included_makefiles) $(call am_path,$(outdir)/Makefile)
-$(_am)clean_files =
-$(_am)slow_files =
+$(foreach v,$($(_am)dirlocal),$(eval $v=))
-ifeq ($(_am_NO_ONCE),)
-include $(topsrcdir)/common.once.head.mk
-endif
include $(topsrcdir)/common.each.head.mk
diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk
new file mode 100644
index 0000000..472d2db
--- /dev/null
+++ b/build-aux/Makefile.tail.mk
@@ -0,0 +1,52 @@
+# 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/>.
+
+# This bit gets evaluated for each Makefile processed
+
+include $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk)
+
+# Make the namespaced versions of all of the dirlocal variables
+$(foreach v,$($(_am)dirlocal),$(eval $v/$(outdir) = $($v)))
+
+# Remember that this is a directory that we've visited
+_am_outdirs := $(_am_outdirs) $(outdir)
+
+# Generic phony target declarations:
+# mark them phony
+.PHONY: $(addprefix $(outdir)/,$($(_am)phony))
+# have them depend on subdirs
+$(foreach t,$($(_am)phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(subdirs))))
+
+# Include Makefiles from other directories
+
+define _am_nl
+
+
+endef
+$(foreach _am_NO_ONCE,y,\
+ $(foreach makefile,$(call am_path,$(addsuffix /Makefile,$($(_am)subdirs) $($(_am)depdirs))),\
+ $(eval include $(filter-out $(_am_included_makefiles),$(makefile)))))
+
+# This bit only gets evaluated once, after all of the other Makefiles are read
+ifeq ($(_am_NO_ONCE),)
+
+outdir = /bogus
+srcdir = /bogus
+
+$(foreach v,$($(_am)dirlocal),$(eval $v=))
+
+include $(wildcard $(topsrcdir)/build-aux/Makefile.once.tail/*.mk)
+
+endif # _am_NO_ONCE