Subversion Repositories Kolibri OS

Rev

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

  1. CFLAGS = "-Os -fno-ident -fomit-frame-pointer -fno-stack-check -fno-stack-protector -mno-stack-arg-probe -mpreferred-stack-boundary=2 -fno-exceptions -fno-asynchronous-unwind-tables -ffast-math -mno-ms-bitfields -march=pentium-mmx"
  2. CFLAGS_c = "" -- extra flags for *.c
  3. CFLAGS_cpp = " -fno-rtti" -- extra flags for *.cpp
  4. LDFLAGS = "-nostdlib -n --file-alignment=16 --section-alignment=16"
  5. INCLUDES = ""
  6. LIBS = ""
  7. LIBDEPS = {}
  8. OBJS = {}
  9.  
  10. function compile_gcc(input, output)
  11.   if not output then output = '%B.o' end
  12.   tup.append_table(OBJS,
  13.     tup.foreach_rule(input, "kos32-gcc -c " .. CFLAGS .. "$(CFLAGS_%e) " .. INCLUDES .. " -o %o %f", output)
  14.   )
  15. end
  16.  
  17. function link_gcc(input, output)
  18.   if not output then input,output = OBJS,input end
  19.   if tup.getconfig("HELPERDIR") == "" and #LIBDEPS then
  20.     if type(input) == "string" then input = {input} end
  21.     if not input.extra_inputs then input.extra_inputs = {} end
  22.     tup.append_table(input.extra_inputs, LIBDEPS)
  23.   end
  24.  
  25.   if type(output) == "string" then output = {output} end
  26.   if not output.extra_outputs then output.extra_outputs = {} end
  27.   table.insert(output.extra_outputs, output[1] .. ".map")
  28.  
  29.   tup.rule(input,
  30.     "kos32-ld " .. LDFLAGS .. " -o %o %f -Map %o.map " .. LIBS .. " && kos32-objcopy %o -O binary " .. tup.getconfig("KPACK_CMD"),
  31.     output)
  32. end
  33.