-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (34 loc) · 962 Bytes
/
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
43
NAME = ircserv
CC = c++
FLAGS = -Wall -Wextra -Werror -std=c++98
RM = rm -rf
#Colors:
GREEN = \e[92;5;118m
YELLOW = \e[93;5;226m
GRAY = \e[33;2;37m
RESET = \e[0m
CURSIVE = \e[33;3m
# All process use for compiling.
UNAME := $(shell uname -s)
NUMPROC := 8
# Compiling with all threads.
ifeq ($(UNAME), Linux)
NUMPROC := $(shell grep -c ^processor /proc/cpuinfo)
else ifeq ($(UNAME), Darwin)
NUMPROC := $(shell sysctl -n hw.ncpu)
endif
# You can use --> man sysctl -> shell: sysctl -a | grep "hw.ncpu"
all:
@$(MAKE) $(NAME) -j $(NUMPROC) --no-print-directory
$(NAME):
@printf "$(CURSIVE)$(GRAY) - Compiling $(NAME)... $(RESET)\n"
@ $(CC) $(FLAGS) ./srcs/*.cpp ./srcs/commands/* -o $(NAME)
@printf "$(GREEN) - Executable ready.\n$(RESET)"
clean:
@$(RM) $(NAME)
@printf "$(YELLOW) - Executable removed.$(RESET)\n"
fclean:
@$(RM) $(NAME)
@printf "$(YELLOW) - Executable removed.$(RESET)\n"
re: clean all
.PHONY: all clean re run