Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  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"
  3.  
  4. THISDIR = tup.getcwd() -- here it points to use_msvc.lua, inside rules it would be just "."
  5. OBJS = {}
  6.  
  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)
  11.   )
  12. end
  13.  
  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
  18.  
  19. function link_msvc(input, output)
  20.   if not output then input,output = OBJS,input end
  21.  
  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"
  25.  
  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/eng/doexe2.asm %o " .. tup.getconfig("KPACK_CMD"), output)
  28. end
  29.