summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-10-03 16:25:56 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-10-04 09:28:43 -0400
commite3ebe734ab047418a3c26cd7eca53fc7f4f60111 (patch)
treea8a2445505a392efb9e3cf16c4f8b3144add0b26
parenta96ddeb7dc528d29d05f52a9b8857b2f8924fddc (diff)
downloadbfs-e3ebe734ab047418a3c26cd7eca53fc7f4f60111.tar.xz
build: New lint flag
-rw-r--r--GNUmakefile9
1 files changed, 8 insertions, 1 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 8154240..c1296f9 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -166,6 +166,13 @@ LOCAL_CFLAGS += --coverage
LOCAL_CFLAGS := $(patsubst -std=c%,-std=gnu%,$(LOCAL_CFLAGS))
endif
+ifneq ($(filter lint,$(MAKECMDGOALS)),)
+LOCAL_CPPFLAGS += \
+ -D_FORTIFY_SOURCE=3 \
+ -DBFS_LINT
+LOCAL_CFLAGS += -Werror -O2
+endif
+
ifneq ($(filter release,$(MAKECMDGOALS)),)
LOCAL_CPPFLAGS += -DNDEBUG
CFLAGS := $(DEFAULT_CFLAGS) -O3 -flto=auto
@@ -181,7 +188,7 @@ bfs: $(BIN)/bfs
.PHONY: bfs
# Goals that are treated like flags by this makefile
-FLAG_GOALS := asan lsan msan tsan ubsan gcov release
+FLAG_GOALS := asan lsan msan tsan ubsan gcov lint release
# These are the remaining non-flag goals
GOALS := $(filter-out $(FLAG_GOALS),$(MAKECMDGOALS))