-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (37 loc) · 1.04 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
EBIN=ebin
INCLUDE=include
SRC=src
RULES=bnf
BEAM=erlc -b beam -o $(EBIN)
OBJS= \
erl_gen \
bnf \
bnf_parse
ERL_OBJS=$(foreach file, $(OBJS), $(EBIN)/$(file).beam)
run: $(ERL_OBJS)
erl -pa $(EBIN)
$(EBIN)/%.beam: $(SRC)/%.erl
$(BEAM) $<
test: $(ERL_OBJS)
erl -pa $(EBIN) -noshell -run \
erl_gen test_generate -s init stop;
parser: $(EBIN)/erl_gen.beam
erl -pa $(EBIN) -noshell -run \
erl_gen make_parser $(INCLUDE)/$(RULES).yrl -s init stop; \
mv $(INCLUDE)/$(RULES)_parse.erl $(SRC)/$(RULES)_parse.erl; \
$(BEAM) $(SRC)/$(RULES)_parse.erl;
test_parser: $(EBIN)/erl_gen.beam lexer parser
erl -pa $(EBIN) -noshell -run \
erl_gen test_parser -s init stop
lexer: $(EBIN)/erl_gen.beam
erl -pa $(EBIN) -noshell -run \
erl_gen make_lexer $(INCLUDE)/$(RULES).xrl -s init stop; \
mv $(INCLUDE)/$(RULES).erl $(SRC)/$(RULES).erl; \
$(BEAM) $(SRC)/$(RULES).erl;
test_lexer: $(EBIN)/erl_gen.beam lexer
erl -pa $(EBIN) -noshell -run \
erl_gen test_lexer -s init stop
clean:
-rm $(EBIN)/*
-rm $(INCLUDE)/$(RULES).erl
-rm $(INCLUDE)/$(RULES)_parse.erl