stack almost good
This commit is contained in:
93
Makefile
93
Makefile
@@ -31,6 +31,8 @@ RESET = "\e[0m"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||
|
||||
NAME = containers
|
||||
NAME_FT = containers_ft
|
||||
NAME_STL = containers_stl
|
||||
|
||||
CC = g++
|
||||
EXT = cpp
|
||||
@@ -39,6 +41,11 @@ CFLAGS = -Wall -Wextra -Werror $(INCLUDES)
|
||||
CFLAGS += -std=c++98
|
||||
CFLAGS += -g3
|
||||
|
||||
CFLAGS_STL = -Wall -Wextra -Werror $(INCLUDES)
|
||||
CFLAGS_STL += -D STL
|
||||
CFLAGS_STL += -std=c++98
|
||||
CFLAGS_STL += -g3
|
||||
|
||||
VPATH = $(D_SRCS)
|
||||
|
||||
LIBS =
|
||||
@@ -52,14 +59,20 @@ INCLUDES = -I$(D_HEADERS) \
|
||||
|
||||
D_SRCS = ./tests
|
||||
#SRCS = main42.cpp
|
||||
SRCS = main.cpp \
|
||||
tests_definitions.cpp \
|
||||
\
|
||||
tests_vector.cpp \
|
||||
tests_map.cpp
|
||||
#SRCS = main_map_1.cpp
|
||||
#SRCS = main_map_2.cpp
|
||||
SRCS = main_stack_1.cpp
|
||||
#SRCS = \
|
||||
# main.cpp \
|
||||
# tests_definitions.cpp \
|
||||
# \
|
||||
# tests_vector.cpp \
|
||||
# tests_map.cpp \
|
||||
# tests_stack.cpp
|
||||
|
||||
D_HEADERS = ./headers
|
||||
HEADERS = colors.h \
|
||||
HEADERS = \
|
||||
colors.h \
|
||||
\
|
||||
enable_if.hpp \
|
||||
iterator_traits.hpp \
|
||||
@@ -71,30 +84,23 @@ HEADERS = colors.h \
|
||||
map.hpp \
|
||||
map_node.hpp \
|
||||
map_iterator.hpp \
|
||||
vector.hpp
|
||||
# map.hpp
|
||||
# bst.hpp
|
||||
# bst_node.hpp
|
||||
# bst_iterator.hpp
|
||||
vector.hpp \
|
||||
stack.hpp
|
||||
|
||||
D_TEMPLATES = ./templates
|
||||
TEMPLATES = bst.tpp \
|
||||
\
|
||||
vector.tpp
|
||||
# map.tpp
|
||||
TEMPLATES = \
|
||||
vector.tpp \
|
||||
map.tpp
|
||||
|
||||
D_TESTS = ./tests/includes
|
||||
TESTS = main.hpp \
|
||||
TESTS = \
|
||||
main.hpp \
|
||||
tests_utils.hpp
|
||||
|
||||
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
|
||||
D_OBJS_FT = builds_ft
|
||||
OBJS_FT = $(SRCS:%.$(EXT)=$(D_OBJS_FT)/%.o)
|
||||
D_OBJS_STL = builds_stl
|
||||
OBJS_STL = $(SRCS:%.$(EXT)=$(D_OBJS_STL)/%.o)
|
||||
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||
@@ -103,37 +109,42 @@ endif
|
||||
# . @recipe (silent) . $^ : all prerequisites #
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||
|
||||
all: $(NAME)
|
||||
all: $(NAME_FT) $(NAME_STL)
|
||||
|
||||
stl: CFLAGS += -D STL
|
||||
stl: re
|
||||
ft: re
|
||||
stl: $(NAME_STL)
|
||||
ft: $(NAME_FT)
|
||||
|
||||
leakstl: CFLAGS += -D STL
|
||||
leakstl: fclean leaks
|
||||
leakft: fclean leaks
|
||||
|
||||
$(D_OBJS)/%.o: %.$(EXT) | $(D_OBJS)
|
||||
$(D_OBJS_FT)/%.o: %.$(EXT) | $(D_OBJS_FT)
|
||||
@echo $(CYAN)"compilation " $@ $(RESET)
|
||||
@$(CC) $(CFLAGS) -c $< -o $@
|
||||
$(D_OBJS_STL)/%.o: %.$(EXT) | $(D_OBJS_STL)
|
||||
@echo $(CYAN)"compilation -D STL" $@ $(RESET)
|
||||
@$(CC) $(CFLAGS) -D STL -c $< -o $@
|
||||
|
||||
$(D_OBJS):
|
||||
$(D_OBJS_FT) $(D_OBJS_STL):
|
||||
mkdir $@
|
||||
|
||||
$(OBJS): $(F_INCLUDES)
|
||||
|
||||
$(NAME): $(OBJS)
|
||||
@echo $(CYAN)"linkage (link objects.o) :"$(RESET)
|
||||
$(CC) $(OBJS) -o $@ $(LIBS)
|
||||
# https://stackoverflow.com/questions/19259108/makefile-same-rule-for-multiple-targets
|
||||
$(NAME_FT): $(OBJS_FT)
|
||||
$(NAME_STL): $(OBJS_STL)
|
||||
$(NAME_FT) $(NAME_STL):
|
||||
@echo $(CYAN)"linkage (link objects.o)"$(RESET)
|
||||
@$(CC) $^ -o $@ $(LIBS)
|
||||
|
||||
leaks: $(NAME)
|
||||
valgrind --leak-check=full --show-leak-kinds=all ./$(NAME)
|
||||
leaks: leaksft
|
||||
leaksft: $(NAME_FT)
|
||||
valgrind --leak-check=full --show-leak-kinds=all ./$<
|
||||
leakstl: $(NAME_STL)
|
||||
valgrind --leak-check=full --show-leak-kinds=all ./$<
|
||||
|
||||
clean:
|
||||
$(RM_OBJS)
|
||||
rm -rf $(D_OBJS_FT)
|
||||
rm -rf $(D_OBJS_STL)
|
||||
|
||||
fclean: clean
|
||||
rm -f $(NAME)
|
||||
rm -f $(NAME_FT) $(NAME_STL)
|
||||
|
||||
re: fclean all
|
||||
|
||||
|
||||
Reference in New Issue
Block a user