forked from alex-eg/sex
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:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -5,10 +5,9 @@
|
||||
*.o
|
||||
*.import.scm
|
||||
*.link
|
||||
sexc
|
||||
sex-tests
|
||||
sextest
|
||||
tools/sextest/sextest
|
||||
/sexc
|
||||
/sex-tests
|
||||
/sextest
|
||||
|
||||
# Scrapped design docs, kept for reference
|
||||
/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
|
||||
$(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
|
||||
|
||||
@@ -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