119 lines
2.5 KiB
Makefile
119 lines
2.5 KiB
Makefile
# - - - - - - - #
|
|
# #
|
|
# COLORS #
|
|
# #
|
|
# - - - - - - - #
|
|
|
|
GRAY = "\e[0;30m"
|
|
RED = "\e[0;31m"
|
|
GREEN = "\e[0;32m"
|
|
YELLOW = "\e[0;33m"
|
|
BLUE = "\e[0;34m"
|
|
PURPLE = "\e[0;35m"
|
|
CYAN = "\e[0;36m"
|
|
WHITE = "\e[0;37m"
|
|
|
|
B_GRAY = "\e[1;30m"
|
|
B_RED = "\e[1;31m"
|
|
B_GREEN = "\e[1;32m"
|
|
B_YELLOW = "\e[1;33m"
|
|
B_BLUE = "\e[1;34m"
|
|
B_PURPLE = "\e[1;35m"
|
|
B_CYAN = "\e[1;36m"
|
|
B_WHITE = "\e[1;37m"
|
|
|
|
RESET = "\e[0m"
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
|
# . name = value \ . += append to a variable #
|
|
# VARIABLES . value . != set result of command #
|
|
# . name is case sensitive . ?= set if not already set #
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
|
|
|
NAME = containers
|
|
|
|
CC = g++
|
|
EXT = cpp
|
|
|
|
CFLAGS = -Wall -Wextra -Werror $(INCLUDES)
|
|
CFLAGS += -std=c++98
|
|
CFLAGS += -g3
|
|
|
|
VPATH = $(D_SRCS)
|
|
|
|
LIBS =
|
|
|
|
F_INCLUDES = $(HEADERS:%=$(D_HEADERS)/%) \
|
|
$(TEMPLATES:%=$(D_TEMPLATES)/%)
|
|
INCLUDES = -I$(D_HEADERS) \
|
|
-I$(D_TEMPLATES)
|
|
|
|
D_SRCS = ./tests
|
|
#SRCS = main42.cpp
|
|
SRCS = main.cpp \
|
|
tests_vectors.cpp
|
|
|
|
D_HEADERS = ./headers
|
|
HEADERS = colors.h \
|
|
tests.hpp \
|
|
\
|
|
enable_if.hpp \
|
|
iterator_traits.hpp \
|
|
reverse_iterator.hpp \
|
|
equal.hpp \
|
|
lexicographical_compare.hpp \
|
|
\
|
|
vector.hpp
|
|
|
|
D_TEMPLATES = ./templates
|
|
TEMPLATES = vector.tpp
|
|
|
|
D_OBJS = builds
|
|
OBJS = $(SRCS:%.$(EXT)=$(D_OBJS)/%.o)
|
|
|
|
ifeq "$(D_OBJS)" "."
|
|
RM_OBJS = rm -f $(OBJS)
|
|
else
|
|
RM_OBJS = rm -rf $(D_OBJS)
|
|
endif
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
|
# . target: prerequisites . $@ : target #
|
|
# RULES . recipe . $< : 1st prerequisite #
|
|
# . @recipe (silent) . $^ : all prerequisites #
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
|
|
|
all: $(NAME)
|
|
|
|
stl: CFLAGS += -D STL
|
|
stl: re
|
|
ft: re
|
|
|
|
$(D_OBJS)/%.o: %.$(EXT) | $(D_OBJS)
|
|
@echo $(CYAN)"compilation " $@ $(RESET)
|
|
@$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
$(D_OBJS):
|
|
mkdir $@
|
|
|
|
$(OBJS): $(F_INCLUDES)
|
|
|
|
$(NAME): $(OBJS)
|
|
@echo $(CYAN)"linkage (link objects.o) :"$(RESET)
|
|
$(CC) $(OBJS) -o $@ $(LIBS)
|
|
|
|
leaks: $(NAME)
|
|
valgrind --leak-check=full --show-leak-kinds=all ./$(NAME)
|
|
|
|
clean:
|
|
$(RM_OBJS)
|
|
|
|
fclean: clean
|
|
rm -f $(NAME)
|
|
|
|
re: fclean all
|
|
|
|
.PHONY : all clean fclean re
|
|
|