Add pointer support and improve debug and valgrind in Makefile

This commit is contained in:
gbaconni
2022-04-15 17:20:15 +02:00
parent af87168372
commit 175a774e49
6 changed files with 82 additions and 27 deletions

View File

@@ -6,7 +6,7 @@
# By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/01/18 15:11:16 by gbaconni #+# #+# #
# Updated: 2022/04/15 00:23:05 by gbaconni ### lausanne.ch #
# Updated: 2022/04/15 17:19:14 by gbaconni ### lausanne.ch #
# #
# **************************************************************************** #
#
@@ -31,23 +31,25 @@ HDR = $(LIBFTPRINTF)/libftprintf.h
CC = gcc
CFLAGS = -Wall -Wextra -Werror
ifeq ($(FAST), 1)
CFLAGS += -v -pipe -O3 -ffast-math -fomit-frame-pointer -funroll-loops
#CFLAGS += -v -pipe -Ofast -ffast-math -funroll-loops -fomit-frame-pointer
CFLAGS += -pipe -O3 -ffast-math -fomit-frame-pointer -funroll-loops
#CFLAGS += -pipe -Ofast -ffast-math -funroll-loops -fomit-frame-pointer
endif
ifeq ($(DEBUG), 1)
CFLAGS += -g -O1 -fsanitize=address -fsanitize=undefined -fsanitize=signed-integer-overflow
#CFLAGS += -v -g -O1 -fsanitize=address -fsanitize=undefined -fsanitize=signed-integer-overflow
CFLAGS += -g -O0 -fsanitize=address -fsanitize=undefined -fsanitize=signed-integer-overflow
endif
ifeq ($(LEAK), 1)
CFLAGS += -g -O0
endif
VALGRIND = valgrind
VALGRINDFLAGS = --quiet --leak-check=full --show-leak-kinds=all
ifeq ($(LEAK), 1)
PREFIX += $(VALGRIND) $(VALGRINDFLAGS)
endif
RM = rm
RMFLAGS = -f
VALGRIND = valgrind
VALGRINDFLAGS = --quiet --leak-check=full --show-leak-kinds=all
ifeq ($(DEBUG), 1)
PREFIX += $(VALGRIND) $(VALGRINDFLAGS)
endif
NORMINETTE = norminette
NORMINETTEFLAGS = -o
@@ -66,17 +68,19 @@ fclean: clean
@$(MAKE) -C $(LIBFTPRINTF) fclean
re: fclean all
@$(MAKE) -C $(LIBFTPRINTF) re
check:
@$(MAKE) -C $(LIBFTPRINTF) check
leak:
@$(MAKE) -C $(LIBFTPRINTF) re LEAK=1
debug:
@$(MAKE) -C $(LIBFTPRINTF) re DEBUG=1
@$(MAKE) re DEBUG=1
fast:
@$(MAKE) -C $(LIBFTPRINTF) re FAST=1
@$(MAKE) re FAST=1
test: clean $(NAME)
@$(PREFIX) ./$(NAME) "%c" C || true
@@ -86,11 +90,15 @@ test: clean $(NAME)
@$(PREFIX) ./$(NAME) "%X" 42 || true
@$(PREFIX) ./$(NAME) "42" "" || true
@$(PREFIX) ./$(NAME) "%%" "" || true
@$(PREFIX) ./$(NAME) "%p" "" || true
test2: debug
test2: leak
@$(MAKE) test LEAK=1
test3: debug
@$(MAKE) test DEBUG=1
test3: fast
test4: fast
@$(MAKE) test FAST=1
update: config online pull