summaryrefslogtreecommitdiff
path: root/build-aux/Makefile.each.tail/10-std.mk
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-31 00:02:08 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-31 00:02:08 -0400
commit48731211106413607a067aa26f80d8b308e58eda (patch)
treebad1eddf23837dd3a3bba98de5ecbfb3258fb68d /build-aux/Makefile.each.tail/10-std.mk
parente521304e16879d394a677232264f4d5c836c3cbb (diff)
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
Diffstat (limited to 'build-aux/Makefile.each.tail/10-std.mk')
-rw-r--r--build-aux/Makefile.each.tail/10-std.mk29
1 files 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)