From ce445ce27a94c9c2e239f17fde67948c714fd6d4 Mon Sep 17 00:00:00 2001 From: alex-eg Date: Fri, 9 Oct 2026 18:24:03 +0300 Subject: [PATCH] depend on the modules each Sex unit reads sexc writes the rule now (sex#40), so a module's change rebuilds the units that read it rather than every Sex object. Co-Authored-By: Claude Opus 5.5 --- Makefile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 5482d78..dfacf03 100644 --- a/Makefile +++ b/Makefile @@ -13,15 +13,13 @@ B = build all: $(B)/vsmv $(B)/vs-map-viewer -# sexc writes no dependency files, and an import pastes the imported -# module's public forms into the importer, so any Sex source may change -# any Sex object. -# TODO sex#40: depend on what each unit imports once sexc writes -# dependency files. -SEX_SRC := $(wildcard src/*.sex) +# An import pastes the imported module's public forms into the +# importer, so a Sex object depends on every module it reads; sexc +# names them in a .d beside the object. +$(B)/%.o: src/%.sex | $(B) + $(SEXC) $< -c -o $@ --depfile=$(@:.o=.d) -- $(CFLAGS) $(SEX_CFLAGS) $(CPPFLAGS) -$(B)/%.o: src/%.sex $(SEX_SRC) | $(B) - $(SEXC) $< -c -o $@ -- $(CFLAGS) $(SEX_CFLAGS) $(CPPFLAGS) +-include $(wildcard $(B)/*.d) $(B)/nk.o: src/nk.c src/nk.h | $(B) $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@