summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-03-20 06:16:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-03-20 06:16:04 (GMT)
commit3cef67694cfd4f90e12174576fec79252d1e8b96 (patch)
treea078b96aca919cb5be8fbe4e127aa618ffe4f5f5 /Makefile
parent0e94f7aa730b108f7907cfab1b2a7fba965de442 (diff)
parent6d5d4b4e9326021f080508126be38ea1beaba6aa (diff)
downloadgit-3cef67694cfd4f90e12174576fec79252d1e8b96.zip
git-3cef67694cfd4f90e12174576fec79252d1e8b96.tar.gz
git-3cef67694cfd4f90e12174576fec79252d1e8b96.tar.bz2
Merge branch 'ab/makefile-help-devs-more'
CFLAGS now can be tweaked when invoking Make while using DEVELOPER=YesPlease; this did not work well before. * ab/makefile-help-devs-more: Makefile: allow for combining DEVELOPER=1 and CFLAGS="..." Makefile: move the setting of *FLAGS closer to "include" Makefile: Move *_LIBS assignment into its own section Makefile: add/remove comments at top and tweak whitespace Makefile: move "strip" assignment down from flags Makefile: remove an out-of-date comment
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile63
1 files changed, 33 insertions, 30 deletions
diff --git a/Makefile b/Makefile
index 5374938..3e03290 100644
--- a/Makefile
+++ b/Makefile
@@ -479,7 +479,11 @@ all::
#
# Define DEVELOPER to enable more compiler warnings. Compiler version
# and family are auto detected, but could be overridden by defining
-# COMPILER_FEATURES (see config.mak.dev)
+# COMPILER_FEATURES (see config.mak.dev). You can still set
+# CFLAGS="..." in combination with DEVELOPER enables, whether that's
+# for tweaking something unrelated (e.g. optimization level), or for
+# selectively overriding something DEVELOPER or one of the DEVOPTS
+# (see just below) brings in.
#
# When DEVELOPER is set, DEVOPTS can be used to control compiler
# options. This variable contains keywords separated by
@@ -506,17 +510,8 @@ GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN
-include GIT-VERSION-FILE
-# CFLAGS and LDFLAGS are for the users to override from the command line.
-
-CFLAGS = -g -O2 -Wall
-LDFLAGS =
-ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
-ALL_LDFLAGS = $(LDFLAGS)
-STRIP ?= strip
-
-# Create as necessary, replace existing, make ranlib unneeded.
-ARFLAGS = rcs
-
+# Set our default configuration.
+#
# Among the variables below, these:
# gitexecdir
# template_dir
@@ -561,6 +556,7 @@ perllibdir_relative = $(patsubst $(prefix)/%,%,$(perllibdir))
export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir
+# Set our default programs
CC = cc
AR = ar
RM = rm -f
@@ -573,29 +569,14 @@ TCLTK_PATH = wish
XGETTEXT = xgettext
MSGFMT = msgfmt
CURL_CONFIG = curl-config
-PTHREAD_LIBS = -lpthread
-PTHREAD_CFLAGS =
GCOV = gcov
+STRIP = strip
SPATCH = spatch
export TCL_PATH TCLTK_PATH
-# user customisation variable for 'sparse' target
-SPARSE_FLAGS ?=
-# internal/platform customisation variable for 'sparse'
-SP_EXTRA_FLAGS =
-
-SPATCH_FLAGS = --all-includes --patch .
-
-
-
-### --- END CONFIGURATION SECTION ---
-
-# Those must not be GNU-specific; they are shared with perl/ which may
-# be built by a different compiler. (Note that this is an artifact now
-# but it still might be nice to keep that distinction.)
-BASIC_CFLAGS = -I.
-BASIC_LDFLAGS =
+# Set our default LIBS variables
+PTHREAD_LIBS = -lpthread
# Guard against environment variables
BUILTIN_OBJS =
@@ -1177,6 +1158,25 @@ ifeq ($(wildcard sha1collisiondetection/lib/sha1.h),sha1collisiondetection/lib/s
DC_SHA1_SUBMODULE = auto
endif
+# Set CFLAGS, LDFLAGS and other *FLAGS variables. These might be
+# tweaked by config.* below as well as the command-line, both of
+# which'll override these defaults.
+CFLAGS = -g -O2 -Wall
+LDFLAGS =
+BASIC_CFLAGS = -I.
+BASIC_LDFLAGS =
+
+# library flags
+ARFLAGS = rcs
+PTHREAD_CFLAGS =
+
+# For the 'sparse' target
+SPARSE_FLAGS ?=
+SP_EXTRA_FLAGS =
+
+# For the 'coccicheck' target
+SPATCH_FLAGS = --all-includes --patch .
+
include config.mak.uname
-include config.mak.autogen
-include config.mak
@@ -1185,6 +1185,9 @@ ifdef DEVELOPER
include config.mak.dev
endif
+ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS)
+ALL_LDFLAGS = $(LDFLAGS)
+
comma := ,
empty :=
space := $(empty) $(empty)