Skip to content

Commit 71a7894

Browse files
avargitster
authored andcommitted
Makefile: move the setting of *FLAGS closer to "include"
Move the setting of variables like CFLAGS down past settings like "prefix" and default programs like "TAR" to just before we do the include from "config.mak.*". There's no functional changes here yet, but move note that "ALL_CFLAGS" and "ALL_LDFLAGS" are moved below the include. A follow-up change will tweak those depending on a variable set in config.mak.dev. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8fb2a23 commit 71a7894

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

Makefile

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -506,13 +506,6 @@ GIT-VERSION-FILE: FORCE
506506
@$(SHELL_PATH) ./GIT-VERSION-GEN
507507
-include GIT-VERSION-FILE
508508

509-
# CFLAGS and LDFLAGS are for the users to override from the command line.
510-
CFLAGS = -g -O2 -Wall
511-
LDFLAGS =
512-
ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
513-
ALL_LDFLAGS = $(LDFLAGS)
514-
ARFLAGS = rcs
515-
516509
# Set our default configuration.
517510
#
518511
# Among the variables below, these:
@@ -572,7 +565,6 @@ TCLTK_PATH = wish
572565
XGETTEXT = xgettext
573566
MSGFMT = msgfmt
574567
CURL_CONFIG = curl-config
575-
PTHREAD_CFLAGS =
576568
GCOV = gcov
577569
STRIP = strip
578570
SPATCH = spatch
@@ -582,16 +574,6 @@ export TCL_PATH TCLTK_PATH
582574
# Set our default LIBS variables
583575
PTHREAD_LIBS = -lpthread
584576

585-
# user customisation variable for 'sparse' target
586-
SPARSE_FLAGS ?=
587-
# internal/platform customisation variable for 'sparse'
588-
SP_EXTRA_FLAGS =
589-
590-
SPATCH_FLAGS = --all-includes --patch .
591-
592-
BASIC_CFLAGS = -I.
593-
BASIC_LDFLAGS =
594-
595577
# Guard against environment variables
596578
BUILTIN_OBJS =
597579
BUILT_INS =
@@ -1160,6 +1142,25 @@ ifeq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/s
11601142
DC_SHA1_SUBMODULE = auto
11611143
endif
11621144

1145+
# Set CFLAGS, LDFLAGS and other *FLAGS variables. These might be
1146+
# tweaked by config.* below as well as the command-line, both of
1147+
# which'll override these defaults.
1148+
CFLAGS = -g -O2 -Wall
1149+
LDFLAGS =
1150+
BASIC_CFLAGS = -I.
1151+
BASIC_LDFLAGS =
1152+
1153+
# library flags
1154+
ARFLAGS = rcs
1155+
PTHREAD_CFLAGS =
1156+
1157+
# For the 'sparse' target
1158+
SPARSE_FLAGS ?=
1159+
SP_EXTRA_FLAGS =
1160+
1161+
# For the 'coccicheck' target
1162+
SPATCH_FLAGS = --all-includes --patch .
1163+
11631164
include config.mak.uname
11641165
-include config.mak.autogen
11651166
-include config.mak
@@ -1168,6 +1169,9 @@ ifdef DEVELOPER
11681169
include config.mak.dev
11691170
endif
11701171

1172+
ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
1173+
ALL_LDFLAGS = $(LDFLAGS)
1174+
11711175
comma := ,
11721176
empty :=
11731177
space := $(empty) $(empty)

0 commit comments

Comments
 (0)