mirror of
https://github.com/pret/pokestadium.git
synced 2026-08-08 19:05:12 -05:00
Introduce a cargo workspace under tools/rust/ with a shared ps-core library and three binaries for the byte-for-byte matching effort: - ps-status: status of functions pending decompilation. Build-free mode scans GLOBAL_ASM in src/ (validated: 190 funcs across 68 files, matching grep); build-aware mode reports byte progress per folder from the linker .map, porting the progress.py metric. - ps-firstdiff: first difference(s) between built and expected ROM, with function naming and jal-target resolution (like tools/first_diff.py). - ps-fdiff: non-interactive per-function asm diff of built ROM vs baserom (like ./diff.py -mwo <func>). ps-core provides parsers for GLOBAL_ASM, symbol_addrs, and GNU ld .map files (with vram/vrom lookups), a .z64 reader with md5 verification, and a rabbitizer wrapper for disassembly. All parsers are unit-tested. Wired into tools/Makefile (cargo build, skipped with a warning if cargo is absent), target/ gitignored, and documented in README.md and tools/rust/README.md. The Python scripts (progress.py, tools/first_diff.py, diff.py) are kept in place: only the build-free ps-status path can be validated without a ROM and toolchain. Parity of the build-dependent tools must be confirmed in a full build environment before removing the Python equivalents. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
44 lines
1.1 KiB
Makefile
44 lines
1.1 KiB
Makefile
CC := gcc
|
|
CXX := g++
|
|
CFLAGS := -I . -Wall -Wextra -Wno-unused-parameter -pedantic -std=c99 -O2 -s
|
|
CXXFLAGS := -I . -Wall -Wextra -std=c++17
|
|
LDFLAGS := -lm
|
|
PROGRAMS := vtxdis
|
|
|
|
ifeq ($(VERBOSE),0)
|
|
V := @
|
|
endif
|
|
|
|
default: all
|
|
|
|
n64crc_SOURCES := vtxdis.c
|
|
|
|
all: $(PROGRAMS) rust
|
|
|
|
# Build the Rust matching tools (ps-status, ps-firstdiff, ps-fdiff). Skipped
|
|
# with a warning when cargo is unavailable so the C-only workflow still works.
|
|
rust:
|
|
@if command -v cargo >/dev/null 2>&1; then \
|
|
echo "Building Rust matching tools..."; \
|
|
cargo build --release --manifest-path rust/Cargo.toml; \
|
|
else \
|
|
echo "WARNING: cargo not found; skipping Rust tools (ps-status, ps-firstdiff, ps-fdiff)."; \
|
|
echo " Install Rust from https://rustup.rs to build them."; \
|
|
fi
|
|
|
|
clean:
|
|
$(V)rm -Rf $(PROGRAMS) $(BUILD_DIR)
|
|
$(V)command -v cargo >/dev/null 2>&1 && cargo clean --manifest-path rust/Cargo.toml || true
|
|
|
|
distclean: clean
|
|
|
|
vtxdis: vtxdis.c
|
|
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
|
|
|
|
$(BUILD_DIR)/%.o: %.c
|
|
$(CC) -c $^ -o $@ $(CFLAGS)
|
|
$(BUILD_DIR)/%.o: %.cpp
|
|
$(CXX) -c $< -o $@ $(CXXFLAGS)
|
|
|
|
.PHONY: all clean distclean default rust
|