From ffb9b1d9d82cb34c79421bc784d827881d4133c6 Mon Sep 17 00:00:00 2001 From: Emil Date: Fri, 4 Aug 2023 13:17:55 -0600 Subject: [PATCH] Added features to makefile --- Makefile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d20b5cb..b0e070d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ # CC=gcc -CFLAGS:=-Wall -Wextra -Wpedantic -ggdb $(shell pkg-config --cflags ncurses readline) -LDLIBS=-I ${CHDRD} $(shell pkg-config --libs ncurses readline) +CFLAGS:=-Wall -Wextra -Wpedantic +CPPFLAGS:=-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 +LDLIBS=-I ${CHDRD} -lncurses -ltinfo -lreadline LEX:=flex LEXD:=src/ @@ -19,6 +20,16 @@ CHDR:=$(addsuffix .gch,$(subst ${HDRD},${CHDRD},${HDR})) OUTPUT:=csope +ifeq (${DEBUG},1) + CFLAGS += -Og -ggdb +else + CFLAGS += -O3 -flto=auto -fomit-frame-pointer +endif + +ifdef SAN + CFLAGS += -fsanitize=${SAN} +endif + main: ${CHDR} ${OBJ} ${LINK.c} ${OBJ} -o ${OUTPUT} ${LDLIBS}