aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/backends.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-02-16 11:14:38 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2021-02-17 14:48:04 +0200
commitb6804bf49c68ca84c22f9f0c4d18732f15461847 (patch)
treede5043918eb774229a20b469b1bed320ddf2c0a8 /mesonbuild/backend/backends.py
parentd5238baa450d1c55b838090ab50965a1ae6692a1 (diff)
downloadmeson-b6804bf49c68ca84c22f9f0c4d18732f15461847.zip
meson-b6804bf49c68ca84c22f9f0c4d18732f15461847.tar.gz
meson-b6804bf49c68ca84c22f9f0c4d18732f15461847.tar.bz2
Substitute @CURRENT_SOURCE_DIR@ in run_target() and custom_target()
run_target() does some variable substitutions since 0.57.0. This is a new behavior, and undocumented, caused by sharing more code with custom_target(). More consistency is better, so document it now. custom_target() was doing variable substitution in the past, because it shared some code with generator(), but that was undocumented. Some refactoring in 0.57.0 caused it to not replace @CURRENT_SOURCE_DIR@, @SOURCE_DIR@, and @BUILD_DIR@ anymore. This patch adds back @CURRENT_SOURCE_DIR@ and document it. It does not add back @SOURCE_DIR@ because it is duplicate with @SOURCE_ROOT@ that has a better name. Also do not add back @BUILD_DIR@ which is duplicate of @PRIVATE_DIR@, and not @BUILD_ROOT@ surprisingly, adding to the confusion.
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r--mesonbuild/backend/backends.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 2dbf1ec..ecd5067 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -1153,6 +1153,8 @@ class Backend:
i = i.replace('@SOURCE_ROOT@', source_root)
if '@BUILD_ROOT@' in i:
i = i.replace('@BUILD_ROOT@', build_root)
+ if '@CURRENT_SOURCE_DIR@' in i:
+ i = i.replace('@CURRENT_SOURCE_DIR@', os.path.join(source_root, target.subdir))
if '@DEPFILE@' in i:
if target.depfile is None:
msg = 'Custom target {!r} has @DEPFILE@ but no depfile ' \