Simplify the build: one-file modules, a module graph read off the imports #67
7
.gitignore
vendored
7
.gitignore
vendored
@@ -5,10 +5,9 @@
|
|||||||
*.o
|
*.o
|
||||||
*.import.scm
|
*.import.scm
|
||||||
*.link
|
*.link
|
||||||
sexc
|
/sexc
|
||||||
sex-tests
|
/sex-tests
|
||||||
sextest
|
/sextest
|
||||||
tools/sextest/sextest
|
|
||||||
|
|
||||||
# Scrapped design docs, kept for reference
|
# Scrapped design docs, kept for reference
|
||||||
/attic
|
/attic
|
||||||
|
|||||||
21
Makefile
21
Makefile
@@ -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
|
sex-fmt-c.o: sex-fmt-c.scm
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) $< -o $@ -unit sex-fmt-c
|
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) $< -o $@ -unit sex-fmt-c
|
||||||
|
|
||||||
# Unit testing. Both link the modules built here
|
# Both link the modules built here, whose import libraries they find
|
||||||
sex-tests: $(OBJ)
|
# with the root on the repository path. The tests are built in their
|
||||||
$(MAKE) -C ./tests sex-tests
|
# own directory, where their includes would otherwise find the modules'
|
||||||
cp ./tests/sex-tests ./
|
# namesakes
|
||||||
|
WITH_ROOT_REPO = CHICKEN_REPOSITORY_PATH=$(CURDIR):$(CHICKEN_REPOSITORY_PATH)
|
||||||
|
|
||||||
sextest: reader.o utils.o
|
sex-tests: $(wildcard tests/*.scm) $(OBJ)
|
||||||
$(MAKE) -C ./tools/sextest sextest
|
cd tests && $(WITH_ROOT_REPO) $(CHICKEN_C) $(CSC_FLAGS) run.scm -o ../$@ -link sexc
|
||||||
cp ./tools/sextest/sextest .
|
|
||||||
|
sextest: tools/sextest/sextest.scm reader.o utils.o
|
||||||
|
$(CHICKEN_C) $(CSC_FLAGS) $< -o $@ -link reader,utils
|
||||||
|
|
||||||
SEX_TEST_PROGRAMS = c11 \
|
SEX_TEST_PROGRAMS = c11 \
|
||||||
closure-signatures \
|
closure-signatures \
|
||||||
@@ -129,10 +132,8 @@ clean:
|
|||||||
rm -f *.import.scm
|
rm -f *.import.scm
|
||||||
rm -f *.link
|
rm -f *.link
|
||||||
rm -f sexc sex-tests sextest
|
rm -f sexc sex-tests sextest
|
||||||
$(MAKE) -C ./tests clean
|
|
||||||
$(MAKE) -C ./tests/modules clean
|
$(MAKE) -C ./tests/modules clean
|
||||||
$(MAKE) -C ./tools/sextest clean
|
|
||||||
|
|
||||||
.PHONY: all check run-tests check-modules check-exit-code \
|
.PHONY: all check run-tests check-modules check-exit-code \
|
||||||
install install-strip installdirs uninstall \
|
install install-strip installdirs uninstall \
|
||||||
clean sex-tests sextest
|
clean
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
CHICKEN_C = csc
|
|
||||||
CSC_FLAGS += -K prefix -static
|
|
||||||
|
|
||||||
# sextest reuses sexc's reader (and its utils dependency) instead of
|
|
||||||
# duplicating the S-expression reader: both are linked from the root,
|
|
||||||
# found there through the repository path
|
|
||||||
ROOT = ../..
|
|
||||||
export CHICKEN_REPOSITORY_PATH := $(abspath $(ROOT)):$(or $(CHICKEN_REPOSITORY_PATH),$(shell chicken-install -repository))
|
|
||||||
|
|
||||||
sextest: sextest.scm $(ROOT)/reader.o $(ROOT)/utils.o
|
|
||||||
$(CHICKEN_C) $(CSC_FLAGS) sextest.scm -o sextest -link reader,utils
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f sextest
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
Reference in New Issue
Block a user