Thread: Cleaner build output when not much has changed

Cleaner build output when not much has changed

From
Gurjeet Singh
Date:

I was looking for ways to reduce the noise in Postgres make output, specifically, I wanted to eliminate the "Nothing to be done for `all' " messages, since they don't add much value, and just ad to the clutter.

Most of the solutions I have seen propose grepping out the noisy parts. But one of them proposed adding a .PHONY rule and then adding a no-op command to a target's recipe. Attached is a small patch to a few makefiles which helps remove the above mentioned message. Following is a sample output:

...
make[3]: Entering directory `/home/gurjeet/dev/pgdbuilds/quiet_make/src/bin/initdb'
make -C ../../../src/port all
make[4]: Entering directory `/home/gurjeet/dev/pgdbuilds/quiet_make/src/port'
make -C ../backend submake-errcodes
make[5]: Entering directory `/home/gurjeet/dev/pgdbuilds/quiet_make/src/backend'
make[5]: Leaving directory `/home/gurjeet/dev/pgdbuilds/quiet_make/src/backend'
make[4]: Leaving directory `/home/gurjeet/dev/pgdbuilds/quiet_make/src/port'
make -C ../../../src/common all
make[4]: Entering directory `/home/gurjeet/dev/pgdbuilds/quiet_make/src/common'
make -C ../backend submake-errcodes
make[5]: Entering directory `/home/gurjeet/dev/pgdbuilds/quiet_make/src/backend'
make[5]: Leaving directory `/home/gurjeet/dev/pgdbuilds/quiet_make/src/backend'
make[4]: Leaving directory `/home/gurjeet/dev/pgdbuilds/quiet_make/src/common'
make[3]: Leaving directory `/home/gurjeet/dev/pgdbuilds/quiet_make/src/bin/initdb'
make[2]: Leaving directory `/home/gurjeet/dev/pgdbuilds/quiet_make/src/bin'
make -C pl all
make[2]: Entering directory `/home/gurjeet/dev/pgdbuilds/quiet_make/src/pl'
...

The noise can be further reduced by adding the --no-print-directory switch, which yeilds the following output:

...
make -C ../backend submake-errcodes
make -C psql all
make -C ../../../src/interfaces/libpq all
make -C ../../../src/port all
make -C ../backend submake-errcodes
make -C ../../../src/common all
make -C ../backend submake-errcodes
make -C scripts all
make -C ../../../src/interfaces/libpq all
make -C ../../../src/port all
...

The only downside I see to this patch is that it emits this warning in the beginning:

GNUmakefile:14: warning: overriding commands for target `all'
src/Makefile.global:29: warning: ignoring old commands for target `all'

This is from the recipe that emits the message "All of PostgreSQL successfully made. Ready to install."

For really quiet builds one can use the -s switch, but for someone who wishes to see some kind of progress and also want a cleaner terminal output, the --no-print-directory switch alone is not enough.

Best regards,
Attachment

Re: Cleaner build output when not much has changed

From
Tom Lane
Date:
Gurjeet Singh <gurjeet@singh.im> writes:
> I was looking for ways to reduce the noise in Postgres make output,
> specifically, I wanted to eliminate the "Nothing to be done for `all' "
> messages, since they don't add much value, and just ad to the clutter.

Why don't you just use "make -s" if you don't want to see that?
The example output you show is not much less verbose than before.

I'm pretty suspicious of cute changes like this to the makefiles.
They too often have unexpected side-effects.  (I'm still pissed off
about having to manually remove objfiles.txt to get it to rebuild a .o
file, for instance.)
        regards, tom lane



Re: Cleaner build output when not much has changed

From
Gurjeet Singh
Date:
On Tue, Nov 26, 2013 at 12:37 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Gurjeet Singh <gurjeet@singh.im> writes:
> I was looking for ways to reduce the noise in Postgres make output,
> specifically, I wanted to eliminate the "Nothing to be done for `all' "
> messages, since they don't add much value, and just ad to the clutter.

Why don't you just use "make -s" if you don't want to see that?
The example output you show is not much less verbose than before.

I have a shell function that now adds --no-print-directory to my make command. This patch combined with that switch makes the output really clean (at least from my perspective). Since the use of a command-line switch can be easily left to personal choice, I am not proposing to add that or its makefile-equivalent. But modifying the makefiles to suppress noise is not that everyone can be expected to do, and do it right.


I'm pretty suspicious of cute changes like this to the makefiles.
They too often have unexpected side-effects.  (I'm still pissed off
about having to manually remove objfiles.txt to get it to rebuild a .o
file, for instance.)

