git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 5/6] Makefile: move the setting of *FLAGS closer to "include"

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 22, 2019, 23:19 UTC
Message-ID
<xmqqva1bo1h5.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190222144127.32248-6-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
Show 8 quoted lines
> 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.
Sorry, but cannot parse the sentence around "move note".
Show 67 quoted lines
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  Makefile | 40 ++++++++++++++++++++++------------------
>  1 file changed, 22 insertions(+), 18 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 59674ce9d7..82cfd6c2e4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -506,13 +506,6 @@ 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)
> -ARFLAGS = rcs
> -
>  # Set our default configuration.
>  #
>  # Among the variables below, these:
> @@ -572,7 +565,6 @@ TCLTK_PATH = wish
>  XGETTEXT = xgettext
>  MSGFMT = msgfmt
>  CURL_CONFIG = curl-config
> -PTHREAD_CFLAGS =
>  GCOV = gcov
>  STRIP = strip
>  SPATCH = spatch
> @@ -582,16 +574,6 @@ export TCL_PATH TCLTK_PATH
>  # Set our default LIBS variables
>  PTHREAD_LIBS = -lpthread
>  
> -# user customisation variable for 'sparse' target
> -SPARSE_FLAGS ?=
> -# internal/platform customisation variable for 'sparse'
> -SP_EXTRA_FLAGS =
> -
> -SPATCH_FLAGS = --all-includes --patch .
> -
> -BASIC_CFLAGS = -I.
> -BASIC_LDFLAGS =
> -
>  # Guard against environment variables
>  BUILTIN_OBJS =
>  BUILT_INS =
> @@ -1160,6 +1142,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 ?=
Makes us wonder why only this one is different and uses ?= ;-)
Show 18 quoted lines
> +SP_EXTRA_FLAGS =
> +
> +# For the 'coccicheck' target
> +SPATCH_FLAGS = --all-includes --patch .
> +
>  include config.mak.uname
>  -include config.mak.autogen
>  -include config.mak
> @@ -1168,6 +1169,9 @@ ifdef DEVELOPER
>  include config.mak.dev
>  endif
>  
> +ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
> +ALL_LDFLAGS = $(LDFLAGS)
> +
>  comma := ,
>  empty :=
>  space := $(empty) $(empty)
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 16 of 20 in “Makefile: remove an out-of-date comment”
  1. Makefile: remove an out-of-date commentÆvar Arnfjörð Bjarmason, Feb 22, 2019
  2. 0/6 Makefile: allow for combining DEVELOPER= and CFLAGS="..."Ævar Arnfjörð Bjarmason, Feb 22, 2019
  3. Jeff KingFeb 22, 2019
  4. Ævar Arnfjörð BjarmasonFeb 22, 2019
  5. Jeff KingFeb 23, 2019
  6. 1/6 Makefile: remove an out-of-date commentÆvar Arnfjörð Bjarmason, Feb 22, 2019
  7. 2/6 Makefile: move "strip" assignment down from flagsÆvar Arnfjörð Bjarmason, Feb 22, 2019
  8. Jeff KingFeb 22, 2019
  9. Ramsay JonesFeb 22, 2019
  10. Jeff KingFeb 23, 2019
  11. 3/6 Makefile: add/remove comments at top and tweak whitespaceÆvar Arnfjörð Bjarmason, Feb 22, 2019
  12. 4/6 Makefile: Move *_LIBS assignment into its own sectionÆvar Arnfjörð Bjarmason, Feb 22, 2019
  13. Jeff KingFeb 22, 2019
  14. Eric SunshineFeb 22, 2019
  15. 5/6 Makefile: move the setting of *FLAGS closer to "include"Ævar Arnfjörð Bjarmason, Feb 22, 2019
  16. Junio C HamanoFeb 22, 2019
  17. 6/6 Makefile: allow for combining DEVELOPER=1 and CFLAGS="..."Ævar Arnfjörð Bjarmason, Feb 22, 2019
  18. Jeff KingFeb 22, 2019
  19. Junio C HamanoFeb 22, 2019
  20. Jeff KingFeb 22, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.