diff --git a/Makefile b/Makefile index 0f34232..f86db1f 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ SRC = \ HEADERS = ft_bsq.h -OBJDIR = srcs +OBJDIR = obj SRCDIR = srcs INCDIR = includes @@ -22,18 +22,20 @@ CFLAGS = \ -Wextra \ -Werror \ -I$(INCDIR) \ + -fcolor-diagnostics \ _OBJ = $(SRC:.c=.o) OBJ = $(addprefix $(OBJDIR)/,$(_OBJ)) DEPS = $(addprefix $(INCDIR)/,$(HEADERS)) RM = /bin/rm -f +RMDIR = /bin/rmdir .DEFAULT_GOAL = all NAME ?= bsq -.PHONY: re fclean clean all +.PHONY: re fclean clean all test tests run valgrind all: $(NAME) @@ -42,11 +44,46 @@ clean: fclean: clean $(RM) $(NAME) + @$(RMDIR) $(OBJDIR) 2>/dev/null || true re: fclean all $(NAME): $(OBJ) $(CC) $(LDFLAGS) $^ -o $@ +$(OBJ): | $(OBJDIR) + $(OBJDIR)/%.o: $(SRCDIR)/%.c $(DEPS) - $(CC) $(CFLAGS) -c $< -o $@ \ No newline at end of file + @norminette $< >/dev/null || { printf '\033[101;37m%s\033[m\n' "!Norminette Failed>>>"; norminette $<; printf '\033[101;37m%s\033[m\n' "<</dev/null 1>&2 valgrind --error-exitcode=1 +# The following 3 lines intentionally contain non-printable characters, namely +# the escape character \x1b. It is soley for the color-coding. If you use this Makefile, +# either download/copy this file or select/copy the text directly and lose the colors. +YLW = : ; +CYN = : ; +CLR_RST = && :  + +run: + @clear + $(CYN) $(VALGRIND_SMALL) ./$(NAME) $(CLR_RST) $(SUCCESS_VALG) + $(YLW) ./$(NAME) $(CLR_RST) $(SUCCESS) + +valgrind: re + $(CYN) $(VALGRIND) ./$(NAME) ./assets/subject.map ./assets/full.map $(CLR_RST) $(SUCCESS_VALG)