-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
46 lines (27 loc) · 736 Bytes
/
Copy pathmakefile
File metadata and controls
46 lines (27 loc) · 736 Bytes
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
EXECUTABLE = rpg
BUILD = build
SRC = src
INC = include
SOURCE = $(wildcard $(SRC)/*.cpp)
OBJECT = $(patsubst %,$(BUILD)/%, $(notdir $(SOURCE:.cpp=.o)))
CC = g++
CFLAGS = -Wall -g -I$(INC)
GREEN = \033[1;32m
BLUE = \033[1;34m
YELLOW = \033[1;33m
NC = \033[1;0m
$(BUILD)/$(EXECUTABLE) : $(OBJECT)
@echo "$ Compiling...$(NC)"
$(CC) -o $@ $^
$(BUILD)/%.o : $(SRC)/%.cpp
$(CC) $(CFLAGS) -c $< -o $@
.PHONY: run valgrind clean
run: $(BUILD)/$(EXECUTABLE)
@echo "$(GREEN) Executing..$(NC)"
$(BUILD)/$(EXECUTABLE)
valgrind: $(BUILD)/$(EXECUTABLE)
@echo "$(YELLOW)👓️ Debugging..$(NC)"
valgrind ./$(BUILD)/$(EXECUTABLE)
clean:
@echo "$(BLUE)🧹 Cleaning..$(NC)"
rm -f $(OBJECT) $(BUILD)/$(EXECUTABLE)