Commit 28cb2129

28cb212936b1Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 9 files · +2 added · ~6 modified · -1 deleted

Description

Isolate the legacy compiler under build/legacy, split the spinel driver

The legacy Ruby backend is now fully separated from the normal build:

  • All legacy artifacts (bootstrap intermediates, the spinel_analyze / spinel_codegen binaries, and content stamps) build under build/legacy/ instead of the repo root and the shared build/ tree. The legacy/ source directory is never touched by the normal C build.
  • The content-stamp machinery is now legacy-only: it moved from common.mk into legacy/Makefile (stamps live in build/legacy/stamps). The normal build depends on its sources directly, so spinel_parse no longer goes through a stamp.
  • spinel is now the C-compiler driver: it runs build/spinelc to emit C and links it against libspinel_rt.a (parse + analyze + codegen happen in the one spinelc process). The old Ruby-backend driver is renamed to spinel-legacy (and spinel.bat to spinel-legacy.bat), pointing at the build/legacy binaries.
  • make install ships the C compiler only; the legacy backend is a local regression oracle and is not installed.

Gates: make check (845 pass, 0 fail), make legacy, and the 4-way make bootstrap self-host fixpoint all pass over the new layout.

Co-Authored-By: Claude Opus 4.8 [email protected]

Details

Commit
28cb212936b1
Parent
c56ea1f7442b

MakefilemodifiedView file

@@ -38,8 +38,6 @@
3838 RBS_OBJ = $(patsubst $(RBS_DIR)/src/%.c,build/rbs/%.o,$(RBS_SRC))
3939 RBS_LIB = build/librbs.a
4040
41-PARSE_STAMP := build/stamps/spinel_parse.c.stamp
42-
4341 .PHONY: all parse spinelc legacy bootstrap codegen regexp rbs_extract rbs-test \
4442 analyze-fail-test test test-run clean-test-results regen-rbs-expected \
4543 regen-expected bench optcarrot gate check gate-legs gate-test gate-bench \
@@ -117,7 +115,7 @@
117115
118116 parse: spinel_parse$(EXE)
119117
120-spinel_parse$(EXE): $(PARSE_STAMP) $(PRISM_LIB)
118+spinel_parse$(EXE): spinel_parse.c $(PRISM_LIB)
121119 $(CC) $(CFLAGS) -I$(PRISM_INC) spinel_parse.c $(PRISM_LIB) -lm -o $@
122120
123121 # ---- C compiler (src/) ----
@@ -492,15 +490,13 @@
492490 PREFIX ?= /usr/local
493491 SPNLDIR = $(PREFIX)/lib/spinel
494492
495-install: all legacy
493+# Install the C compiler only. The legacy Ruby compiler is a local
494+# regression oracle (build/legacy/, `make legacy`/`bootstrap`) and is not
495+# shipped — `spinel-legacy` stays in the source tree for comparison.
496+install: all
496497 install -d $(SPNLDIR)/lib
497498 install -m 755 spinel $(SPNLDIR)/
498- install -m 755 spinel_parse$(EXE) $(SPNLDIR)/
499- install -m 755 spinel_analyze$(EXE) $(SPNLDIR)/
500- install -m 755 spinel_codegen$(EXE) $(SPNLDIR)/
501- install -m 644 legacy/node_table_loader.rb $(SPNLDIR)/
502- install -m 644 legacy/spinel_analyze.rb $(SPNLDIR)/
503- install -m 644 legacy/spinel_codegen.rb $(SPNLDIR)/
499+ install -m 755 $(SPINELC) $(SPNLDIR)/spinelc$(EXE)
504500 install -m 644 lib/libspinel_rt.a $(SPNLDIR)/lib/
505501 install -m 644 lib/sp_runtime.h $(SPNLDIR)/lib/
506502 install -m 644 lib/sp_types.h $(SPNLDIR)/lib/
@@ -521,6 +517,9 @@
521517
522518 # ---- Clean ----
523519
520+# `rm -rf build/` also wipes build/legacy (the legacy compiler's binaries
521+# and bootstrap intermediates). Only the root-level C artifacts need an
522+# explicit rm; the legacy binaries no longer live at the repo root.
524523 clean:
525524 rm -rf build/
526- rm -f spinel_parse$(EXE) spinel_analyze$(EXE) spinel_codegen$(EXE) spinel_rbs_extract$(EXE)
525+ rm -f spinel_parse$(EXE) spinel_rbs_extract$(EXE)