-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (41 loc) · 1.6 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
VECTOR_NAME = vector
VECTOR_ITERATOR_NAME = vector_iterator
PATH_VECTOR = ./tests/
PATH_VECTOR_ITERATOR = ./tests/vector_iterator/
PATH_CONTAINERS = ./includes/
PATH_TESTS = ./tests/
PATH_OBJS = ./objects/
VECTOR_TESTS = vector_tests.cpp
VECTOR_OBJS = $(patsubst %.cpp,$(PATH_OBJS)%.o,$(VECTOR_TESTS))
VECTOR_ITERATOR_TESTS = vector_iterator_tests.cpp
VECTOR_ITERATOR_OBJS = $(patsubst %.cpp,$(PATH_OBJS)%.o,$(VECTOR_ITERATOR_TESTS))
INCLUDE_CONTAINERS = -I $(PATH_CONTAINERS)
INCLUDE_TESTS = -I $(PATH_TESTS)
FLAGS = -Wall -Wextra -Werror -std=c++98 -g3
all: $(VECTOR_NAME) $(VECTOR_ITERATOR_NAME)
vector-run: fclean $(VECTOR_NAME)
@./$(VECTOR_NAME)
@rm -rf $(VECTOR_NAME)
vector-iterator-run: fclean $(VECTOR_ITERATOR_NAME)
@./$(VECTOR_ITERATOR_NAME)
@rm -rf $(VECTOR_NAME)
$(VECTOR_NAME): $(VECTOR_OBJS)
@c++ $(FLAGS) $(VECTOR_OBJS) -o $(VECTOR_NAME)
$(PATH_OBJS)%.o: $(PATH_VECTOR)%.cpp
@mkdir -p $(PATH_OBJS)
@c++ $(FLAGS) $(INCLUDE_CONTAINERS) $(INCLUDE_TESTS) -c $< -o $@
@echo "\033[1;92m[SUCCESS] Vector test objects creation done!\033[0m"
$(VECTOR_ITERATOR_NAME): $(VECTOR_ITERATOR_OBJS)
@c++ $(FLAGS) $(VECTOR_ITERATOR_OBJS) -o $(VECTOR_ITERATOR_NAME)
$(PATH_OBJS)%.o: $(PATH_VECTOR_ITERATOR)%.cpp
@mkdir -p $(PATH_OBJS)
@c++ $(FLAGS) $(INCLUDE_CONTAINERS) $(INCLUDE_TESTS) -c $< -o $@
@echo "\033[1;92m[SUCCESS] Vector iterator test objects creation done!\033[0m"
clean:
@rm -rf $(PATH_OBJS)
@echo "\33[1;93m[SUCCESS] Objects removed!\33[0m"
fclean: clean
@rm -f $(VECTOR_NAME) $(VECTOR_ITERATOR_NAME)
@echo "\033[1;93m[SUCCESS] Full clean done!\33[0m"
re: fclean all
.PHONY: all clean fclean re