From f602c8fe063392e9f38390c6eb0816bef85063ac Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 12 Jun 2016 11:12:23 -0400 Subject: (systemd) add at.addprefix, a safe root-aware addprefix for directories --- build-aux/Makefile.head.mk | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'build-aux/Makefile.head.mk') diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index 63a3462..47c17c9 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.mk @@ -34,11 +34,16 @@ at.relto = $(foreach p,$2,$(call _at.relto,$1,$p)) # itself. at.path = $(call at.relto,.,$1) +_at.addprefix = $(if $(filter /%,$2),$2,$1/$2) +at.addprefix = $(call at.path,$(foreach f,$2, $(call _at.addprefix,$1,$f) )) + define at.nl endef +at.Makefile ?= Makefile + _at.rest = $(wordlist 2,$(words $1),$1) _at.reverse = $(if $1,$(call _at.reverse,$(_at.rest))) $(firstword $1) @@ -56,7 +61,7 @@ endif # _at.NO_ONCE outdir := $(call at.path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) srcdir := $(call at.path,$(topsrcdir)/$(call _at.relto,$(topoutdir),$(outdir))) -_at.included_makefiles := $(_at.included_makefiles) $(call at.path,$(outdir)/Makefile) +_at.included_makefiles := $(_at.included_makefiles) $(call at.path,$(outdir)/$(at.Makefile)) $(foreach v,$(at.dirlocal),$(eval $v=)) -- cgit v1.2.2