Re: [PATCH] Makefile: do not optimize when DEBUG=1

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

 



Hi,

On Wed, 7 Mar 2007, Johannes Sixt wrote:

> Johannes Schindelin wrote:
> > You can do that now by removing just the object files containing the
> > code you want to debug, and saying "make DEBUG=1".
> > [...]
> > -CFLAGS = -g -O2 -Wall
> > +CFLAGS = -g -Wall
> > +ifndef DEBUG
> > +       CFLAGS += -O2
> > +endif
> 
> I think the shortcut to remove just the interesting object file does not 
> work because Makefile notices (the GIT-CFLAGS rule) that there are "new 
> flags or prefix", and so recompiles everything.

That is unfortunatley true, and was hidden in my test by something 
completely unrelated.

I do something completely different now:

@@ -846,7 +841,8 @@ TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
 
 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

... and in my config.mak, there is

ifdef DEBUG
	ALL_CFLAGS := $(filter-out -O2,$(ALL_CFLAGS))
	IGNORE_GIT_CFLAGS = YesPlease
endif

I'm happy now.

Ciao,
Dscho

-
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]