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 --- build-aux/Makefile.each.tail/10-std.mk | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 build-aux/Makefile.each.tail/10-std.mk (limited to 'build-aux/Makefile.each.tail/10-std.mk') diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk new file mode 100644 index 0000000..ca8497c --- /dev/null +++ b/build-aux/Makefile.each.tail/10-std.mk @@ -0,0 +1,42 @@ +# 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 . + +# 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) -- cgit v1.2.3-2-g168b 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 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'build-aux/Makefile.each.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 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) -- cgit v1.2.3-2-g168b 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 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build-aux/Makefile.each.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) -- cgit v1.2.3-2-g168b 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(-) (limited to 'build-aux/Makefile.each.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 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.3-2-g168b 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(-) (limited to 'build-aux/Makefile.each.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 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.3-2-g168b 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(-) (limited to 'build-aux/Makefile.each.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 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.3-2-g168b From 28708b49282ed15ac69df4e16a2d6eccc219fa82 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 17 Jun 2016 16:02:13 -0400 Subject: fixup --- build-aux/Makefile.each.tail/10-std.mk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'build-aux/Makefile.each.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 5150a71..693f39d 100644 --- a/build-aux/Makefile.each.tail/10-std.mk +++ b/build-aux/Makefile.each.tail/10-std.mk @@ -12,6 +12,7 @@ # # 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 std.clean_files += $(std.gen_files) $(std.cfg_files) $(std.out_files) @@ -38,7 +39,13 @@ _std.mostlyclean/$(outdir) := $(filter-out $(std.slow_files) $(std.cfg_file _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 +$(addprefix $(outdir)/,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) +# separate uninstall to support GNU Coding Standards' NORMAL_UNINSTALL +$(addprefix $(outdir)/,uninstall): %: %-hook + $(NORMAL_UNINSTALL) $(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) -- cgit v1.2.3-2-g168b