summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-07-12 21:37:14 +0800
committerGitHub <[email protected]>2021-07-12 21:37:14 +0800
commit52d8385e5446ad607d1a0fb1c34581eeefc764db (patch)
tree3b2afc3651de08823a2027cdb4518917ce9015f9
parent6947f79ae1d345849789934501933e9edb8c1f07 (diff)
parent2cf812f131ea771dd81117a815b1131d99009589 (diff)
Merge pull request #1510 from norech/fix/makefile-when-dot-targetdir
Makefile generation: fix circular dependency when targetdir is "."
-rw-r--r--xmake/plugins/project/make/makefile.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/xmake/plugins/project/make/makefile.lua b/xmake/plugins/project/make/makefile.lua
index 75afafa92..6b94cf992 100644
--- a/xmake/plugins/project/make/makefile.lua
+++ b/xmake/plugins/project/make/makefile.lua
@@ -220,8 +220,17 @@ function _make_target(makefile, target, targetflags)
-- make head
local targetfile = target:targetfile()
- makefile:print("%s: %s", target:name(), targetfile)
- makefile:printf("%s:", targetfile)
+ local targetname = target:name()
+
+ -- rules like `./target` and `target` are equivalent and can causes issues
+ -- for cases where targetdir is .
+ -- in these cases, the targetfile rule is not created
+ if targetfile == "./" .. targetname then
+ makefile:printf("%s:", targetname)
+ else
+ makefile:print("%s: %s", targetname, targetfile)
+ makefile:printf("%s:", targetfile)
+ end
-- make dependence for the dependent targets
for _, depname in ipairs(target:get("deps")) do