Rewrite the lunabuild toolchain with enhanced feature (#60)
[lunaix-os.git] / lunaix-os / arch / x86 / LBuild
1 from . import hal
2
3 src.c += (
4     "exceptions/interrupts.c",
5     "exceptions/isrdef.c",
6     "exceptions/intrhnds.S",
7 )
8
9 src.c += (
10     "boot/mb_parser.c",
11     "boot/kpt_setup.c",
12     "boot/boot_helper.c",
13 )
14
15 src.c += (
16     "mm/fault.c",
17     "mm/tlb.c",
18     "mm/pmm.c",
19     "mm/gdt.c",
20     "mm/vmutils.c"
21 )
22
23 src.c += (
24     "klib/fast_crc.c",
25     "klib/fast_str.c",
26     "exec/exec.c",
27     "hart.c",
28     "arch.c",
29     "gdbstub.c",
30     "trace.c",
31     "hart.c",
32     "failsafe.S",
33     "syscall_lut.S"
34 )
35
36 match config.arch:
37     case "x86_64":
38         src.c += (
39             "hart64.c",
40             "syscall64.S",
41             "exceptions/interrupt64.S",
42             "boot/x86_64/boot64.S",
43             "boot/x86_64/init64.c",
44             "boot/x86_64/prologue64.S",
45             "boot/x86_64/kremap64.c",
46             "exec/elf64.c"
47         )
48     case "i386":
49         src.c += (
50             "hart32.c",
51             "syscall32.S",
52             "exceptions/interrupt32.S",
53             "boot/i386/boot32.S",
54             "boot/i386/init32.c",
55             "boot/i386/prologue32.S",
56             "boot/i386/kremap32.c",
57             "exec/elf32.c"
58         )
59
60 src.h += "includes"
61
62 if config.arch == "x86_64":
63     flag.cc += (
64         "-m64", 
65         "-fno-unwind-tables", 
66         "-fno-asynchronous-unwind-tables",
67         "-mcmodel=large"
68     )
69     flag.ld += "-m64"
70 else:
71     flag.cc += "-m32"
72     flag.ld += "-m32"
73
74 if not config.x86_enable_sse_feature:
75     flag.cc += "-mno-sse"