-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
72 lines (58 loc) · 2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
DIST_PATH = $(HOME)/.local
BIN_PATH = $(DIST_PATH)/bin/
STD_PATH = $(DIST_PATH)/include/elle/std
RUNTIME_PATH = $(DIST_PATH)/lib
default: install-release
install-debug: install-compiler-debug install-std install-runtime
install-release: install-compiler-release install-std install-runtime
install-compiler-debug: compile-debug
mkdir -p $(BIN_PATH)
mv ./ellec $(BIN_PATH)ellec
install-compiler-release: compile-release
mkdir -p $(BIN_PATH)
mv ./ellec $(BIN_PATH)ellec
install-std:
rm -rf $(STD_PATH)
mkdir -p $(STD_PATH)
cp -rf std/* $(STD_PATH)
install-runtime:
@rm -f $(RUNTIME_PATH)/libelle.o
@rm -f $(RUNTIME_PATH)/libelle.a
mkdir -p $(RUNTIME_PATH)
# must be compiled without anything because this is the module creating it
# its fine because those modules are actually just headers anyway
# this is just so the headers dont overwrite the implementation in the stdlib
ellec $(STD_PATH)/runtime/index.le -o libelle.o -c -p --noalloc --nogc --nosm --nofmt --nostd
@ar -rcs $(RUNTIME_PATH)/libelle.a libelle.o
@rm -f libelle.o
compile-debug:
cargo build && mv ./target/debug/ellec ./ellec
compile-release:
cargo build --release && mv ./target/release/ellec ./ellec
.PHONY: test-file
test-file:
@ellec $(TEST_FILE) -o __ellec_test_tmp $(if $(VERBOSE),,--hush);
-@./__ellec_test_tmp foo bar baz;
@rm -f ./__ellec_test_tmp $(if $(VERBOSE),,> /dev/null);
.PHONY: test-suite-%
test-suite-%:
@for file in $$(ls tests/$*); do \
if [ -n "$(CLEAR)" ]; then clear; fi; \
make $(if $(VERBOSE),VERBOSE=$(VERBOSE),) TEST_FILE=tests/$*/$$file test-file; \
if [ -n "$(DELAY)" ]; then sleep $(DELAY); fi; \
done
.PHONY: test
test:
@make $(if $(VERBOSE),VERBOSE=$(VERBOSE),) TEST_FILE=tests/assert.le test-file
make $(if $(VERBOSE),VERBOSE=$(VERBOSE),) test-suite-auto
@# make $(if $(VERBOSE),VERBOSE=$(VERBOSE),) test-suite-manual
.PHONY: test-manual
test-manual:
@make VERBOSE=1 DELAY=2 CLEAR=1 test-suite-manual
repl:
ellec tools/repl.le
clean:
rm -rf dist
rm repl
rm __ellec_test_tmp
@make compile-release