diff options
| -rw-r--r-- | xmake/core/project/target.lua | 11 | ||||
| -rw-r--r-- | xmake/rules/platform/linux/driver/driver_modules.lua | 5 |
2 files changed, 9 insertions, 7 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index cb470a3c8..07327362d 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -398,6 +398,11 @@ function _instance:extraconf(name, item, key) return self._INFO:extraconf(name, item, key) end +-- set the extra configuration +function _instance:extraconf_set(name, item, key, value) + self._INFO:extraconf_set(name, item, key, value) +end + -- get user private data function _instance:data(name) return self._DATA and self._DATA[name] @@ -1239,14 +1244,8 @@ end -- set the config info to the given source file function _instance:fileconfig_set(sourcefile, info) - - -- get files config local filesconfig = self._FILESCONFIG or {} - - -- set config info filesconfig[sourcefile] = info - - -- update files config self._FILESCONFIG = filesconfig end diff --git a/xmake/rules/platform/linux/driver/driver_modules.lua b/xmake/rules/platform/linux/driver/driver_modules.lua index e3aef8c55..230a190b3 100644 --- a/xmake/rules/platform/linux/driver/driver_modules.lua +++ b/xmake/rules/platform/linux/driver/driver_modules.lua @@ -133,7 +133,10 @@ function load(target) -- add compilation flags target:set("policy", "check.auto_ignore_flags", false) target:add("defines", "__KERNEL__", "MODULE", "CC_USING_FENTRY") - target:add("defines", "KBUILD_BASENAME=\"" .. target:name() .. "\"", "KBUILD_MODNAME=\"" .. target:name() .. "\"") -- TODO + target:add("defines", "KBUILD_MODNAME=\"" .. target:name() .. "\"") + for _, sourcefile in ipairs(target:sourcefiles()) do + target:fileconfig_set(sourcefile, {defines = "KBUILD_BASENAME=\"" .. path.basename(sourcefile) .. "\""}) + end if target:is_arch("x86_64", "i386") then target:add("defines", "CONFIG_X86_X32_ABI") end |
