Skip to content

Commit

Permalink
Refactor Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
shinh committed Mar 28, 2019
1 parent 83dc222 commit 4c862b6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.

Expand All @@ -54,6 +56,7 @@ ACTUAL := eir.elc.$(TARGET)
include diff.mk

elc-$(TARGET): $(DIFFS)
test-full-$(TARGET): elc-$(TARGET)

else

Expand Down

0 comments on commit 4c862b6

Please sign in to comment.