-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (46 loc) · 1.45 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
PROGRAMFILENAME=HepialCompilateur
CUPFILENAME=syntax
JFLEXFILENAME=Lexical
# Program ...
bin/${PROGRAMFILENAME}.class: bin/$(JFLEXFILENAME).java bin/sym.class bin/${JFLEXFILENAME}.class
javac -d bin -cp lib/java-cup-11a.jar:bin src/$(PROGRAMFILENAME).java
# Cup ...
bin/sym.class : src/${CUPFILENAME}.cup src/$(JFLEXFILENAME).flex
# compile every java class
find -path "*/src/abstractTree/*.java" > sources.txt
find -path "*/src/symbol/*.java" >> sources.txt
find -path "*/src/utils/*.java" >> sources.txt
find -path "*/src/codeProduction/*.java" >> sources.txt
javac -d bin @sources.txt
rm sources.txt
#compile cup
java -jar lib/java-cup-11a.jar src/${CUPFILENAME}.cup
mv sym.java bin/sym.java
mv parser.java bin/parser.java
javac -cp lib/java-cup-11a.jar:bin bin/sym.java
javac -cp lib/java-cup-11a.jar:bin bin/parser.java
# JFlex ...
bin/$(JFLEXFILENAME).class: bin/$(JFLEXFILENAME).java
javac -cp lib/java-cup-11a.jar:bin bin/$(JFLEXFILENAME).java
bin/$(JFLEXFILENAME).java: src/$(JFLEXFILENAME).flex
mkdir -p bin
jflex src/$(JFLEXFILENAME).flex -d bin
# Clean
clean:
rm -f -r bin sources.txt compiledBin
# Remake
remake:
make clean
make
#### DEBUG COMMANDS ######
#AbstractTree lib only
abstractTree:
mkdir -p bin
find -path "*/src/abstractTree/*.java" > sources.txt
javac -d bin @sources.txt
rm sources.txt
# JFlex only
jflex:
mkdir -p bin
jflex src/$(JFLEXFILENAME).flex -d bin
javac -cp lib/java-cup-11a.jar:bin bin/$(JFLEXFILENAME).java