This repository was archived by the owner on Aug 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
60 lines (47 loc) · 1.6 KB
/
xmake.lua
File metadata and controls
60 lines (47 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
set_project("AstrConter")
add_rules("mode.debug", "mode.release")
set_arch("i386")
set_languages("c23")
set_optimize("fastest")
set_warnings("all", "error")
set_policy("run.autobuild", true)
set_policy("check.auto_ignore_flags", false)
add_cflags("-mno-mmx", "-mno-sse", "-mno-sse2")
add_cflags("-nostdinc", "-fno-pic", "-fno-builtin", "-fno-stack-protector", "-D OS_INFO_=\"XMAKE\"")
add_ldflags("-nostdlib", "-static")
target("kernel")
set_kind("binary")
set_toolchains("gcc", "nasm")
set_toolset("as", "nasm")
set_default(false)
add_linkdirs("lib")
add_includedirs("include")
add_links("klogo")
add_links("elf_parse")
add_links("os_terminal")
add_links("pl_readline")
add_files("**/*.s", "**/*.c")
add_asflags("-f", "elf32")
add_ldflags("-T", "scripts/kernel.ld")
target("iso")
set_kind("phony")
add_deps("kernel")
set_default(true)
on_build(function (target)
import("core.project.project")
local iso_dir = "$(buildir)/iso_dir"
if os.exists(iso_dir) then os.rmdir(iso_dir) end
os.cp("assets", iso_dir)
local kernel = project.target("kernel")
os.cp(kernel:targetfile(), iso_dir .. "/astrknl")
local iso_file = "$(buildir)/AstrConter.iso"
local xorriso_flags = "-b limine-bios-cd.bin -no-emul-boot -boot-info-table"
os.run("xorriso -as mkisofs %s %s -o %s", xorriso_flags, iso_dir, iso_file)
print("ISO image created at: " .. iso_file)
end)
on_run(function (target)
local misc = "-serial stdio"
local speaker = " -audiodev pa,id=speaker -machine pcspk-audiodev=speaker"
local flags = misc..speaker
os.exec("qemu-system-i386 -cdrom $(buildir)/AstrConter.iso %s", flags)
end)