Rewrite the lunabuild toolchain with enhanced feature (#60)
[lunaix-os.git] / lunaix-os / usr / LBuild
index 320bbebd3c3da3711a373d254f1e6ca143d9a0bd..05a12461912f94768e8e0c88e6a2e436039b32a8 100644 (file)
@@ -1,4 +1,4 @@
-sources([
+src.c += (
     "testp",
     "ls",
     "signal_demo",
@@ -9,38 +9,44 @@ sources([
     "maze",
     "mkdir",
     "rm",
-    "testfork",
     "fragfile",
-])
+)
 
-compile_opts([
+flag.cc += (
     "-ffreestanding",
-    "-fno-pie"
-])
+    "-fno-pie",
+    "-Werror"
+)
 
-linking_opts([
+flag.ld += (
     "-nostdlib", 
     "-nolibc", 
     "-z noexecstack", 
     "-no-pie", 
-])
+)
 
-linking_opts([
+flag.ld += (
     "-Wl,--build-id=none"
-])
+)
 
-if config("arch") == "x86_64":
-    compile_opts([
-        "-m64", 
-        "-fno-unwind-tables", 
-        "-fno-asynchronous-unwind-tables",
-        "-mcmodel=large"
-    ])
-    linking_opts([
-        "-m64",
-    ])
-else:
-    compile_opts("-m32")
-    linking_opts("-m32")
+match env.ARCH:
+    case "x86_64":
+        flag.cc += (
+            "-m64", 
+            "-fno-unwind-tables", 
+            "-fno-asynchronous-unwind-tables",
+            "-mcmodel=large",
+            "-DCONFIG_ARCH_X86_64"
+        )
+        flag.ld += (
+            "-m64",
+        )
+    case "i386":
+        flag.cc += "-m32", "-DCONFIG_ARCH_X86_32"
+        flag.ld += "-m32"
 
-compile_opts("-mno-sse")
\ No newline at end of file
+flag.cc += "-mno-sse"
+
+flag.cc += (
+    "-Wno-discarded-qualifiers"
+)
\ No newline at end of file