-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (45 loc) · 1.67 KB
/
Makefile
File metadata and controls
65 lines (45 loc) · 1.67 KB
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
#OBJS specifies which files to compile as part of the project
OBJS_EXAMPLE = examples/01_hello_SDL/01_hello_SDL.cpp
OBJS = src/main.cpp
OBJS_CODE = src/codeGraph/main.cpp
#CC specifies which compiler we're using
CC = clang
#COMPILER_FLAGS specifies the additional compilation options we're using
# -w supresses all warnings
COMPILER_FLAGS = -Wall -Wextra -pedantic
COMPILER_FLAGS_DEBUG = -Wall -Wextra -pedantic -ggdb
COMPILER_FLAGS_LLVM_IR = -S -emit-llvm
#LINKER_FLAGS specifies the libraries we're linking against
LINKER_FLAGS = -lSDL2
#OBJS_NAME specifies the name of our executable
OBJS_NAME_EXAMPLE = examples/01_hello_SDL/01_hello_SDL
OBJS_NAME = src/main
OBJS_NAME_CODE = src/codeGraph/main
OBJS_NAME_LLVM_IR = src/main.ll
#This is the target that compiles our examples
#Add @ to supress the command string in terminal.
binary : $(OBJS)
$(info Compiling...)
@$(CC) $(OBJS) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(OBJS_NAME)
code : $(OBJS)
$(info Compiling...)
@$(CC) $(OBJS_CODE) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(OBJS_NAME_CODE)
llvm-ir : $(OBJS)
$(info Generating LLVM_IR...)
@$(CC) $(COMPILER_FLAGS_LLVM_IR) -o $(OBJS_NAME_LLVM_IR) $(OBJS)
debug : $(OBJS)
$(info Compiling...)
@$(CC) $(OBJS) $(COMPILER_FLAGS_DEBUG) $(LINKER_FLAGS) -o $(OBJS_NAME)
clean :
$(info Cleaning up ( $(OBJS_NAME) $(OBJS_NAME_LLVM_IR) $(OBJS_NAME_CODE)))
@rm -f $(OBJS_NAME) $(OBJS_NAME_CODE)
clear :
clear
test : $(OBJS_EXAMPLE)
$(info Compiling Examples...)
@$(CC) $(OBJS_EXAMPLE) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(OBJS_NAME_EXAMPLE)
#@echo "Testing testing, attention please!!"
all : clean binary llvm-ir
run : $(OBJS_CODE)
$(info Running codeGraph...)
@./src/codeGraph/main