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/14 23:54:03 by gbaconni ### lausanne.ch #
# Updated: 2022/04/15 17:19:30 by gbaconni ### lausanne.ch #
# #
# **************************************************************************** #
#
@@ -52,12 +52,20 @@ HDR = 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
AR = ar
@@ -102,6 +110,9 @@ so: $(OBJ) $(OBJ_BONUS)
check:
@$(NORMINETTE) $(NORMINETTEFLAGS) $(HDR) $(SRC) ${SRC_BONUS} 2>&1 | grep -v '\.[ch]: OK!' || true
leak:
@$(MAKE) re LEAK=1
debug:
@$(MAKE) re DEBUG=1