build the unit tests and sextest from the root

Each subdirectory's Makefile repeated the compiler's module list just to
link one program, and its result was copied back to the root anyway.
This commit is contained in:
2026-10-14 23:21:20 +03:00
parent c65721a070
commit a504fc1410
4 changed files with 14 additions and 51 deletions

View File

@@ -63,14 +63,17 @@ sexc.o: fmt-c-writer.o infer.o reader.o semen.o sex-macros.o sex-modules.o types
sex-fmt-c.o: sex-fmt-c.scm
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) $< -o $@ -unit sex-fmt-c
# Unit testing. Both link the modules built here
sex-tests: $(OBJ)
$(MAKE) -C ./tests sex-tests
cp ./tests/sex-tests ./
# Both link the modules built here, whose import libraries they find
# with the root on the repository path. The tests are built in their
# own directory, where their includes would otherwise find the modules'
# namesakes
WITH_ROOT_REPO = CHICKEN_REPOSITORY_PATH=$(CURDIR):$(CHICKEN_REPOSITORY_PATH)
sextest: reader.o utils.o
$(MAKE) -C ./tools/sextest sextest
cp ./tools/sextest/sextest .
sex-tests: $(wildcard tests/*.scm) $(OBJ)
cd tests && $(WITH_ROOT_REPO) $(CHICKEN_C) $(CSC_FLAGS) run.scm -o ../$@ -link sexc
sextest: tools/sextest/sextest.scm reader.o utils.o
$(CHICKEN_C) $(CSC_FLAGS) $< -o $@ -link reader,utils
SEX_TEST_PROGRAMS = c11 \
closure-signatures \
@@ -129,10 +132,8 @@ clean:
rm -f *.import.scm
rm -f *.link
rm -f sexc sex-tests sextest
$(MAKE) -C ./tests clean
$(MAKE) -C ./tests/modules clean
$(MAKE) -C ./tools/sextest clean
.PHONY: all check run-tests check-modules check-exit-code \
install install-strip installdirs uninstall \
clean sex-tests sextest
clean