-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
70 lines (39 loc) · 2.06 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
GenDir = gen
SrcDir = src
GenClass = Lexer Parser
SrcClass = Types Logger Context RuleNative Compiler
GenObj = $(addprefix $(GenDir)/,$(addsuffix .o,$(GenClass)))
SrcObj = $(addprefix $(GenDir)/,$(addsuffix .o,$(SrcClass)))
AllObjs = $(GenObj) $(SrcObj)
Flex = flex -i
Bison = bison
Gcc = g++ -Wall -Wextra -pedantic -Wno-unused-function -Wfatal-errors -I src -I gen
GccStrict = g++ -Wall -Wextra -pedantic -Weffc++ -Werror -Wfatal-errors -I src -I gen
.PHONY: ifpp lex parser analyze tests doc clean
ifpp: ifpp.exe
lex: $(GenDir)/Lexer.cpp $(GenDir)/Lexer.h
parser: $(GenDir)/Parser.cpp $(GenDir)/Parser.h
analyze: src/Parser.y
$(Bison) -Wall --report=all --report-file=BisonReport.txt $<
doc: doc/ifpp-manual.html
clean:
-rm gen/*
-rm doc/*
-rm ifpp.exe
$(GenDir)/Lexer.cpp $(GenDir)/Lexer.h: $(SrcDir)/Lexer.l
$(Flex) --outfile="gen/Lexer.cpp" --header-file="gen/Lexer.h" $(SrcDir)/Lexer.l
$(GenDir)/Parser.cpp $(GenDir)/Parser.h $(GenDir)/position.hh $(GenDir)/location.hh $(GenDir)/stack.hh: $(SrcDir)/Parser.y
$(Bison) --output="gen/Parser.cpp" --defines="gen/Parser.h" $(SrcDir)/Parser.y
$(GenObj): $(GenDir)/%.o: $(GenDir)/%.cpp $(GenDir)/%.h
$(Gcc) -c -o $@ $<
$(SrcObj): $(GenDir)/%.o: $(SrcDir)/%.cpp $(SrcDir)/%.h
$(GccStrict) -c -o $@ $<
ifpp.exe: $(AllObjs) $(addprefix $(SrcDir)/,$(addsuffix .h,Types Logger Context Compiler)) src/ifpp.cpp
$(GccStrict) -o ifpp $(AllObjs) src/ifpp.cpp
$(GenDir)/Lexer.o: $(addprefix $(SrcDir)/,$(addsuffix .h,Types Context)) $(GenDir)/Parser.h
$(GenDir)/Parser.o: $(addprefix $(SrcDir)/,$(addsuffix .h,Types Context)) $(addprefix $(GenDir)/,$(addsuffix .hh,stack location))
$(GenDir)/Context.o: $(addprefix $(SrcDir)/,$(addsuffix .h,Types Logger)) $(addprefix $(GenDir)/,$(addsuffix .h,Lexer Parser))
$(GenDir)/RuleNative.o: $(addprefix $(SrcDir)/,$(addsuffix .h,Types))
$(GenDir)/Compiler.o: $(addprefix $(SrcDir)/,$(addsuffix .h,Types RuleNative Logger))
doc/ifpp-manual.html: src/ifpp-manual.texinfo
makeinfo --html --no-split --css-include="src/ifpp-manual.css" -o "doc/ifpp-manual.html" "src/ifpp-manual.texinfo"