-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
42 lines (32 loc) · 1.28 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
NAME = Magic_royale
CC = g++
CFLAGS = -Wall -Wextra -std=c++17
SRCS_DIR = sources
SRCS_SUB_DIRS = "cards" "players" "utils" "renderer" "cards/lands" "cards/creatures" "cards/spells" "cards/creatures/blacks" "cards/creatures/blues" "cards/creatures/greens" "cards/creatures/reds" "cards/creatures/whites" "cards/creatures/generateds"
INCS = -Isources
OBJS_DIR = objects
SRC_FILES := $(wildcard $(SRCS_DIR)/*.cpp) $(wildcard $(SRCS_DIR)/*/*.cpp) $(wildcard $(SRCS_DIR)/*/*/*.cpp) $(wildcard $(SRCS_DIR)/*/*/*/*.cpp)
OBJ_FILES := $(patsubst $(SRCS_DIR)/%.cpp, $(OBJS_DIR)/%.o, $(SRC_FILES))
BOLD = \e[1m
GREEN = \e[92m
BLUE = \e[96m
RED = \e[91m
RESET = \e[0m
.PHONY: all clean re
all: $(NAME)
$(NAME): $(OBJ_FILES)
@echo "$(BLUE)$(BOLD)[Makefile]$(RESET) $(BLUE)Building $(BOLD)$(NAME)$(RESET)"
@$(CC) $(CFLAGS) $(INCS) -o $@ $^
$(OBJS_DIR)/%.o: $(SRCS_DIR)/%.cpp
@mkdir -p "$(OBJS_DIR)"
@cd "$(OBJS_DIR)" ; mkdir -p $(SRCS_SUB_DIRS)
@echo "$(GREEN)$(BOLD)[Makefile]$(RESET) $(GREEN)Compiling $(BOLD)$(notdir $<)$(RESET)"
@$(CC) $(CFLAGS) $(INCS) -c -o $@ $<
clean:
@echo "$(RED)$(BOLD)[Makefile]$(RESET) $(RED)Deleting $(BOLD)binaries$(RESET)"
@rm -rf $(OBJS_DIR)
@echo "$(RED)$(BOLD)[Makefile]$(RESET) $(RED)Deleting $(BOLD)$(NAME)$(RESET)"
@rm -rf $(NAME)
re: clean all
run:
@./$(NAME)