From df54432d56964e39b49915289a44fe5569ce9eb1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 27 May 2016 21:09:58 -0400 Subject: move everything into build-aux --- automake.head.mk | 56 ----------- automake.tail.mk | 139 ---------------------------- automake.txt | 164 --------------------------------- build-aux/Makefile.each.tail/10-std.mk | 42 +++++++++ build-aux/Makefile.once.head/10-std.mk | 31 +++++++ build-aux/Makefile.once.tail/10-std.mk | 16 ++++ 6 files changed, 89 insertions(+), 359 deletions(-) delete mode 100644 automake.head.mk delete mode 100644 automake.tail.mk delete mode 100644 automake.txt create mode 100644 build-aux/Makefile.each.tail/10-std.mk create mode 100644 build-aux/Makefile.once.head/10-std.mk create mode 100644 build-aux/Makefile.once.tail/10-std.mk diff --git a/automake.head.mk b/automake.head.mk deleted file mode 100644 index 431f14d..0000000 --- a/automake.head.mk +++ /dev/null @@ -1,56 +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 . - -_am = am_ - -_am_noslash = $(patsubst %/.,%,$(patsubst %/,%,$1)) -# These are all $(call _am_func,parent,child) -#_am_relto = $(if $2,$(shell realpath -sm --relative-to='$1' $2)) -_am_is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.) -_am_relto_helper = $(if $(call _am_is_subdir,$1,$2),$(patsubst $1/%,%,$(addsuffix /.,$2)),$(addprefix ../,$(call _am_relto_helper,$(patsubst %/,%,$(dir $1)),$2))) -_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 - -## 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_included_makefiles := $(_am_included_makefiles) $(call _am_path,$(outdir)/Makefile) - -## Empty variables for use by each Makefile -$(_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 = - -ifeq ($(_am_NO_ONCE),) -include $(topsrcdir)/common.once.head.mk -endif -include $(topsrcdir)/common.each.head.mk 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 . - -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 $(. + +# Add some more defaults to the *_files variables +$(_am)clean_files += $($(_am)gen_files) $($(_am)cfg_files) $($(_am)out_files) + +# Make each of the standard variables relative to the correct directory +$(_am)src_files := $(addprefix $(srcdir)/,$($(_am)src_files)) +$(_am)gen_files := $(addprefix $(srcdir)/,$($(_am)gen_files)) +$(_am)cfg_files := $(addprefix $(outdir)/,$($(_am)cfg_files)) +$(_am)out_files := $(addprefix $(outdir)/,$($(_am)out_files)) +$(_am)sys_files := $(addprefix $(DESTDIR),$($(_am)sys_files)) +$(_am)clean_files := $(addprefix $(outdir)/,$($(_am)clean_files)) +$(_am)slow_files := $(addprefix $(outdir)/,$($(_am)slow_files)) +$(_am)subdirs := $(addprefix $(outdir)/,$($(_am)subdirs)) + +# Creative targets +$(outdir)/build : $($(_am)out_files/$(outdir)) +$(outdir)/install : $($(_am)sys_files/$(outdir)) +$(outdir)/installdirs: $(dir $($(_am)sys_files/$(outdir))) + +# Destructive 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))) +$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean): + $(RM) -- $(sort $(_am_$(@F)/$(@D))) + $(RMDIRS) $(sort $(dir $(_am_$(@F)/$(@D)))) 2>/dev/null || $(TRUE) diff --git a/build-aux/Makefile.once.head/10-std.mk b/build-aux/Makefile.once.head/10-std.mk new file mode 100644 index 0000000..dec850c --- /dev/null +++ b/build-aux/Makefile.once.head/10-std.mk @@ -0,0 +1,31 @@ +# 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 . + +# Declare the default target +all: build +.PHONY: all + +# Standard creative PHONY targets +$(_am)phony += build install installdirs +# Standard destructive PHONY targets +$(_am)phony += uninstall mostlyclean clean distclean maintainer-clean + +$(_am)dirlocal += $(_am)src_files +$(_am)dirlocal += $(_am)gen_files +$(_am)dirlocal += $(_am)cfg_files +$(_am)dirlocal += $(_am)out_files +$(_am)dirlocal += $(_am)sys_files +$(_am)dirlocal += $(_am)clean_files +$(_am)dirlocal += $(_am)slow_files diff --git a/build-aux/Makefile.once.tail/10-std.mk b/build-aux/Makefile.once.tail/10-std.mk new file mode 100644 index 0000000..56c4f2c --- /dev/null +++ b/build-aux/Makefile.once.tail/10-std.mk @@ -0,0 +1,16 @@ +# 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 . + +.PHONY: noop -- cgit v1.2.2 From 44595e16ebcde42a730d927a0f7b563feef084a3 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 16:05:16 -0400 Subject: work on things --- build-aux/Makefile.each.tail/10-std.mk | 39 +++++++++++++++++----------------- build-aux/Makefile.once.head/10-std.mk | 20 +++++++++-------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk index ca8497c..4d36cc5 100644 --- a/build-aux/Makefile.each.tail/10-std.mk +++ b/build-aux/Makefile.each.tail/10-std.mk @@ -12,31 +12,30 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - # Add some more defaults to the *_files variables -$(_am)clean_files += $($(_am)gen_files) $($(_am)cfg_files) $($(_am)out_files) +std.clean_files += $(std.gen_files) $(std.cfg_files) $(std.out_files) # Make each of the standard variables relative to the correct directory -$(_am)src_files := $(addprefix $(srcdir)/,$($(_am)src_files)) -$(_am)gen_files := $(addprefix $(srcdir)/,$($(_am)gen_files)) -$(_am)cfg_files := $(addprefix $(outdir)/,$($(_am)cfg_files)) -$(_am)out_files := $(addprefix $(outdir)/,$($(_am)out_files)) -$(_am)sys_files := $(addprefix $(DESTDIR),$($(_am)sys_files)) -$(_am)clean_files := $(addprefix $(outdir)/,$($(_am)clean_files)) -$(_am)slow_files := $(addprefix $(outdir)/,$($(_am)slow_files)) -$(_am)subdirs := $(addprefix $(outdir)/,$($(_am)subdirs)) +std.src_files := $(addprefix $(srcdir)/,$(std.src_files)) +std.gen_files := $(addprefix $(srcdir)/,$(std.gen_files)) +std.cfg_files := $(addprefix $(outdir)/,$(std.cfg_files)) +std.out_files := $(addprefix $(outdir)/,$(std.out_files)) +std.sys_files := $(addprefix $(DESTDIR),$(std.sys_files)) +std.clean_files := $(addprefix $(outdir)/,$(std.clean_files)) +std.slow_files := $(addprefix $(outdir)/,$(std.slow_files)) +std.subdirs := $(addprefix $(outdir)/,$(std.subdirs)) # Creative targets -$(outdir)/build : $($(_am)out_files/$(outdir)) -$(outdir)/install : $($(_am)sys_files/$(outdir)) -$(outdir)/installdirs: $(dir $($(_am)sys_files/$(outdir))) +$(outdir)/build : $(std.out_files) +$(outdir)/install : $(std.sys_files) +$(outdir)/installdirs: $(dir $(std.sys_files)) # Destructive 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))) +_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): - $(RM) -- $(sort $(_am_$(@F)/$(@D))) - $(RMDIRS) $(sort $(dir $(_am_$(@F)/$(@D)))) 2>/dev/null || $(TRUE) + $(RM) -- $(sort $(_std.$(@F)/$(@D))) + $(RMDIRS) $(sort $(dir $(_std.$(@F)/$(@D)))) 2>/dev/null || $(TRUE) diff --git a/build-aux/Makefile.once.head/10-std.mk b/build-aux/Makefile.once.head/10-std.mk index dec850c..b3d7c4a 100644 --- a/build-aux/Makefile.once.head/10-std.mk +++ b/build-aux/Makefile.once.head/10-std.mk @@ -17,15 +17,17 @@ all: build .PHONY: all +DESTDIR ?= + # Standard creative PHONY targets -$(_am)phony += build install installdirs +at.phony += build install installdirs # Standard destructive PHONY targets -$(_am)phony += uninstall mostlyclean clean distclean maintainer-clean +at.phony += uninstall mostlyclean clean distclean maintainer-clean -$(_am)dirlocal += $(_am)src_files -$(_am)dirlocal += $(_am)gen_files -$(_am)dirlocal += $(_am)cfg_files -$(_am)dirlocal += $(_am)out_files -$(_am)dirlocal += $(_am)sys_files -$(_am)dirlocal += $(_am)clean_files -$(_am)dirlocal += $(_am)slow_files +at.dirlocal += std.src_files +at.dirlocal += std.gen_files +at.dirlocal += std.cfg_files +at.dirlocal += std.out_files +at.dirlocal += std.sys_files +at.dirlocal += std.clean_files +at.dirlocal += std.slow_files -- cgit v1.2.2 From 85c37c0e6f8ebf9d816f984a3499d856a2e708b1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 17:05:41 -0400 Subject: tidy up --- build-aux/Makefile.each.tail/10-std.mk | 2 +- build-aux/Makefile.once.head/10-std.mk | 12 +++++++++--- build-aux/Makefile.once.tail/10-std.mk | 16 ---------------- 3 files changed, 10 insertions(+), 20 deletions(-) delete mode 100644 build-aux/Makefile.once.tail/10-std.mk diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk index 4d36cc5..8cebc7f 100644 --- a/build-aux/Makefile.each.tail/10-std.mk +++ b/build-aux/Makefile.each.tail/10-std.mk @@ -38,4 +38,4 @@ _std.distclean/$(outdir) := $(filter-out _std.maintainer-clean/$(outdir) := $(filter-out $(_std.src_files),$(_std.clean_files)) $(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean): $(RM) -- $(sort $(_std.$(@F)/$(@D))) - $(RMDIRS) $(sort $(dir $(_std.$(@F)/$(@D)))) 2>/dev/null || $(TRUE) + $(RMDIR_P) $(sort $(dir $(_std.$(@F)/$(@D)))) 2>/dev/null || $(TRUE) diff --git a/build-aux/Makefile.once.head/10-std.mk b/build-aux/Makefile.once.head/10-std.mk index b3d7c4a..3e058ec 100644 --- a/build-aux/Makefile.once.head/10-std.mk +++ b/build-aux/Makefile.once.head/10-std.mk @@ -15,9 +15,7 @@ # Declare the default target all: build -.PHONY: all - -DESTDIR ?= +.PHONY: all noop # Standard creative PHONY targets at.phony += build install installdirs @@ -31,3 +29,11 @@ at.dirlocal += std.out_files at.dirlocal += std.sys_files at.dirlocal += std.clean_files at.dirlocal += std.slow_files + +# User configuration + +DESTDIR ?= + +RM ?= rm -f +RMDIR_P ?= rmdir -p +TRUE ?= true diff --git a/build-aux/Makefile.once.tail/10-std.mk b/build-aux/Makefile.once.tail/10-std.mk deleted file mode 100644 index 56c4f2c..0000000 --- a/build-aux/Makefile.once.tail/10-std.mk +++ /dev/null @@ -1,16 +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 . - -.PHONY: noop -- cgit v1.2.2 From e521304e16879d394a677232264f4d5c836c3cbb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 19:21:26 -0400 Subject: use :: on destructive targets to allow them to be extended --- build-aux/Makefile.each.tail/10-std.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk index 8cebc7f..bff3b63 100644 --- a/build-aux/Makefile.each.tail/10-std.mk +++ b/build-aux/Makefile.each.tail/10-std.mk @@ -36,6 +36,6 @@ _std.mostlyclean/$(outdir) := $(filter-out $(_std.slow_files) $(_std.cfg_fi _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): +$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean):: $(RM) -- $(sort $(_std.$(@F)/$(@D))) $(RMDIR_P) $(sort $(dir $(_std.$(@F)/$(@D)))) 2>/dev/null || $(TRUE) -- cgit v1.2.2 From 48731211106413607a067aa26f80d8b308e58eda Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 May 2016 00:02:08 -0400 Subject: fix - 'fix' the values of the _files variables before adjusting them - in the clean variables, std.*_files are public - support suffixing std.clean_files with / to rm -r it. - using double-colon rules breaks automatic dependencies from core - subdirs belongs to core, not this module - sort the dependencies of 'installdirs', for brevity --- build-aux/Makefile.each.tail/10-std.mk | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk index bff3b63..d32ec9b 100644 --- a/build-aux/Makefile.each.tail/10-std.mk +++ b/build-aux/Makefile.each.tail/10-std.mk @@ -15,7 +15,10 @@ # Add some more defaults to the *_files variables std.clean_files += $(std.gen_files) $(std.cfg_files) $(std.out_files) -# Make each of the standard variables relative to the correct directory +# 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 := $(addprefix $(srcdir)/,$(std.src_files)) std.gen_files := $(addprefix $(srcdir)/,$(std.gen_files)) std.cfg_files := $(addprefix $(outdir)/,$(std.cfg_files)) @@ -23,19 +26,21 @@ std.out_files := $(addprefix $(outdir)/,$(std.out_files)) std.sys_files := $(addprefix $(DESTDIR),$(std.sys_files)) std.clean_files := $(addprefix $(outdir)/,$(std.clean_files)) std.slow_files := $(addprefix $(outdir)/,$(std.slow_files)) -std.subdirs := $(addprefix $(outdir)/,$(std.subdirs)) # Creative targets -$(outdir)/build : $(std.out_files) -$(outdir)/install : $(std.sys_files) -$(outdir)/installdirs: $(dir $(std.sys_files)) +$(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):: - $(RM) -- $(sort $(_std.$(@F)/$(@D))) +_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) -- cgit v1.2.2 From d331934d1fcdaea5474a1da3605907447f7ef6ee Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 May 2016 00:54:43 -0400 Subject: Avoid prefixing things with ./ --- build-aux/Makefile.each.tail/10-std.mk | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk index d32ec9b..5150a71 100644 --- a/build-aux/Makefile.each.tail/10-std.mk +++ b/build-aux/Makefile.each.tail/10-std.mk @@ -19,13 +19,13 @@ std.clean_files += $(std.gen_files) $(std.cfg_files) $(std.out_files) $(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 := $(addprefix $(srcdir)/,$(std.src_files)) -std.gen_files := $(addprefix $(srcdir)/,$(std.gen_files)) -std.cfg_files := $(addprefix $(outdir)/,$(std.cfg_files)) -std.out_files := $(addprefix $(outdir)/,$(std.out_files)) -std.sys_files := $(addprefix $(DESTDIR),$(std.sys_files)) -std.clean_files := $(addprefix $(outdir)/,$(std.clean_files)) -std.slow_files := $(addprefix $(outdir)/,$(std.slow_files)) +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) -- cgit v1.2.2