-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (33 loc) · 852 Bytes
/
Makefile
File metadata and controls
46 lines (33 loc) · 852 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
NAME = ex00
WFLAGS = -Wall -Werror -Wextra
CPPFLAGS = -std=c++98 -O0 -I ./include/
DEBUG_FLAGS =
SOURCES = $(wildcard ./src/*.cpp)
SOURCES := $(patsubst ./src/%,%, $(SOURCES))
OBJECTS = $(addprefix ./.objs/,$(SOURCES:.cpp=.o))
HEADERS = $(wildcard ./include/*.hpp)
ifdef REMOVE_W_FLAGS
WFLAGS =
endif
ifdef DEBUG
DEBUG_FLAGS := -g3
endif
ifdef REMOVE_STD
CPPFLAGS := $(subst -std=c++98,,$(CPPFLAGS))
endif
CYAN = \033[36m
RESET = \033[0m
all: ./.objs/ $(NAME)
./.objs/:
@mkdir ./.objs/
$(NAME): $(OBJECTS)
@printf "$(CYAN)Compiling...$(RESET)\n"
@c++ $(CPPFLAGS) $(DEBUG_FLAGS) $(WFLAGS) $(OBJECTS) -o $(NAME)
@printf "$(CYAN)Target ./$(NAME) done$(RESET)\n"
./.objs/%.o: ./src/%.cpp $(HEADERS)
@c++ $(CPPFLAGS) $(DEBUG_FLAGS) $(WFLAGS) -c $< -o $@
clean:
@rm -rf ./.objs/
fclean: clean
@rm -rf $(NAME)
re: fclean all