Add riscv64-clang Makefile target; closes out 2026-07-24 punch list
Resolves item #3 of docs/working/archive/session-logs/2026-07-24-punch-list.md ("riscv64 hosted build isn't reachable via plain make"), the last open item from that list. Decided against options (b) chasing GCC's riscv64 nanosleep-visibility failure at its root (undiagnosed, open-ended) and (c) leaving it manual — instead wired the already-verified clang recipe (commit4485c38/e287334) into the Makefile, mirroring the existing rpi4-cross pattern. Makefile: new riscv64-clang target. CFLAGS deliberately does not reuse $(BASE_CFLAGS) (hardcodes -std=c99); clang needs -std=c11 -pthread here instead. Registered in `make help` and .PHONY. docs/lithosananke/hosted-acceptance-test/README.md: riscv64 section now points at `make riscv64-clang` instead of the long manual invocation. Updated Background section and commit list to reflect that all three punch-list items touching this doc (#1 asm fix, #2 doc command, #3 make target) are now resolved. Verified: `make riscv64-clang` produces a binary with identical results to the manual command it replaces (965 passed / 0 failed, "ALL IMPLEMENTED TESTS PASSED!", "3 Goodbye!" for the piped acceptance script). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
e287334216
commit
d922e152aa
@@ -475,7 +475,7 @@ CONFDIR = $(PREFIX)/etc/starforth
|
||||
|
||||
.PHONY: all banner help clean clean-obj clean-docs starkernel mkcapsule capsule-gen capsule-manifest
|
||||
.PHONY: fastest fast turbo
|
||||
.PHONY: rpi4 rpi4-cross rpi4-fastest
|
||||
.PHONY: rpi4 rpi4-cross rpi4-fastest riscv64-clang
|
||||
.PHONY: minimal debug profile performance
|
||||
.PHONY: test bench benchmark
|
||||
.PHONY: asm sbom
|
||||
@@ -562,6 +562,23 @@ rpi4-fastest:
|
||||
all
|
||||
@echo "✓ Raspberry Pi FASTEST build ready: $(call binary_path,fastest,raspi)"
|
||||
|
||||
# RISC-V 64 - cross-compile via clang (GCC fails to build this tree under
|
||||
# -std=c99: a nanosleep visibility failure, not yet root-caused — see
|
||||
# docs/lithosananke/hosted-acceptance-test/README.md and
|
||||
# docs/working/archive/session-logs/2026-07-24-punch-list.md item #3).
|
||||
# CFLAGS deliberately does NOT reuse $(BASE_CFLAGS): BASE_CFLAGS hardcodes
|
||||
# -std=c99, and clang needs -std=c11 -pthread here. This mirrors the exact
|
||||
# recipe verified in the hosted-acceptance-test doc, kept in sync with it.
|
||||
riscv64-clang:
|
||||
@echo "🦀 Cross-compiling for RISC-V 64 (clang)..."
|
||||
@$(MAKE) ARCH=riscv64 TARGET=fastest \
|
||||
CC="clang-18 --target=riscv64-linux-gnu --sysroot=/usr/riscv64-linux-gnu" \
|
||||
CFLAGS="-std=c11 -pthread -Wall -Werror -Iinclude -Isrc/word_source -Isrc/test_runner/include -DSTRICT_PTR=1 -march=rv64gc -mabi=lp64d -mcmodel=medany -DARCH_RISCV64=1 -O3 -DUSE_ASM_OPT=1 -DUSE_DIRECT_THREADING=1 -DNDEBUG -flto -static" \
|
||||
LDFLAGS="-flto -s -static -fuse-ld=lld" \
|
||||
all
|
||||
@echo "✓ Cross-compiled binary ready: $(call binary_path,fastest,riscv64)"
|
||||
@echo " Run: qemu-riscv64 $(call binary_path,fastest,riscv64)"
|
||||
|
||||
# Minimal/embedded build
|
||||
minimal:
|
||||
$(MAKE) MINIMAL=1
|
||||
@@ -1267,6 +1284,7 @@ help:
|
||||
@echo " rpi4 - Native build on Raspberry Pi 4"
|
||||
@echo " rpi4-cross - Cross-compile from x86_64"
|
||||
@echo " rpi4-fastest - Maximum optimization for RPi4"
|
||||
@echo " riscv64-clang - Cross-compile for RISC-V 64 via clang (GCC fails here)"
|
||||
@echo " minimal - Minimal/embedded build"
|
||||
@echo ""
|
||||
@echo "🔧 DEBUG & DEVELOPMENT:"
|
||||
@@ -1322,6 +1340,7 @@ help:
|
||||
@echo "📋 EXAMPLES:"
|
||||
@echo " make fastest # Fastest build for current platform"
|
||||
@echo " make rpi4-cross # Cross-compile for Raspberry Pi 4"
|
||||
@echo " make riscv64-clang # Cross-compile for RISC-V 64 (clang)"
|
||||
@echo " make asm # Generate assembly for inspection"
|
||||
@echo " make debug # Debug build"
|
||||
@echo " make PREFIX=/usr/local install # Install system-wide"
|
||||
|
||||
Reference in New Issue
Block a user