Skip to content

Commit d615628

Browse files
moygitster
authored andcommitted
Makefile: move 'ifdef DEVELOPER' after config.mak* inclusion
The DEVELOPER knob was introduced in 658df95 (add DEVELOPER makefile knob to check for acknowledged warnings, 2016-02-25), and works well when used as "make DEVELOPER=1", and when the configure script was not used. However, the advice given in CodingGuidelines to add DEVELOPER=1 to config.mak does not: config.mak is included after testing for DEVELOPER in the Makefile, and at least GNU Make's manual specifies "Conditional directives are parsed immediately", hence the config.mak declaration is not visible at the time the conditional is evaluated. Also, when using the configure script to generate a config.mak.autogen, the later file contained a "CFLAGS = <flags>" initialization, which overrode the "CFLAGS += -W..." triggered by DEVELOPER. This patch fixes both issues. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b051c59 commit d615628

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -380,18 +380,6 @@ ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
380380
ALL_LDFLAGS = $(LDFLAGS)
381381
STRIP ?= strip
382382

383-
ifdef DEVELOPER
384-
CFLAGS += -Werror \
385-
-Wdeclaration-after-statement \
386-
-Wno-format-zero-length \
387-
-Wold-style-definition \
388-
-Woverflow \
389-
-Wpointer-arith \
390-
-Wstrict-prototypes \
391-
-Wunused \
392-
-Wvla
393-
endif
394-
395383
# Create as necessary, replace existing, make ranlib unneeded.
396384
ARFLAGS = rcs
397385

@@ -952,6 +940,18 @@ include config.mak.uname
952940
-include config.mak.autogen
953941
-include config.mak
954942

943+
ifdef DEVELOPER
944+
CFLAGS += -Werror \
945+
-Wdeclaration-after-statement \
946+
-Wno-format-zero-length \
947+
-Wold-style-definition \
948+
-Woverflow \
949+
-Wpointer-arith \
950+
-Wstrict-prototypes \
951+
-Wunused \
952+
-Wvla
953+
endif
954+
955955
ifndef sysconfdir
956956
ifeq ($(prefix),/usr)
957957
sysconfdir = /etc

0 commit comments

Comments
 (0)