code wiki / (root) / nx_nxmake.nx

nx_nxmake.nx

buildroot/runtime/nx_nxmake.nx

18449 B498 linesdepth 3pulls 3 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

nx_syscalls.nx nx_fs.nx nx_nxmake.nx

imports: nx_syscalls.nxnx_fs.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sys_write 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 ↻

structs

none

consts

56const MAX_RULES: i64 = 64
57const MAX_INPUTS: i64 = 1024
58const MAX_LINES: i64 = 512
59const RULE_SIZE: i64 = 48
60const INPUT_SIZE: i64 = 16
61const LINE_SIZE: i64 = 16

functions

64func rule_target_off(rb: i64, i: i64) -> *i64 { let a: i64 = rb + i * RULE_SIZE + 0; return a as *i64 }
65func rule_target_len(rb: i64, i: i64) -> *i64 { let a: i64 = rb + i * RULE_SIZE + 8; return a as *i64 }
66func rule_n_inputs(rb: i64, i: i64) -> *i64 { let a: i64 = rb + i * RULE_SIZE + 16; return a as *i64 }
67func rule_inputs_at(rb: i64, i: i64) -> *i64 { let a: i64 = rb + i * RULE_SIZE + 24; return a as *i64 }
68func rule_cmd_off(rb: i64, i: i64) -> *i64 { let a: i64 = rb + i * RULE_SIZE + 32; return a as *i64 }
69func rule_cmd_len(rb: i64, i: i64) -> *i64 { let a: i64 = rb + i * RULE_SIZE + 40; return a as *i64 }
71func input_off_p(ib: i64, j: i64) -> *i64 { let a: i64 = ib + j * INPUT_SIZE + 0; return a as *i64 }
72func input_len_p(ib: i64, j: i64) -> *i64 { let a: i64 = ib + j * INPUT_SIZE + 8; return a as *i64 }
74func line_off_p(lb: i64, k: i64) -> *i64 { let a: i64 = lb + k * LINE_SIZE + 0; return a as *i64 }
75func line_len_p(lb: i64, k: i64) -> *i64 { let a: i64 = lb + k * LINE_SIZE + 8; return a as *i64 }
81func nxmake_strlen(p: *u8) -> i64
89func slice_eq_cstr(buf: *u8, off: i64, len: i64, kw: *u8) -> i64
calls 1: nxmake_strlen
101func slice_starts_with(buf: *u8, off: i64, len: i64, kw: *u8) -> i64
called by 1: parse_rules calls 1: nxmake_strlen
113func slice_to_cstr(buf: *u8, off: i64, len: i64, out: *u8) -> i64
called by 1: slice_mtime
124func trim_left(buf: *u8, off: i64, end: i64) -> i64
called by 1: parse_rules
138func trim_right(buf: *u8, off: i64, len: i64) -> i64
called by 1: parse_rules
157func split_lines(buf: *u8, n: i64, line_base: i64) -> i64
called by 1: main calls 2: line_off_pline_len_p
200func parse_rules(
316func nxmake_mtime(path: *u8) -> i64
331func find_rule(
356func slice_mtime(buf: *u8, off: i64, len: i64) -> i64
363func is_stale(
394func emit_plan_for(
437func main(argc: i64, argv: *i64) -> i64