]> Sergey Matveev's repositories - bfs.git/commitdiff
build: New lint flag
authorTavian Barnes <tavianator@tavianator.com>
Tue, 3 Oct 2023 20:25:56 +0000 (16:25 -0400)
committerTavian Barnes <tavianator@tavianator.com>
Wed, 4 Oct 2023 13:28:43 +0000 (09:28 -0400)
GNUmakefile

index 815424057de05e4779bec869858e0a862a41e3c7..c1296f9045f3fbbd12e864eddf92d8322b50ee31 100644 (file)
@@ -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))