You mean the --enable-depend switch to ./configure is not sufficient to force a rebuild on changed source code! With this switch, I have always seen my builds do the right thing, whether I modify a .c file or a .h. I personally have never been forced to remove objfiles.txt to solve a build/make issue. (I primarily use VPATH builds, BTW).

Best regards,

Re: Cleaner build output when not much has changed

From
Alvaro Herrera
Date:
Tom Lane wrote:

> I'm pretty suspicious of cute changes like this to the makefiles.
> They too often have unexpected side-effects.  (I'm still pissed off
> about having to manually remove objfiles.txt to get it to rebuild a .o
> file, for instance.)

Yeah, I've been bitten by that as well and I don't like it either.

A patch to use non-recursive make to construct the backend would be very
much appreciated.  We've talked about it at least two times, but no one
seems interested enough to put in the effort.

FWIW I'm also annoyed by the current make noise, but I don't support the
proposed patch.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



Re: Cleaner build output when not much has changed

From
Peter Eisentraut
Date:
On 11/26/13, 1:36 PM, Alvaro Herrera wrote:
> A patch to use non-recursive make to construct the backend would be very
> much appreciated.  We've talked about it at least two times, but no one
> seems interested enough to put in the effort.

References?



Re: Cleaner build output when not much has changed

From
Alvaro Herrera
Date:
Peter Eisentraut wrote:
> On 11/26/13, 1:36 PM, Alvaro Herrera wrote:
> > A patch to use non-recursive make to construct the backend would be very
> > much appreciated.  We've talked about it at least two times, but no one
> > seems interested enough to put in the effort.
> 
> References?

What, you want me to dig up your own old threads?  Hopefully the search
is pretty awesome:

http://www.postgresql.org/message-id/Pine.LNX.4.21.0007021307110.351-100000@localhost.localdomain
http://www.postgresql.org/message-id/1299621866.19938.5.camel@vanquo.pezone.net

:-)

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



Re: Cleaner build output when not much has changed

From
Alvaro Herrera
Date:
Gurjeet Singh wrote:
> On Tue, Nov 26, 2013 at 12:37 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> > Gurjeet Singh <gurjeet@singh.im> writes:
> > > I was looking for ways to reduce the noise in Postgres make output,
> > > specifically, I wanted to eliminate the "Nothing to be done for `all' "
> > > messages, since they don't add much value, and just ad to the clutter.
> >
> > Why don't you just use "make -s" if you don't want to see that?
> > The example output you show is not much less verbose than before.
> 
> I have a shell function that now adds --no-print-directory to my make
> command. This patch combined with that switch makes the output really clean
> (at least from my perspective). Since the use of a command-line switch can
> be easily left to personal choice, I am not proposing to add that or its
> makefile-equivalent. But modifying the makefiles to suppress noise is not
> that everyone can be expected to do, and do it right.

FWIW you can add a src/Makefile.custom file with this:

all:@true

and it will get rid of most noise.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



Re: Cleaner build output when not much has changed

From
Gurjeet Singh
Date:
On Mon, Mar 10, 2014 at 8:12 PM, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
Gurjeet Singh wrote:
> On Tue, Nov 26, 2013 at 12:37 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> > Gurjeet Singh <gurjeet@singh.im> writes:
> > > I was looking for ways to reduce the noise in Postgres make output,
> > > specifically, I wanted to eliminate the "Nothing to be done for `all' "
> > > messages, since they don't add much value, and just ad to the clutter.
> >
> > Why don't you just use "make -s" if you don't want to see that?
> > The example output you show is not much less verbose than before.
>
> I have a shell function that now adds --no-print-directory to my make
> command. This patch combined with that switch makes the output really clean
> (at least from my perspective). Since the use of a command-line switch can
> be easily left to personal choice, I am not proposing to add that or its
> makefile-equivalent. But modifying the makefiles to suppress noise is not
> that everyone can be expected to do, and do it right.

FWIW you can add a src/Makefile.custom file with this:

all:
        @true

and it will get rid of most noise.

As I noted in the first email in this chain, this causes a warning:

GNUmakefile:14: warning: overriding commands for target `all'
/home/gurjeet/dev/POSTGRES/src/Makefile.custom:2: warning: ignoring old commands for target `all'

I have since settled for `make -s`. On slow builds it keeps me guessing for a long time, without any indication of progress, but I've learned to live with that.

Best regards,