Rev 5106 | Rev 5131 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5106 | Rev 5123 | ||
---|---|---|---|
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" |
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 |
|
2 | LDFLAGS = "-nostdlib -n --file-alignment=16 --section-alignment=16" |
4 | LDFLAGS = "-nostdlib -n --file-alignment=16 --section-alignment=16" |
3 | INCLUDES = "" |
5 | INCLUDES = "" |
4 | LIBS = "" |
6 | LIBS = "" |
5 | LIBDEPS = {} |
7 | LIBDEPS = {} |
6 | OBJS = {} |
8 | OBJS = {} |
7 | 9 | ||
8 | function compile_gcc(input, output) |
10 | function compile_gcc(input, output) |
9 | if not output then output = '%B.o' end |
11 | if not output then output = '%B.o' end |
10 | tup.append_table(OBJS, |
12 | tup.append_table(OBJS, |
11 | tup.foreach_rule(input, "kos32-gcc -c " .. CFLAGS .. " " .. INCLUDES .. " -o %o %f", output) |
13 | tup.foreach_rule(input, "kos32-gcc -c " .. CFLAGS .. "$(CFLAGS_%e) " .. INCLUDES .. " -o %o %f", output) |
12 | ) |
14 | ) |
13 | end |
15 | end |
14 | 16 | ||
15 | function link_gcc(input, output) |
17 | function link_gcc(input, output) |
16 | if not output then input,output = OBJS,input end |
18 | if not output then input,output = OBJS,input end |
17 | if tup.getconfig("HELPERDIR") == "" and #LIBDEPS then |
19 | if tup.getconfig("HELPERDIR") == "" and #LIBDEPS then |
18 | if type(input) == "string" then input = {input} end |
20 | if type(input) == "string" then input = {input} end |
19 | if not input.extra_inputs then input.extra_inputs = {} end |
21 | if not input.extra_inputs then input.extra_inputs = {} end |
20 | tup.append_table(input.extra_inputs, LIBDEPS) |
22 | tup.append_table(input.extra_inputs, LIBDEPS) |
21 | end |
23 | end |
22 | 24 | ||
23 | if type(output) == "string" then output = {output} end |
25 | if type(output) == "string" then output = {output} end |
24 | if not output.extra_outputs then output.extra_outputs = {} end |
26 | if not output.extra_outputs then output.extra_outputs = {} end |
25 | table.insert(output.extra_outputs, output[1] .. ".map") |
27 | table.insert(output.extra_outputs, output[1] .. ".map") |
26 | 28 | ||
27 | tup.rule(input, |
29 | tup.rule(input, |
28 | "kos32-ld " .. LDFLAGS .. " -o %o %f -Map %o.map " .. LIBS .. " && kos32-objcopy %o -O binary " .. tup.getconfig("KPACK_CMD"), |
30 | "kos32-ld " .. LDFLAGS .. " -o %o %f -Map %o.map " .. LIBS .. " && kos32-objcopy %o -O binary " .. tup.getconfig("KPACK_CMD"), |
29 | output) |
31 | output) |
30 | end |
32 | end |