-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (32 loc) · 1.13 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
PEGJS = ./node_modules/pegjs/bin/pegjs
TSC = ./node_modules/tsc/bin/tsc
TSC_FLAGS = --module commonjs
default: pre-build compiler
pre-build:
@sudo ln -s /usr/bin/nodejs /usr/bin/node
compiler: frontend backend
@$(TSC) $(TSC_FLAGS) src/compiler.ts --outDir dist
frontend: dist/frontend/grammar/grammar.js
@echo "Compiling Front End..."
@$(TSC) $(TSC_FLAGS) src/frontend/frontend.ts --outDir dist
backend: src/backend/CodeGenerator.ts
@echo "Compiling Back End..."
@$(TSC) $(TSC_FLAGS) src/backend/backend.ts --outDir dist
dist/frontend/grammar/grammar.js: src/frontend/grammar/grammar.ts
@echo "Compiling Grammar to JavaScript..."
@$(TSC) $(TSC_FLAGS) src/frontend/grammar/grammar.ts --outDir dist
src/frontend/grammar/grammar.ts: src/frontend/grammar/grammar.pegjs
@echo "Compiling Grammar to TypeScript..."
@$(PEGJS) src/frontend/grammar/grammar.pegjs src/frontend/grammar/grammar.ts
test: compiler
python ./runTests.py
tetris:
./compileRunTetris.sh
preview: compiler
@./compile input.wacc
clean:
@echo "Removing all generated files..."
@rm -r -f dist
@rm *.s
@rm src/frontend/grammar/grammar.ts
rebuild: clean compiler