Subversion Repositories Kolibri OS

Rev

Rev 5106 | 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"
  2. LDFLAGS = "-nostdlib -n --file-alignment=16 --section-alignment=16"
  3. INCLUDES = ""
  4. LIBS = ""
  5. LIBDEPS = {}
  6. OBJS = {}
  7.  
  8. function compile_gcc(input, output)
  9.   if not output then output = '%B.o' end
  10.   tup.append_table(OBJS,
  11.     tup.foreach_rule(input, "kos32-gcc -c " .. CFLAGS .. " " .. INCLUDES .. " -o %o %f", output)
  12.   )
  13. end
  14.  
  15. function link_gcc(input, output)
  16.   if not output then input,output = OBJS,input end
  17.   if tup.getconfig("HELPERDIR") == "" and #LIBDEPS then
  18.     if type(input) == "string" then input = {input} end
  19.     if not input.extra_inputs then input.extra_inputs = {} end
  20.     tup.append_table(input.extra_inputs, LIBDEPS)
  21.   end
  22.  
  23.   if type(output) == "string" then output = {output} end
  24.   if not output.extra_outputs then output.extra_outputs = {} end
  25.   table.insert(output.extra_outputs, output[1] .. ".map")
  26.  
  27.   tup.rule(input,
  28.     "kos32-ld " .. LDFLAGS .. " -o %o %f -Map %o.map " .. LIBS .. " && kos32-objcopy %o -O binary " .. tup.getconfig("KPACK_CMD"),
  29.     output)
  30. end
  31.