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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Feb 22, 2019 at 15:41 UTC
71a7894ba6b0546f28458b8b962674084a08019d
1 file changed
+22
-18
Makefile
+22
-18
@@ -506,13 +506,6 @@ GIT-VERSION-FILE: FORCE
506
@$(SHELL_PATH) ./GIT-VERSION-GEN
507
-include GIT-VERSION-FILE
508
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
-
509
# Set our default configuration.
510
#
511
# Among the variables below, these:
@@ -572,7 +565,6 @@ TCLTK_PATH = wish
565
XGETTEXT = xgettext
566
MSGFMT = msgfmt
567
CURL_CONFIG = curl-config
575
-PTHREAD_CFLAGS =
568
GCOV = gcov
569
STRIP = strip
570
SPATCH = spatch
@@ -582,16 +574,6 @@ export TCL_PATH TCLTK_PATH
574
# Set our default LIBS variables
575
PTHREAD_LIBS = -lpthread
576
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
-
577
# Guard against environment variables
578
BUILTIN_OBJS =
579
BUILT_INS =
@@ -1160,6 +1142,25 @@ ifeq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/s
1142
DC_SHA1_SUBMODULE = auto
1143
endif
1144
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
+
1164
include config.mak.uname
1165
-include config.mak.autogen
1166
-include config.mak
@@ -1168,6 +1169,9 @@ ifdef DEVELOPER
1169
include config.mak.dev
1170
endif
1171
1172
+ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
1173
+ALL_LDFLAGS = $(LDFLAGS)
1174
+
1175
comma := ,
1176
empty :=
1177
space := $(empty) $(empty)