summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build-aux/Makefile.each.tail/10-files.mk23
-rw-r--r--build-aux/Makefile.once.head/10-files.mk2
2 files changed, 15 insertions, 10 deletions
diff --git a/build-aux/Makefile.each.tail/10-files.mk b/build-aux/Makefile.each.tail/10-files.mk
index 787a3bd..e22b216 100644
--- a/build-aux/Makefile.each.tail/10-files.mk
+++ b/build-aux/Makefile.each.tail/10-files.mk
@@ -37,16 +37,21 @@ $(eval \
$$(outdir)/install-$(_files.g): $$(_files.sys.$(_files.g))$(at.nl)))
# Destructive targets
-_files.uninstall = $(_files.sys)
-_files.mostlyclean = $(filter-out $(_files.out.slow) $(_files.out.cfg),$(_files.out))
-_files.clean = $(filter-out $(_files.out.cfg),$(_files.out))
-_files.distclean = $(_files.out)
-_files.maintainer-clean = $(_files.distclean) $(filter-out $(_files.src.cfg) $(_files.src.src),$(_files.src))
-_files.$(files.vcsclean) = $(_files.distclean) $(filter-out $(_files.src.src),$(_files.src))
+#
+# We do our on $(srcdir) / $(outdir) prefixing here because
+# at.addprefix (while necessary for dependency lists) doesn't preserve
+# trailing slashes, which we care about here; while also not caring
+# about the path normalization that at.addprefix does.
+_files.uninstall = $(addprefix $(DESTDIR),$(files.sys))
+_files.mostlyclean = $(addprefix $(srcdir)/,$(filter-out $(files.out.slow) $(files.out.cfg),$(files.out)))
+_files.clean = $(addprefix $(srcdir)/,$(filter-out $(files.out.cfg),$(files.out)))
+_files.distclean = $(addprefix $(srcdir)/, $(files.out))
+_files.maintainer-clean = $(files.distclean) $(addprefix $(srcdir)/,$(filter-out $(files.src.cfg) $(files.src.src),$(files.src)))
+_files.$(files.vcsclean) = $(files.distclean) $(addprefix $(srcdir)/,$(filter-out $(files.src.src),$(files.src)))
$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean $(files.vcsclean)): %: %-hook
- $(call _files.XARGS,$(RM) --, $(sort $(wildcard $(filter-out %/,$(_files.$(@F))))) )
- $(call _files.XARGS,$(RM) -r --, $(sort $(wildcard $(filter %/,$(_files.$(@F))))) )
- $(call _files.XARGS,$(RMDIR_P) --,$(filter-out ./,$(sort $(wildcard $(dir $(_files.$(@F)))))))
+ $(call _files.XARGS,$(RM) -- {}, $(sort $(filter-out %/,$(_files.$(@F)))) )
+ $(call _files.XARGS,$(RM) -r -- {}, $(sort $(filter %/,$(_files.$(@F)))) )
+ $(call _files.XARGS,$(RMDIR_P) -- {} 2>/dev/null || true,$(filter-out ./,$(sort $(dir $(_files.$(@F))))))
$(addprefix $(outdir)/,maintainer-clean $(files.vcsclean)): _files.maintainer-clean-warning
$(foreach t,uninstall mostlyclean clean distclean maintainer-clean $(files.vcsclean), $(outdir)/$t-hook)::
.PHONY: $(foreach t,uninstall mostlyclean clean distclean maintainer-clean $(files.vcsclean), $(outdir)/$t-hook)
diff --git a/build-aux/Makefile.once.head/10-files.mk b/build-aux/Makefile.once.head/10-files.mk
index 564f9d6..55c41cb 100644
--- a/build-aux/Makefile.once.head/10-files.mk
+++ b/build-aux/Makefile.once.head/10-files.mk
@@ -92,7 +92,7 @@ TRUE ?= true
# Utility functions
-_files.XARGS = $(if $(strip $2),$1 $(strip $2))
+_files.XARGS = $(if $(strip $2),$(subst {},$(strip $2),$1))
_files.maintainer-clean-warning:
@echo 'This command is intended for maintainers to use; it'