diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-06-12 11:12:23 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-06-12 11:12:23 -0400 |
commit | f602c8fe063392e9f38390c6eb0816bef85063ac (patch) | |
tree | 630318f354b1c577fdf1d179810773c95950de29 /build-aux | |
parent | 544821d744e54882d74f8090b30cd1c0dfe8b6fd (diff) |
(systemd) add at.addprefix, a safe root-aware addprefix for directories
Diffstat (limited to 'build-aux')
-rw-r--r-- | build-aux/Makefile.head.mk | 7 | ||||
-rw-r--r-- | build-aux/Makefile.tail.mk | 6 |
2 files changed, 9 insertions, 4 deletions
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=)) diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index b1c5045..be3a8c2 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -17,8 +17,8 @@ include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk))) -at.subdirs := $(patsubst ./%,%,$(addprefix $(outdir)/,$(at.subdirs))) -at.depdirs := $(at.depdirs) +at.subdirs := $(call at.addprefix,$(outdir)/,$(at.subdirs)) +at.depdirs := $(call at.addprefix,$(outdir)/,$(at.depdirs)) # Move all of the dirlocal variables to their namespaced version $(foreach v,$(at.dirlocal),$(eval $v/$(outdir) := $$($v))) @@ -35,7 +35,7 @@ $(foreach t,$(at.phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(at.subdirs/$(outd # Include Makefiles from other directories $(foreach _at.NO_ONCE,y,\ - $(foreach makefile,$(call at.path,$(addsuffix /Makefile,$(at.subdirs/$(outdir)) $(at.depdirs/$(outdir)))),\ + $(foreach makefile,$(call at.path,$(addsuffix /$(at.Makefile),$(at.subdirs/$(outdir)) $(at.depdirs/$(outdir)))),\ $(eval include $(filter-out $(_at.included_makefiles),$(makefile))))) # This bit only gets evaluated once, after all of the other Makefiles are read |