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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Johannes Sixt <johannes.sixt@xxxxxxxxxx>

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@xxxxxxxxxx>
---
Johannes Schindelin wrote:
>  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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]