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

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 7, 2007, 12:37 UTC
Message-ID
<Pine.LNX.4.63.0703071319520.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<45EE854E.210EDAFF@eudaptics.com>
Hi,
On Wed, 7 Mar 2007, Johannes Sixt wrote:
Show 13 quoted lines
> 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
Previous: Johannes SixtNext: Johannes Sixt
Message 3 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.