Makefile: move the setting of *FLAGS closer to "include"
[git/git.git] / config.mak.dev
CommitLineData
99f763ba 1ifeq ($(filter no-error,$(DEVOPTS)),)
1da1580e 2CFLAGS += -Werror
99f763ba 3endif
729b3925
BB
4ifneq ($(filter pedantic,$(DEVOPTS)),)
5CFLAGS += -pedantic
6# don't warn for each N_ use
7CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
8endif
6163f3f1 9CFLAGS += -Wall
1da1580e 10CFLAGS += -Wdeclaration-after-statement
801fa63a 11CFLAGS += -Wformat-security
1da1580e
NTND
12CFLAGS += -Wno-format-zero-length
13CFLAGS += -Wold-style-definition
14CFLAGS += -Woverflow
15CFLAGS += -Wpointer-arith
16CFLAGS += -Wstrict-prototypes
17CFLAGS += -Wunused
18CFLAGS += -Wvla
19
20ifndef COMPILER_FEATURES
21COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
22endif
23
24ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
25CFLAGS += -Wtautological-constant-out-of-range-compare
26endif
27
28ifneq ($(or $(filter gcc6,$(COMPILER_FEATURES)),$(filter clang4,$(COMPILER_FEATURES))),)
29CFLAGS += -Wextra
30# if a function is public, there should be a prototype and the right
31# header file should be included. If not, it should be static.
32CFLAGS += -Wmissing-prototypes
26d2e4fb 33ifeq ($(filter extra-all,$(DEVOPTS)),)
1da1580e
NTND
34# These are disabled because we have these all over the place.
35CFLAGS += -Wno-empty-body
36CFLAGS += -Wno-missing-field-initializers
37CFLAGS += -Wno-sign-compare
1da1580e
NTND
38CFLAGS += -Wno-unused-parameter
39endif
26d2e4fb 40endif
1da1580e
NTND
41
42# uninitialized warnings on gcc 4.9.2 in xdiff/xdiffi.c and config.c
43# not worth fixing since newer compilers correctly stop complaining
44ifneq ($(filter gcc4,$(COMPILER_FEATURES)),)
45ifeq ($(filter gcc5,$(COMPILER_FEATURES)),)
46CFLAGS += -Wno-uninitialized
47endif
48endif