CHICKEN_C = csc

CSC_FLAGS += -K prefix -static

# The compiler's modules are built once, in the root; their import
# libraries and objects are found there through the repository path
ROOT = ..
export CHICKEN_REPOSITORY_PATH := $(abspath $(ROOT)):$(or $(CHICKEN_REPOSITORY_PATH),$(shell chicken-install -repository))

MODULES = utils types infer sex-macros reader sex-modules semen sex-fmt-c fmt-c-writer sexc

TESTS = basic semen reader fmt-c-writer utils line-directives codegen encapsulation args module-path types infer
TEST_SRCS = $(TESTS:%=%.scm)

sex-tests: run.scm $(TEST_SRCS) $(MODULES:%=$(ROOT)/%.o)
	$(CHICKEN_C) $(CSC_FLAGS) run.scm -o sex-tests -link sexc

clean:
	rm -f sex-tests

.PHONY: clean
