summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux')
-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)