code wiki / (root) / nxmake.nx

nxmake.nx

buildroot/runtime/nxmake.nx

18684 B492 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nxmake.nx -- sovereign build driver (replaces GNU make). Scope claim: GNU make is Turing-complete and huge. We don't need most of it. The typical Nishi build is: list of inputs -> one or more command invocations -> an output file. Make's real differentiator is MTIME-based staleness checking; we replicate that with fs.nx's fstat. Replaces on the Nishi build path: make / gmake / bmake — any POSIX make File format: plain-text stanzas in "nx.build": target: kernel.elf inputs: boot.S trap.S src/sched_bootstrap.S nishi-kernel.s cmd: ./nxld --base 0x80000000 -o kernel.elf <inputs> target: nishi-kernel.s inputs: src/kmain.nx src/uart.nx ... cmd: ./nxc2 --target asm --opt src/kmain.nx > $@ Comments: lines starting with '#'. Blank lines separate stanzas. Subprocess-exec is intentionally absent from this seed. Windows host (CreateProcessA) and Linux host (clone+execve) diverge at the syscall layer and we don't have a portable abstraction yet. Instead nxmake emits a build plan -- an ordered list of commands and their staleness verdicts -- that a thin shim script runs. This is honest: nxmake owns the dependency reasoning, the shim owns the syscall specifics. Decoupled sovereignty.

dependencies 2 imports · 0 importers

syscalls.nx fs.nx nxmake.nx

imports: syscalls.nxfs.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_read_file sys_openat_rd sys_lseek sys_mmap sys_read sys_close split_lines line_off_p line_len_p parse_rules line_off_p ↻ line_len_p ↻ trim_left trim_right slice_starts_with nxmake_strlen rule_target_off rule_target_len rule_n_inputs rule_inputs_at rule_cmd_off rule_cmd_len input_off_p input_len_p nxmake_strlen ↻ rule_target_off ↻ rule_target_len ↻ emit_plan_for rule_n_inputs ↻ rule_inputs_at ↻ input_off_p ↻ input_len_p ↻ find_rule rule_target_off ↻ rule_target_len ↻ emit_plan_for ↻ rule_target_off ↻ rule_target_len ↻ rule_cmd_off ↻

structs

none

consts

50const MAX_RULES: i64 = 64
51const MAX_INPUTS: i64 = 1024
52const MAX_LINES: i64 = 512
53const RULE_SIZE: i64 = 48
54const INPUT_SIZE: i64 = 16
55const LINE_SIZE: i64 = 16

functions

58func rule_target_off(rb: i64, i: i64) -> *i64 { let a: i64 = rb + i * RULE_SIZE + 0; return a as *i64 }
59func rule_target_len(rb: i64, i: i64) -> *i64 { let a: i64 = rb + i * RULE_SIZE + 8; return a as *i64 }
60func rule_n_inputs(rb: i64, i: i64) -> *i64 { let a: i64 = rb + i * RULE_SIZE + 16; return a as *i64 }
61func rule_inputs_at(rb: i64, i: i64) -> *i64 { let a: i64 = rb + i * RULE_SIZE + 24; return a as *i64 }
62func rule_cmd_off(rb: i64, i: i64) -> *i64 { let a: i64 = rb + i * RULE_SIZE + 32; return a as *i64 }
63func rule_cmd_len(rb: i64, i: i64) -> *i64 { let a: i64 = rb + i * RULE_SIZE + 40; return a as *i64 }
65func input_off_p(ib: i64, j: i64) -> *i64 { let a: i64 = ib + j * INPUT_SIZE + 0; return a as *i64 }
66func input_len_p(ib: i64, j: i64) -> *i64 { let a: i64 = ib + j * INPUT_SIZE + 8; return a as *i64 }
68func line_off_p(lb: i64, k: i64) -> *i64 { let a: i64 = lb + k * LINE_SIZE + 0; return a as *i64 }
69func line_len_p(lb: i64, k: i64) -> *i64 { let a: i64 = lb + k * LINE_SIZE + 8; return a as *i64 }
75func nxmake_strlen(p: *u8) -> i64 {
83func slice_eq_cstr(buf: *u8, off: i64, len: i64, kw: *u8) -> i64 {
calls 1: nxmake_strlen
95func slice_starts_with(buf: *u8, off: i64, len: i64, kw: *u8) -> i64 {
called by 1: parse_rules calls 1: nxmake_strlen
107func slice_to_cstr(buf: *u8, off: i64, len: i64, out: *u8) -> i64 {
called by 1: slice_mtime
118func trim_left(buf: *u8, off: i64, end: i64) -> i64 {
called by 1: parse_rules
132func trim_right(buf: *u8, off: i64, len: i64) -> i64 {
called by 1: parse_rules
151func split_lines(buf: *u8, n: i64, line_base: i64) -> i64 {
called by 1: main calls 2: line_off_pline_len_p
194func parse_rules(
310func nxmake_mtime(path: *u8) -> i64 {
called by 1: slice_mtime calls 1: fs_open_rd_raw
325func find_rule(
350func slice_mtime(buf: *u8, off: i64, len: i64) -> i64 {
called by 1: is_stale calls 2: slice_to_cstrnxmake_mtime
357func is_stale(
388func emit_plan_for(
431func main(argc: i64, argv: *i64) -> i64 {