Subversion Repositories Kolibri OS

Rev

Rev 6549 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5132 clevermous 1
CFLAGS_GENERIC = "-fno-ident -fomit-frame-pointer -fno-stack-check -fno-stack-protector -mno-stack-arg-probe -fno-exceptions -fno-asynchronous-unwind-tables -ffast-math -mno-ms-bitfields -march=pentium-mmx"
2
CFLAGS_OPTIMIZE_SIZE = "-Os -mpreferred-stack-boundary=2 " .. CFLAGS_GENERIC
3
CFLAGS_OPTIMIZE_SPEED = "-O2 -mpush-args -mno-accumulate-outgoing-args " .. CFLAGS_GENERIC
4
-- The following could in specific cases be marginally faster CFLAGS_OPTIMIZE_SPEED,
5
-- and in all cases gives a notable overhead in size.
6
CFLAGS_OPTIMIZE_SPEED_INSANE = "-O2 " .. CFLAGS_GENERIC
7
-- Default is optimizing by size. Override on per-project or per-file basis.
9704 turbocat 8
 
9
DEFINES =" -D_KOLIBRI_ -D_KOLIBRI -DKOLIBRI -D_KOS_ -D_KOS -DKOS -U_Win32 -UWIN32 -U_WIN32 -U__MINGW32__ -U__WIN32__ "
5132 clevermous 10
CFLAGS = CFLAGS_OPTIMIZE_SIZE
11
 
5123 clevermous 12
CFLAGS_c = "" -- extra flags for *.c
13
CFLAGS_cpp = " -fno-rtti" -- extra flags for *.cpp
6549 serge 14
LDFLAGS = "-static -nostdlib -n --file-alignment=16 --section-alignment=16"
5098 clevermous 15
INCLUDES = ""
16
LIBS = ""
17
LIBDEPS = {}
18
OBJS = {}
19
 
20
function compile_gcc(input, output)
21
  if not output then output = '%B.o' end
22
  tup.append_table(OBJS,
9704 turbocat 23
    tup.foreach_rule(input, "kos32-gcc -c " .. CFLAGS .. DEFINES .. "$(CFLAGS_%e) " .. INCLUDES .. " -o %o %f", output)
5098 clevermous 24
  )
25
end
26
 
27
function link_gcc(input, output)
28
  if not output then input,output = OBJS,input end
5131 clevermous 29
  if STARTUP then
30
    table.insert(LIBDEPS, STARTUP)
31
    LDFLAGS = LDFLAGS .. " " .. STARTUP
32
  end
5098 clevermous 33
  if tup.getconfig("HELPERDIR") == "" and #LIBDEPS then
34
    if type(input) == "string" then input = {input} end
35
    if not input.extra_inputs then input.extra_inputs = {} end
36
    tup.append_table(input.extra_inputs, LIBDEPS)
37
  end
38
 
39
  if type(output) == "string" then output = {output} end
40
  if not output.extra_outputs then output.extra_outputs = {} end
41
  table.insert(output.extra_outputs, output[1] .. ".map")
42
 
43
  tup.rule(input,
44
    "kos32-ld " .. LDFLAGS .. " -o %o %f -Map %o.map " .. LIBS .. " && kos32-objcopy %o -O binary " .. tup.getconfig("KPACK_CMD"),
45
    output)
46
end