1.Add procedure check exception 12 (overflow stack) 2.Add info in reference of...
[kolibrios.git] / programs / use_msvc.lua
blobb07f75c99bdfd154eb8338ca267b2e26a578e2c4
1 CFLAGS = "/O2 /Os /Oy /GF /GS- /GR- /EHs-c- /fp:fast /GL /QIfist /Gr /arch:IA32 /DAUTOBUILD"
2 LDFLAGS = "/section:.bss,E /fixed:no /subsystem:native /merge:.data=.text /merge:.rdata=.text /merge:.1seg=.text /entry:crtStartUp /ltcg /nodefaultlib"
4 THISDIR = tup.getcwd() -- here it points to use_msvc.lua, inside rules it would be just "."
5 OBJS = {}
7 function compile_msvc(input, output)
8 if not output then output = '%B.obj' end
9 tup.append_table(OBJS,
10 tup.foreach_rule(input, "cl /c " .. CFLAGS .. " /Fo%o %f >&2", output)
12 end
14 if tup.getconfig("TUP_PLATFORM") == "win32"
15 then env_prefix = "set EXENAME=%f&&" -- note that there should be no space between value and "&&"
16 else env_prefix = "EXENAME=%f "
17 end
19 function link_msvc(input, output)
20 if not output then input,output = OBJS,input end
22 if type(output) ~= "string" then error("output for link_msvc should be simple string") end
23 local exename = output .. ".exe"
24 local mapname = output .. ".map"
26 tup.rule(input, "link.exe " .. LDFLAGS .. " /out:%o /Map:" .. mapname .. " %f", {exename, extra_outputs = {mapname}})
27 tup.rule(exename, env_prefix .. "fasm " .. THISDIR .. "/../data/common/doexe2.asm %o " .. tup.getconfig("KPACK_CMD"), output)
28 end