modularize sex
Some checks failed
Sex CI / build-linux (pull_request) Has been cancelled
Sex CI / build-macos (pull_request) Has been cancelled

This commit is contained in:
2026-02-17 16:11:56 +03:00
parent f5b3fcb399
commit 4c53946f1f
16 changed files with 1853 additions and 1786 deletions

View File

@@ -1,21 +1,30 @@
CHICKEN_C = csc
CSC_FLAGS += -K prefix
CSC_FLAGS += -K prefix -static
MODULES = sexc fmt-c fmt-c-writer semen sex-macros sex-modules sex-reader utils
# Order matters, since module check correctness on compilation
MODULES = utils macros reader module-system semen sex-fmt-c fmt-c-writer sexc
OBJ = $(MODULES:%=%.o)
IMPORTS = $(MODULES:%=%.import.scm)
sexc: main.o $(OBJ)
sexc: $(OBJ) main.o
$(CHICKEN_C) $(CSC_FLAGS) $^ -o $@
main.o: main.scm
$(CHICKEN_C) $(CSC_FLAGS) $< -c -o $@
module-system.o: module-system.scm reader.import.scm
$(CHICKEN_C) $(CSC_FLAGS) module-system.scm -e -c -J -o module-system.o -unit module-system -uses macros -uses utils
%.import.scm: %.o %.scm
%.o: %.scm
$(CHICKEN_C) $(CSC_FLAGS) $< -e -c -o $@
$(CHICKEN_C) $(CSC_FLAGS) $< -e -c -J -o $@ -unit $(@:%.o=%)
sex-tests: $(OBJ) tests/*.scm
cd ./tests && $(CHICKEN_C) $(CSC_FLAGS) run.scm -c -o sex-tests.o
$(CHICKEN_C) $(CSC_FLAGS) $(OBJ) ./tests/sex-tests.o -o sex-tests
clean:
rm -f $(OBJ) sexc sex-tests main.o ./tests/sex-tests.o
rm -f $(OBJ) main.o ./tests/sex-tests.o
rm -f $(IMPORTS)
rm -f sexc sex-tests