added buildinputs support to make action
This commit is contained in:
parent
81158c0eb7
commit
7c4eed3d1c
@ -154,7 +154,12 @@
|
||||
_x('ifeq ($(config),%s)', cfg.shortname)
|
||||
|
||||
local output = project.getrelative(prj, filecfg.buildoutputs[1])
|
||||
_x('%s: %s', output, filecfg.relpath)
|
||||
local dependencies = filecfg.relpath
|
||||
if filecfg.buildinputs and #filecfg.buildinputs > 0 then
|
||||
local inputs = project.getrelative(prj, filecfg.buildinputs)
|
||||
dependencies = dependencies .. " " .. table.concat(inputs, " ")
|
||||
end
|
||||
_x('%s: %s', output, dependencies)
|
||||
_p('\t@echo "%s"', filecfg.buildmessage or ("Building " .. filecfg.relpath))
|
||||
for _, cmd in ipairs(filecfg.buildcommands) do
|
||||
_p('\t$(SILENT) %s', cmd)
|
||||
|
@ -92,3 +92,30 @@ obj/Release/hello.obj: hello.x
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.customBuildRuleWithAdditionalInputs()
|
||||
files { "hello.x" }
|
||||
filter "files:**.x"
|
||||
buildmessage "Compiling %{file.name}"
|
||||
buildcommands {
|
||||
'cxc -c "%{file.path}" -o "%{cfg.objdir}/%{file.basename}.xo"',
|
||||
'c2o -c "%{cfg.objdir}/%{file.basename}.xo" -o "%{cfg.objdir}/%{file.basename}.obj"'
|
||||
}
|
||||
buildoutputs { "%{cfg.objdir}/%{file.basename}.obj" }
|
||||
buildinputs { "%{file.path}.inc", "%{file.path}.inc2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
ifeq ($(config),debug)
|
||||
obj/Debug/hello.obj: hello.x hello.x.inc hello.x.inc2
|
||||
@echo "Compiling hello.x"
|
||||
$(SILENT) cxc -c "hello.x" -o "obj/Debug/hello.xo"
|
||||
$(SILENT) c2o -c "obj/Debug/hello.xo" -o "obj/Debug/hello.obj"
|
||||
endif
|
||||
ifeq ($(config),release)
|
||||
obj/Release/hello.obj: hello.x hello.x.inc hello.x.inc2
|
||||
@echo "Compiling hello.x"
|
||||
$(SILENT) cxc -c "hello.x" -o "obj/Release/hello.xo"
|
||||
$(SILENT) c2o -c "obj/Release/hello.xo" -o "obj/Release/hello.obj"
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
Reference in New Issue
Block a user