-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (42 loc) · 1.11 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
CFLAGS = -g -w -std=c++11
INCLUDES = -Iincludes/ \
SOURCES = $(wildcard src/*.cpp) \
$(wildcard src/loader/*.cpp) \
$(wildcard src/parser/*.cpp) \
$(wildcard src/error/*.cpp) \
$(wildcard src/semantics/*.cpp) \
$(wildcard src/codegen/*.cpp) \
GRAMMARS = grammar/AshGrammar.y grammar/AshLexGrammar.l
# @ is used to silence commands
# Build the parser and compiler
build: ${SOURCES}
@mkdir -p bin/
@make parser
@echo "### Building compiler"
@g++ $(CFLAGS) $(INCLUDES) ${SOURCES} -o bin/ashc
# Build the parser
parser: ${GRAMMARS}
@echo "### Building parser"
@mkdir -p src/parser
@bison -d -Wnone grammar/AshGrammar.y -o src/parser/parser.cpp
@flex -o src/parser/lexer.cpp grammar/AshLexGrammar.l
@mv src/parser/parser.hpp includes/parser/parser.hpp
# Run in debug mode
debug:
@echo "### Debugging ashc"
@valgrind --track-origins=yes bin/ashc Test
# Run
run:
@echo "### Running ashc"
@bin/ashc Test
git:
@echo "### Pulling and adding"
@git pull
@git add --all
@echo "### Committing"
@git commit -m "${M}"
@echo "### Pushing"
@git push
test:
g++ -w src2/loadertest.cpp
./a.out Test.class