diff options
| author | ruki <[email protected]> | 2024-12-16 23:04:23 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-12-16 23:04:23 +0800 |
| commit | 8150e06f3c7a58635e3953d9b32edfdf415ab7a1 (patch) | |
| tree | d7008282b82bb587f583261f2ad2079cf550311d /xmake/rules/platform/linux/module/driver_modules.lua | |
| parent | 4e7d3ddc9b5281c1be881e1a855b478bf20ef19b (diff) | |
improve to parse linux module flags
Diffstat (limited to 'xmake/rules/platform/linux/module/driver_modules.lua')
| -rw-r--r-- | xmake/rules/platform/linux/module/driver_modules.lua | 12 |
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 |
