ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))../..) ifeq ($(origin RUSTC),undefined) RUSTC := $(or $(shell cd "$(ROOT)" && PATH="$(if $(CARGO_HOME),$(CARGO_HOME)/bin:,)$(HOME)/.cargo/bin:$$PATH" rustup which rustc 2>/dev/null),$(if $(CARGO_HOME),$(wildcard $(CARGO_HOME)/bin/rustc)),$(wildcard $(HOME)/.cargo/bin/rustc),$(shell command -v rustc 2>/dev/null)) endif include $(ROOT)/utils.mk ifeq ($(strip $(RUSTC)),) $(error rustc not found (set RUSTC or CARGO_HOME, or add rustc to PATH)) endif TASK_OUT := $(ROOT)/target/software-manager/codegen TASK_FLAGS := $(filter-out --crate-type=lib --emit=obj,$(RUST_KERNEL_FLAGS)) -C embed-bitcode=yes .PHONY: all all: mkdir -p $(TASK_OUT) rm -f $(TASK_OUT)/libnv_rs_abi.rlib $(TASK_OUT)/libnv_rs_core.rlib $(TASK_OUT)/audit.a $(TASK_OUT)/audit.o cd $(ROOT) && "$(RUSTC)" $(TASK_FLAGS) --crate-name nv_rs_abi --crate-type=rlib src/common/abi/src/lib.rs -o $(TASK_OUT)/libnv_rs_abi.rlib cd $(ROOT) && "$(RUSTC)" $(TASK_FLAGS) --crate-name nv_rs_core --crate-type=rlib src/nvidia/src/lib.rs --extern nv_rs_abi=$(TASK_OUT)/libnv_rs_abi.rlib -o $(TASK_OUT)/libnv_rs_core.rlib cd $(ROOT) && "$(RUSTC)" $(TASK_FLAGS) --crate-type=staticlib -C lto=fat --crate-name software_manager_codegen tests/software-manager/codegen.rs --extern nv_rs_abi=$(TASK_OUT)/libnv_rs_abi.rlib --extern nv_rs_core=$(TASK_OUT)/libnv_rs_core.rlib -L dependency=$(TASK_OUT) -o $(TASK_OUT)/audit.a $(LD) -r --gc-sections --whole-archive $(TASK_OUT)/audit.a --no-whole-archive -u SM_INIT -u SM_SHUT -u SM_RANGE -u SM_KEY -u SM_WITH -o $(TASK_OUT)/audit.o $(OBJCOPY) --remove-section=.llvmbc --remove-section=.llvmcmd --remove-section=.eh_frame --remove-section=.eh_frame_hdr --remove-section=.gcc_except_table $(TASK_OUT)/audit.o python3 $(ROOT)/tools/check_native_codegen.py --object $(TASK_OUT)/audit.o --report $(ROOT)/reports/software-manager-production-codegen.json --entrypoint SM_INIT --entrypoint SM_SHUT --entrypoint SM_RANGE --entrypoint SM_KEY --entrypoint SM_WITH --scope 'Compile-only real manager initialize/shutdown/scoped closure/key/range roots, using exact utils.mk production flags. Never loaded/executed. Conservative individual frames, not whole call-chain proof.'