From 4db6ce3424155f212a471231013846400e0db14a Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 9 Apr 2020 15:17:41 +0200 Subject: [PATCH 1/3] Makefile.include: add $(MAKEFILEDIR) helper and use it $(MAKEFILEDIR) will always evaluate to the directory of the Makefile where it's being called (evaluated). This construct is used elsewhere in RIOT, make it more accessable by defining a special variable with it. --- Makefile.include | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.include b/Makefile.include index 2aa7c7647c..91fbf43a36 100644 --- a/Makefile.include +++ b/Makefile.include @@ -8,8 +8,11 @@ ifeq (,$(filter $(MATCH_MAKE_VERSION),$(MAKE_VERSION))) $(MATCH_MAKE_VERSION) or later.) endif +# will evaluate to the absolute path of the Makefile it's evaluated in +MAKEFILEDIR = $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) + # 'Makefile.include' directory, must be evaluated before other 'include' -_riotbase := $(dir $(lastword $(MAKEFILE_LIST))) +_riotbase := $(MAKEFILEDIR) # include RIOT_MAKEFILES_GLOBAL_PRE configuration files # allows setting user specific system wide configuration parsed before the body From c1d05f07a570b1cb86249eb9cdde57d4107decfe Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 9 Apr 2020 15:20:11 +0200 Subject: [PATCH 2/3] cpu/kinetis: use $(MAKEFILEDIR) --- cpu/kinetis/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/kinetis/Makefile.include b/cpu/kinetis/Makefile.include index 5947087209..9a54d21cf9 100644 --- a/cpu/kinetis/Makefile.include +++ b/cpu/kinetis/Makefile.include @@ -1,7 +1,7 @@ ifeq (,$(KINETIS_SERIES)) # Parse parameters from CPU_MODEL using the kinetis-info.mk script in the same # directory as this Makefile. - include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/kinetis-info.mk + include $(MAKEFILEDIR)/kinetis-info.mk endif # "The Vector table must be naturally aligned to a power of two whose alignment From bba2231d41abfa67ece8d1d61f1386b6ed36599d Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 9 Apr 2020 15:21:56 +0200 Subject: [PATCH 3/3] tests: use $(MAKEFILEDIR) --- tests/cpp_exclude/module_exclude/Makefile.include | 4 ++-- tests/cpp_ext/module/Makefile.include | 2 +- tests/external_module_dirs/external_module/Makefile.include | 2 +- tests/pkg_utensor/models/Makefile.include | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/cpp_exclude/module_exclude/Makefile.include b/tests/cpp_exclude/module_exclude/Makefile.include index 1a6f083cb8..92c3a25a67 100644 --- a/tests/cpp_exclude/module_exclude/Makefile.include +++ b/tests/cpp_exclude/module_exclude/Makefile.include @@ -1,3 +1,3 @@ -# Use an immediate variable to evaluate `MAKEFILE_LIST` now -USEMODULE_INCLUDES_module_exclude := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) +# Use an immediate variable to evaluate `MAKEFILEDIR` now +USEMODULE_INCLUDES_module_exclude := $(MAKEFILEDIR) USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_module_exclude) diff --git a/tests/cpp_ext/module/Makefile.include b/tests/cpp_ext/module/Makefile.include index f8c48846e3..c3cc48bdef 100644 --- a/tests/cpp_ext/module/Makefile.include +++ b/tests/cpp_ext/module/Makefile.include @@ -1,3 +1,3 @@ # Use an immediate variable to evaluate `MAKEFILE_LIST` now -USEMODULE_INCLUDES_module := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) +USEMODULE_INCLUDES_module := $(MAKEFILEDIR) USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_module) diff --git a/tests/external_module_dirs/external_module/Makefile.include b/tests/external_module_dirs/external_module/Makefile.include index ced920dbfb..14d9974e66 100644 --- a/tests/external_module_dirs/external_module/Makefile.include +++ b/tests/external_module_dirs/external_module/Makefile.include @@ -1,3 +1,3 @@ # Use an immediate variable to evaluate `MAKEFILE_LIST` now -USEMODULE_INCLUDES_external_module := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))/include +USEMODULE_INCLUDES_external_module := $(MAKEFILEDIR)/include USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_external_module) diff --git a/tests/pkg_utensor/models/Makefile.include b/tests/pkg_utensor/models/Makefile.include index 793f6a06fd..563cf809c1 100644 --- a/tests/pkg_utensor/models/Makefile.include +++ b/tests/pkg_utensor/models/Makefile.include @@ -1,5 +1,5 @@ # Use an immediate variable to evaluate `MAKEFILE_LIST` now -USEMODULE_INCLUDES_models := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) +USEMODULE_INCLUDES_models := $(MAKEFILEDIR) USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_models) CXXEXFLAGS += -Wno-unused-parameter