Subject: Re: How to build to debug with gdb?

From: SZEDER Gábor <[email-masked]>
Date: Wed, 28 Aug 2019 12:32:17 +0200

On Wed, Aug 28, 2019 at 08:15:57AM +0000, Giuseppe Crino' wrote:
> On Tue, Aug 27, 2019 at 08:36:40PM +0200, SZEDER Gábor wrote:
> > Try using the same build flags for the install, i.e.:
> > 
> >   make prefix=/usr/local DEVELOPER=1 CFLAGS="-O0 -g" install
> 
> Yes, now it works thanks!
> 
> On Tue, Aug 27, 2019 at 08:34:23PM +0200, Johannes Sixt wrote:
> > That is because the command sequence above does not do what you think it
> > does. Didn't you notice that everything was recompiled during `sudo make
> > install`?
> 
> Shouldn't be this documented somewhere?

Well, perhaps.
But would users actually read it?  Dunno.

Case in point: the first few lines of 'INSTALL' already tell you to
build and install Git with the following commands:

  $ make prefix=/usr all doc info ;# as yourself
  # make prefix=/usr install install-doc install-html install-info ;# as root

Note the same 'prefix=...' in both commands, yet you omitted it when
you ran 'make install' ;)

> To my knowledge `make install` is expected to copy artifacts of the
> build under prefix. It's unusual to me that `install` has the `all`
> target as prerequisite.

I don't think it's unusual at all that the 'install' target depends on
'all'.  A quick and incomprehensive survey of Makefiles from a few
open source projects that I happen to have lying around seems to
confirm this.

What might be unusual (but is rather convenient for developers) is
that Git's build process checks the build flags, and rebuilds the
whole thing after the flags changed.