-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
38 lines (25 loc) · 1.17 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
CC=gcc
CFLAGS=-Wall -g
all: generate_llvm_ir
printer.o: printer.c printer.h
$(CC) $(CFLAGS) -c $< -o $@
lexer-v1.o: lexer-v1.c lexer-v1.h
$(CC) $(CFLAGS) -c $< -o $@
parser-v1.o: parser-v1.c parser-v1.h lexer-v1.o
$(CC) $(CFLAGS) -c $< -o $@
generate_llvm_ir: generate_llvm_ir.c parser-v1.o lexer-v1.o
$(CC) $(CFLAGS) $^ -o $@
compiler: compiler.c generate_llvm_ir
$(CC) $(CFLAGS) $< -o $@
clean:
rm -f generate_llvm_ir compiler *.o test-programs-out/* temp.ll
test: compile_test_program
./test-programs-out/test-program-1 ./test-programs-out/test-program-parse-error
test_program_1: generate_llvm_ir
./generate_llvm_ir < ./test-programs/test-program-1.txt > ./test-programs-out/test-program-1.ll
compile_test_program: test_program_1
clang ./test-programs-out/test-program-1.ll ./print_integer.c -o ./test-programs-out/test-program-1
test_program-parse-error: generate_llvm_ir
./generate_llvm_ir < ./test-programs/test-program-parse-error.txt > ./test-programs-out/test-program-parse-error.ll
compile_test_program_parse_error: test_program_parse_error
clang ./test-programs-out/test-program-parse-error.ll ./print_integer.c -o ./test-programs-out/test-program-parse-error