Makefile: Add support for out-of-tree sources
Change-Id: If029c713a06a77aa8001cb4093806580086e3cbe
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/18358
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Adrian-Ken Rueegsegger <ken@codelabs.ch>
diff --git a/Makefile b/Makefile
index aa0d3ab..6e03b1a 100644
--- a/Makefile
+++ b/Makefile
@@ -122,7 +122,7 @@
$(eval include $(1)/Makefile.inc) \
$(eval $(name)-srcs += \
$(subst $(top)/,, \
- $(abspath $(addprefix $(1)/,$($(name)-y))))) \
+ $(abspath $(patsubst $(1)//%,/%,$(addprefix $(1)/,$($(name)-y)))))) \
$(eval $(name)-gens += \
$(subst $(top)/,, \
$(abspath $($(name)-gen-y)))) \
@@ -230,7 +230,7 @@
cd $(dir $@) && \
$(GNATBIND) $(addprefix -aO,$(abspath $($(name)-extra-objs))) \
-a -n -L$(name)_ada -o $(notdir $@) \
- $(subst $(dir $@),,$^)
+ $(patsubst /%,%,$(subst $(dir $@),,$^))
$(eval $(call add_ada_rule,adb,$(obj)/b__lib$(name).o:,))
$(name)-objs += $(obj)/b__lib$(name).o