diff options
| author | PierreEVEN <[email protected]> | 2025-05-13 07:36:00 +0200 |
|---|---|---|
| committer | PierreEVEN <[email protected]> | 2025-05-13 07:36:00 +0200 |
| commit | 3cdb8d984abc50bd780d74ff424daa47b6287677 (patch) | |
| tree | 9a5cd9b4162b9b996a4f187268426e12a196bc68 | |
| parent | 9b1b539d087eff3e7b62ec700839e2beb7842ebc (diff) | |
Made headeronly targets appears as phony targets (so it doesn't ask for a linker it doesn't requires)
| -rw-r--r-- | xmake/plugins/project/make/makefile.lua | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/xmake/plugins/project/make/makefile.lua b/xmake/plugins/project/make/makefile.lua index 79277b3f1..e97c50cda 100644 --- a/xmake/plugins/project/make/makefile.lua +++ b/xmake/plugins/project/make/makefile.lua @@ -334,7 +334,7 @@ function _add_toolchains(makefile, outputdir) -- add toolchains from targets for targetname, target in pairs(project.targets()) do - if not target:is_phony() then + if not _phony_or_headeronly(target) then local program = _get_program_from_target(target, target:linker():kind()) if program then makefile:print("%s_%s=%s", targetname, target:linker():kind():upper(), program) @@ -353,10 +353,14 @@ function _add_toolchains(makefile, outputdir) makefile:print("") end +function _phony_or_headeronly(target) + return target:is_phony() or target:is_headeronly() +end + -- add flags function _add_flags(makefile, targetflags, outputdir) for targetname, target in pairs(project.targets()) do - if not target:is_phony() then + if not _phony_or_headeronly(target) then for _, sourcebatch in pairs(target:sourcebatches()) do local sourcekind = sourcebatch.sourcekind if sourcekind then @@ -512,7 +516,7 @@ function _add_build_target(makefile, target, targetflags, outputdir) local precmds_label = _add_build_custom_commands_before(makefile, target, outputdir) -- is phony target? - if target:is_phony() then + if _phony_or_headeronly(target) then return _add_build_phony(makefile, target) end @@ -539,7 +543,7 @@ function _add_build_target(makefile, target, targetflags, outputdir) -- make dependence for the dependent targets for _, depname in ipairs(target:get("deps")) do local dep = project.target(depname, {namespace = target:namespace()}) - makefile:write(" " .. (dep:is_phony() and depname or _get_relative_unix_path(dep:targetfile(), outputdir))) + makefile:write(" " .. (_phony_or_headeronly(dep) and depname or _get_relative_unix_path(dep:targetfile(), outputdir))) end -- make dependence for objects @@ -650,7 +654,7 @@ function _add_clean_target(makefile, target, outputdir) makefile:write(" clean_" .. dep) end makefile:print("") - if not target:is_phony() then + if not _phony_or_headeronly(target) then _add_remove_files(makefile, target:targetfile(), outputdir) _add_remove_files(makefile, target:symbolfile(), outputdir) _add_remove_files(makefile, target:objectfiles(), outputdir) |
