forked from elixir-lang/elixir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (69 loc) · 1.98 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
73
74
75
76
77
78
79
80
81
82
83
84
85
EBIN_DIR=ebin
EXBIN_DIR=exbin
TEST_DIR=test
INCLUDE_DIR=include
TEST_SOURCE_DIR=$(TEST_DIR)/erlang
TEST_EBIN_DIR=$(TEST_DIR)/ebin
ERLC=erlc -I $(INCLUDE_DIR) -W0
ERL=erl -I $(INCLUDE_DIR) -noshell -pa $(EBIN_DIR)
.PHONY: test test_erlang test_elixir clean clean_exbin
# This is the default task
compile: ebin/elixir.beam ebin | src/elixir_lexer.erl src/elixir_parser.erl src/eex_lexer.erl exbin
# install:
# We will need to do this one at some point
ebin/elixir.beam: include/elixir.hrl
@ echo Compiling Erlang source ...
@ mkdir -p $(EBIN_DIR)
$(ERLC) -o $(EBIN_DIR) src/*.erl
@ echo
src/elixir_lexer.erl: src/elixir_lexer.xrl
@ echo Compiling lexer ...
$(ERL) -eval 'leex:file("$<"), halt().'
@ mkdir -p $(EBIN_DIR)
$(ERLC) -o $(EBIN_DIR) $@
@ echo
src/elixir_parser.erl: src/elixir_parser.yrl
@ echo Compiling parser ...
$(ERL) -eval 'yecc:file("$<"), halt().'
@ mkdir -p $(EBIN_DIR)
$(ERLC) -o $(EBIN_DIR) $@
@ echo
src/eex_lexer.erl: src/eex_lexer.xrl
@ echo Compiling eex lexer ...
$(ERL) -eval 'leex:file("$<"), halt().'
@ mkdir -p $(EBIN_DIR)
$(ERLC) -o $(EBIN_DIR) $@
@ echo
ebin: src/*.erl
@ echo Compiling Erlang source ...
@ mkdir -p $(EBIN_DIR)
$(ERLC) -o $(EBIN_DIR) $?
@ echo
exbin: lib/*.ex lib/*/*.ex
@ echo Compiling Elixir source ...
@ mkdir -p $(EXBIN_DIR)
@ touch $(EXBIN_DIR)
$(ERL) -s elixir_compiler core -s erlang halt
@ echo
test_erlang: compile
@ echo Running Erlang tests ...
@ mkdir -p $(TEST_EBIN_DIR)
@ # Compile test files
@ $(ERLC) -o $(TEST_EBIN_DIR) $(TEST_SOURCE_DIR)/*.erl
@ # Look and execute each file
time $(ERL) $(TEST_EBIN_DIR) -pa exbin -s test_helper test -s erlang halt
@ echo
test_elixir: compile
@ echo Running Elixir tests ...
time bin/exunit test/elixir/*_test.exs test/elixir/*/*_test.exs
@ echo
test: test_erlang test_elixir
clean: clean_exbin
rm -f src/elixir_lexer.erl
rm -f src/elixir_parser.erl
rm -f src/eex_lexer.erl
rm -rf $(EBIN_DIR)/*.beam
rm -rf $(TEST_EBIN_DIR)/*.beam
@ echo
clean_exbin:
rm -rf $(EXBIN_DIR)