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,
-- 
Gurjeet Singh http://gurjeet.singh.im/

EDB www.EnterpriseDB.com <http://www.enterprisedb.com>
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 8bfb77d..d0928d5 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -26,6 +26,7 @@ standard_always_targets = distprep clean distclean maintainer-clean
 
 # make `all' the default target
 all:
+	@true
 
 # Delete target files if the command fails after it has
 # started to update the file.
diff --git a/src/backend/Makefile b/src/backend/Makefile
index 318cdbc..cbc6d55 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -124,6 +124,7 @@ submake-schemapg:
 
 # src/port needs a convenient way to force errcodes.h to get built
 submake-errcodes: $(top_builddir)/src/include/utils/errcodes.h
+	@true
 
 .PHONY: submake-schemapg submake-errcodes
 
diff --git a/src/backend/catalog/Makefile b/src/backend/catalog/Makefile
index c4d3f3c..ee8fbcc 100644
--- a/src/backend/catalog/Makefile
+++ b/src/backend/catalog/Makefile
@@ -55,7 +55,9 @@ postgres.description: postgres.bki ;
 
 postgres.shdescription: postgres.bki ;
 
+.PHONY: schemapg.h
 schemapg.h: postgres.bki ;
+	@true
 
 # Technically, this should depend on Makefile.global, but then
 # postgres.bki would need to be rebuilt after every configure run,
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to