-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
89 lines (56 loc) · 1.74 KB
/
Makefile
File metadata and controls
89 lines (56 loc) · 1.74 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
##
## EPITECH PROJECT, 2017
## Makefile
## File description:
## makefile of the source file
##
ROOT = .
SRC_DIR = .
CXX = g++
NAME = ../processor_module.so
BUILD = $(ROOT)/build
SRC = $(SRC_DIR)/entrypoint.cpp \
$(SRC_DIR)/ProcessorInformation.cpp
CXXFLAGS= -g -I $(ROOT) -I ../../../inc $(WARN) -std=gnu++17 -fPIC
LDFLAGS = -L -lstdc++fs -shared
LIB ?= 1
TEST ?= 0
DEB ?= 0
G = -g -D DEBUG
V ?= @
OBJS = $(patsubst $(SRC_DIR)/%.cpp, $(BUILD)/%.o, $(SRC))
#COLOR
GREEN = \e[1;32m
WHITE = \e[0m
ORANGE = \e[1;33m
RED = \e[1;35m
BLUE = \e[1;34m
debug: CXXFLAGS += $(G)
all: $(NAME)
$(NAME): $(OBJS)
$(V)printf "$(GREEN)Compile sources.$(WHITE)\n"
$(V)$(CXX) -o $(NAME) $(OBJS) $(LDFLAGS)
$(V)printf "$(GREEN)Linking obj and Libraries.$(WHITE)\n"
debug: fclean echo_d $(NAME)
$(BUILD)/$(NAME): $(OBJS)
$(V)printf "$(GREEN)Compile sources.$(WHITE)\n"
$(V)$(CXX) -o $(BUILD)/$(NAME) $(OBJS) $(LDFLAGS)
$(V)printf "$(GREEN)Linking obj and Libraries.$(WHITE)\n"
$(BUILD)/%.o: $(SRC_DIR)/%.cpp
$(V)mkdir -p $(dir $@)
$(V)printf "$(BLUE)Compiling [$(GREEN)$(notdir $<)$(BLUE) -> $(RED)$(notdir $@)$(BLUE)]\n$(WHITE)"
$(V)$(CXX) -o $@ -c $< $(CXXFLAGS) $(LDFLAGS)
clean:
$(V)rm -rf $(OBJS)
$(V)printf "$(ORANGE)Removing object files.$(WHITE)\n"
fclean: clean
$(V)rm -f $(BUILD)/$(NAME)
$(V)rm -f $(ROOT)/$(NAME)
$(V)printf "$(ORANGE)Removing binary file.$(WHITE)\n"
re: fclean
$(V)make --no-print-directory all
echo_build:
$(V)printf "$(GREEN)Begin of the build !\n$(ORANGE)Warnings : \n$(WHITE)"
echo_d:
$(V)printf "$(RED)DEBUG MODE initialized.$(WHITE)\n";
.PHONY: clean fclean debug all re echo_debug buildrepo