Update Makefile
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 3s

Some cleanup.
Use certain build flags only in "RELEASE" mode.
This commit is contained in:
Stephen Seo 2024-09-11 13:11:55 +09:00
parent 17ccacf708
commit 09b88f75c2

View file

@ -5,9 +5,8 @@ COMMON_FLAGS = -Wall -Wextra -Wpedantic \
DEBUG_FLAGS = -Og -g DEBUG_FLAGS = -Og -g
RELEASE_FLAGS = -O3 -DNDEBUG RELEASE_FLAGS = -O3 -DNDEBUG
EXTRA_COMMON_FLAGS =
ifndef MINIMAL_BUILD_FLAGS ifndef MINIMAL_BUILD_FLAGS
EXTRA_COMMON_FLAGS = \ COMMON_FLAGS := ${COMMON_FLAGS} \
-Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough \ -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough \
-Werror=format-security \ -Werror=format-security \
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 \ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 \
@ -18,16 +17,19 @@ ifndef MINIMAL_BUILD_FLAGS
-Wl,-z,relro -Wl,-z,now \ -Wl,-z,relro -Wl,-z,now \
-Wl,--as-needed -Wl,--no-copy-dt-needed-entries \ -Wl,--as-needed -Wl,--no-copy-dt-needed-entries \
-fPIE -pie \ -fPIE -pie \
-fno-delete-null-pointer-checks -fno-strict-overflow \
-fno-strict-aliasing -ftrivial-auto-var-init=zero \
-Werror=implicit -Werror=incompatible-pointer-types \ -Werror=implicit -Werror=incompatible-pointer-types \
-Werror=int-conversion -Werror=int-conversion
ifdef RELEASE
COMMON_FLAGS := ${COMMON_FLAGS} \
-fno-delete-null-pointer-checks -fno-strict-overflow \
-fno-strict-aliasing -ftrivial-auto-var-init=zero
endif
endif endif
ifdef RELEASE ifdef RELEASE
CFLAGS = ${COMMON_FLAGS} ${EXTRA_COMMON_FLAGS} ${RELEASE_FLAGS} CFLAGS = ${COMMON_FLAGS} ${RELEASE_FLAGS}
else else
CFLAGS = ${COMMON_FLAGS} ${EXTRA_COMMON_FLAGS} ${DEBUG_FLAGS} CFLAGS = ${COMMON_FLAGS} ${DEBUG_FLAGS}
endif endif
HEADERS = \ HEADERS = \