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

[PATCH] Avoid rebuilding everything if user changes CFLAGS on the make command line

From
Johannes Sixt <j.sixt@eudaptics.com>
Date
Mar 7, 2007, 13:41 UTC
Message-ID
<45EEC122.EA43CB72@eudaptics.com>
In-Reply-To
<Pine.LNX.4.63.0703071319520.22628@wbgn013.biozentrum.uni-wuerzburg.de>
From: Johannes Sixt <johannes.sixt@telecom.at>

The following sequence of commands is commonly used to recompile selected files with different flags, for example, to change the debug information:

   make
   rm builtin-diff.o
   make CFLAGS="-g -O0"

However, the Makefile is clever enough to notice that the second 'make' invocation changes the build flags and rebuilds everything.

This change exempts the value of CFLAGS (which is explicitly declared as reserved for the user to change from the command line) from this auto-detection.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
Johannes Schindelin wrote:
Show 8 quoted lines
>  GIT-CFLAGS: .FORCE-GIT-CFLAGS
>         @FLAGS='$(TRACK_CFLAGS)'; \
> -           if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
> +           if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" -a \
> +                   -z "$(IGNORE_GIT_CFLAGS)"; then \
>                 echo 1>&2 "    * new build flags or prefix"; \
>                 echo "$$FLAGS" >GIT-CFLAGS; \
>              fi

IMHO, the value of $(CFLAGS) (which the Makefile declares as "for the users to override from the command line") should never take part in this build-flags-change-autodetection.

-- Hannes
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 9a37b15..8410530 100644
--- a/Makefile
+++ b/Makefile
@@ -812,7 +812,7 @@ tags:
 	find . -name '*.[hcS]' -print | xargs ctags -a
 
 ### Detect prefix changes
-TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
+TRACK_CFLAGS = $(subst ','\'',$(BASIC_CFLAGS)):\
             
$(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
 
 GIT-CFLAGS: .FORCE-GIT-CFLAGS
-- 
1.5.0.2.279.g4808
Previous: Johannes SchindelinNext: Junio C Hamano
Message 4 of 5 in “Makefile: do not optimize when DEBUG=1”
  1. Makefile: do not optimize when DEBUG=1Johannes Schindelin, Mar 6, 2007
  2. Johannes SixtMar 7, 2007
  3. Johannes SchindelinMar 7, 2007
  4. Avoid rebuilding everything if user changes CFLAGS on the make command lineJohannes Sixt, Mar 7, 2007
  5. Junio C HamanoMar 7, 2007

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.