Add project-local dependencies installation

This commit is contained in:
2025-10-01 14:35:37 +03:00
parent a221e0f8ea
commit 7ff1f68ffe

View File

@@ -11,6 +11,7 @@ CSC_FLAGS += -K prefix -static
# "during expansion of (import ...) - cannot import from undefined module: sex-macros"
# error.
# -c: Stop after compilation to object files. This one is obvious.
CHICKEN_INSTALL = chicken-install
MODULE_FLAGS = -emit-all-import-libraries -module-registration -c
@@ -18,6 +19,18 @@ MODULE_FLAGS = -emit-all-import-libraries -module-registration -c
MODULES = utils types sex-macros reader sex-modules semen sex-fmt-c fmt-c-writer sexc
OBJ = $(MODULES:%=%.o)
DEPSFILE = dependencies.txt
DEPSLOCK = .eggs.lock
DEPENDENCIES = $(shell cat $(DEPSFILE))
CHICKEN_EXTERNAL_REPOSITORY := $(shell chicken-install -repository)
export CHICKEN_EGG_CACHE=$(abspath .eggs)/cache
export CHICKEN_REPOSITORY_PATH=$(abspath .eggs):$(CHICKEN_EXTERNAL_REPOSITORY)
export CHICKEN_INSTALL_REPOSITORY=$(abspath .eggs)
all: sexc
sexc: $(OBJ) main.scm
$(CHICKEN_C) $(CSC_FLAGS) main.scm -o sexc-tmp -link sexc
# otherwise csc hangs, probably because it tries to compile to sexc.o first
@@ -74,6 +87,16 @@ check-exit-code: sexc
run-tests: sexc sex-tests sextest
./sex-tests && ./sextest --sexc=./sexc $(SEX_TEST_PROGRAMS:%=./tests/sex-programs/%.sex) && $(MAKE) check-modules && $(MAKE) check-exit-code
run-tests: sex-tests
./sex-tests
.eggs.lock: $(DEPSFILE)
env | grep CHICKEN
$(CHICKEN_INSTALL) $(DEPENDENCIES)
touch $(DEPSLOCK)
deps: $(DEPSLOCK)
clean:
rm -f $(OBJ) main.o
rm -f *.import.scm
@@ -81,4 +104,4 @@ clean:
rm -f sexc sex-tests sextest
$(MAKE) -C ./tests/modules clean
.PHONY: clean run-tests sex-tests sextest check-modules check-exit-code
.PHONY: clean depclean deps run-tests sex-tests sextest check-modules check-exit-code