summaryrefslogtreecommitdiff
path: root/xmake/rules/platform/linux/module/driver_modules.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/rules/platform/linux/module/driver_modules.lua')
-rw-r--r--xmake/rules/platform/linux/module/driver_modules.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/xmake/rules/platform/linux/module/driver_modules.lua b/xmake/rules/platform/linux/module/driver_modules.lua
index 8218a972c..3adb39d05 100644
--- a/xmake/rules/platform/linux/module/driver_modules.lua
+++ b/xmake/rules/platform/linux/module/driver_modules.lua
@@ -134,9 +134,15 @@ module_exit(hello_exit);
or (cflag:startswith("-W") and not cflag:startswith("-Wp,-MMD,") and not cflag:startswith("-Wp,-MD,"))
or (cflag:startswith("-D") and not cflag:find("KBUILD_MODNAME=") and not cflag:find("KBUILD_BASENAME=")) then
has_cflag = true
- local macro = cflag:match("%-D\"(.+)\"") -- -D"KBUILD_XXX=xxx"
- if macro then
- cflag = "-D" .. macro
+ -- https://github.com/xmake-io/xmake/discussions/5972#discussioncomment-11576255
+ local macro, value = cflag:match("%-D(.+)='(.+)'") -- -DXXX='"xxx"'
+ if macro and value and value:startswith("\"") then
+ cflag = "-D" .. macro .. "=" .. value
+ else
+ macro = cflag:match("%-D\"(.+)\"") -- -D"KBUILD_XXX=xxx"
+ if macro then
+ cflag = "-D" .. macro
+ end
end
elseif cflag == "-I" or cflag == "-isystem" or cflag == "-include" then
include_cflag = cflag