build: build jasm with installed jerbuild (no jerboa checkout)

ober

180ed85fa2e44caefd891f69ec975fee8a3db8f3

diff --git a/.jerbuild b/.jerbuild
index f1eeaf8..af8d044 100644
--- a/.jerbuild
+++ b/.jerbuild
@@ -1,7 +1,9 @@
-;; Build jasm with a standalone jerbuild binary.
+;; Build jasm with a standalone jerbuild binary: `jerbuild build`.
+;;
+;; jerbuild bundles Chez Scheme + the jerboa stdlib, so NO jerboa source
+;; checkout and NO separately-built Chez is required — only a C compiler (cc)
+;; for the final link. Pure Jerboa: no jerboa-native-rs and no DuckDB.
 
 (entry "main.ss")
 (output "jasm")
-(requires "cc")
-(notes "Pure Jerboa build. jerboa-native-rs and DuckDB are not required.")
 (libdirs "lib")
diff --git a/Makefile b/Makefile
index 977d4b6..82e2b93 100644
--- a/Makefile
+++ b/Makefile
@@ -1,54 +1,41 @@
-JERBOA_HOME ?= /Users/user/mine/jerboa
-JERBOA ?= $(JERBOA_HOME)/bin/jerboa
-LIBDIRS := $(JERBOA_HOME)/lib
+# jerbuild bundles Chez Scheme + the jerboa stdlib under ~/.cache/jerbuild/,
+# so building jasm needs only `jerbuild` + a C compiler — no jerboa source
+# checkout and no separately-built Chez.
+JERBUILD ?= jerbuild
+JH := $(shell $(JERBUILD) --jerboa-home 2>/dev/null)
+ifeq ($(JH),)
+$(error jerbuild not found on PATH (or '$(JERBUILD) --jerboa-home' failed). Install jerbuild, or set JERBUILD=/path/to/jerbuild)
+endif
+
+LIBDIRS := --libdirs lib:$(JH)/lib
+JEXEC := $(JERBUILD) exec $(LIBDIRS)
 BINARY := jasm
-BUILD_MAIN := .jasm-main-build.ss
-JASM_SOURCES := \
-	lib/jasm/instruction.ss \
-	lib/jasm/format.ss \
-	lib/jasm/disasm.ss \
-	lib/jasm/object/elf.ss \
-	lib/jasm/object/macho.ss \
-	lib/jasm/object/coff.ss \
-	lib/jasm/object/archive.ss
-
-.PHONY: test check run build-main binary test-binary clean
 
-test:
-	JERBOA_HOME=$(JERBOA_HOME) $(JERBOA) exec tests/test-jasm.ss
+.PHONY: all build binary run test check test-binary clean
 
-check: test
+all: binary
+
+# Standalone native binary via .jerbuild (entry main.ss -> jasm).
+binary:
+	$(JERBUILD) build
+
+build: binary
 
 run:
-	JERBOA_HOME=$(JERBOA_HOME) $(JERBOA) exec main.ss --help
+	$(JEXEC) main.ss --help
 
-build-main:
-	printf '(import (except (rnrs) partition) (jerboa prelude))\n\n' > $(BUILD_MAIN)
-	for f in $(JASM_SOURCES); do sed '/^(import (jerboa prelude))$$/d' $$f >> $(BUILD_MAIN); printf '\n' >> $(BUILD_MAIN); done
-	sed '1,/^(include "lib\/jasm\/object\/archive.ss")$$/d' main.ss >> $(BUILD_MAIN)
+test:
+	$(JEXEC) tests/test-jasm.ss
 
-binary: test build-main
-	JERBOA_HOME=$(JERBOA_HOME) \
-	BINARY_LIBDIRS=$(LIBDIRS) \
-	$(JERBOA_HOME)/support/build-binary.sh $(BUILD_MAIN) $(BINARY)
+check: test
 
+# Smoke-test the built binary across architectures.
 test-binary: binary
 	test -x ./$(BINARY)
-	file ./$(BINARY)
-	./$(BINARY) headers ./$(BINARY)
 	./$(BINARY) raw --arch x86-64 --syntax intel --hex '55 48 89 e5 c3'
 	./$(BINARY) raw --arch aarch64 --hex '20 00 80 d2 c0 03 5f d6'
 	./$(BINARY) raw --arch riscv64 --hex '13 01 01 ff 67 80 00 00'
-	JERBOA_HOME=$(JERBOA_HOME) $(JERBOA) exec tests/write-raw-bytes.ss ./.jasm-raw.bin
-	./$(BINARY) raw --arch x86-64 --syntax intel --max-bytes 2 --file ./.jasm-raw.bin
-	JERBOA_HOME=$(JERBOA_HOME) $(JERBOA) exec tests/write-sample-elf.ss ./.jasm-sample.o
-	./$(BINARY) headers ./.jasm-sample.o
-	./$(BINARY) sections ./.jasm-sample.o
-	./$(BINARY) symbols ./.jasm-sample.o
-	./$(BINARY) relocs ./.jasm-sample.o
-	./$(BINARY) object --section .text --syntax intel ./.jasm-sample.o
-	rm -f ./.jasm-sample.o ./.jasm-raw.bin
 
 clean:
-	rm -f $(BINARY) $(BINARY).wp.so $(BINARY)-main.c petite_boot.h scheme_boot.h program_boot.h .jasm-sample.o .jasm-test-sample.o .jasm-raw.bin $(BUILD_MAIN)
+	rm -f $(BINARY) $(BINARY).wp.so $(BINARY)-main.c petite_boot.h scheme_boot.h program_boot.h .jasm-sample.o .jasm-test-sample.o .jasm-raw.bin
 	find . \( -name '*.so' -o -name '*.wpo' \) -print0 | xargs -0 rm -f
diff --git a/jasm b/jasm
index 9bc498a..6900ab1 100755
Binary files a/jasm and b/jasm differ