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,