summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2017-02-03 02:47:24 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2017-02-03 02:47:24 -0500
commiteaf336a9265399520e3cf71d4979446b98bdf48d (patch)
tree24b430b71088a290ae3a50c7d4e2b195d30aaf12 /build-aux
parent16e8d3b92b5e35a5eaee40a7b7fc0279c342886a (diff)
mod: files: handling of directories for the clean rule
Diffstat (limited to 'build-aux')
-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 787a3bdbd1..e22b216c19 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 564f9d634f..55c41cb9b9 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'