From 4c862b6983d8044c595e4b8b260acf9899a96180 Mon Sep 17 00:00:00 2001 From: Shinichiro Hamaji Date: Sun, 28 Jan 2018 20:31:46 +0900 Subject: [PATCH] Refactor Makefile --- Makefile | 17 +++++++++++++++++ target.mk | 5 ++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 53bcbec..f4a35b0 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,23 @@ LIB_IR := $(LIB_IR_SRCS:ir/%.c=out/%.o) ELC_EIR := out/elc.c.eir.c.gcc.exe +help: + @echo '' + @echo '*** Building/testing everything is not recommneded ***' + @echo '' + @echo 'Instead, you can use following targets for target xxx:' + @echo '' + @echo '- `make build-xxx`: Compile all tests to xxx backend' + @echo ' (e.g., out/lisp.c.eir.xxx will be built from test/lisp.c)' + @echo '- `make test-xxx` or `make xxx`: Run tests for xxx backend' + @echo ' (e.g., out/lisp.c.eir.xxx.out.diff will be output)' + @echo '- `make test-full-xxx`: Run target/xxx.c on ELVM' + @echo ' (this checks if the target xxx can self-host)' + @echo '' + @echo 'Running all tests by `make test`, will take a lot of time/disk' + @echo '' + @exit 1 + all: test out/git_submodule.stamp: .git/index diff --git a/target.mk b/target.mk index 7a4a99a..08aa8a7 100644 --- a/target.mk +++ b/target.mk @@ -21,6 +21,7 @@ EXT := $(TARGET) $(eval CMD = $$(ELC) -$(TARGET) $$2 > $$1.tmp && chmod 755 $$1.tmp && mv $$1.tmp $$1) OUT.eir.$(TARGET) := $(SRCS:%=%.$(EXT)) include build.mk +build-$(TARGET): $(OUT.eir.$(TARGET)) include clear_vars.mk @@ -36,7 +37,8 @@ EXPECT := eir.out ACTUAL := eir.$(TARGET).out include diff.mk -$(TARGET): $(DIFFS) +test-$(TARGET): $(DIFFS) +$(TARGET): test-$(TARGET) # Make sure elc.c.eir can create the same target. @@ -54,6 +56,7 @@ ACTUAL := eir.elc.$(TARGET) include diff.mk elc-$(TARGET): $(DIFFS) +test-full-$(TARGET): elc-$(TARGET) else