observe the difference between make silent and make noisy. I asked make to be silent on the bar rule, but it is only silent on the foo rule, too.
What am I missing?
noisy:
@make foo
silent:
@make -s foo
foo:
@make -s bar
bar:
@echo bar
running it:
$ make silent
bar
$ make noisy
make[1]: Entering directory `/tmp/s'
make[2]: Entering directory `/tmp/s'
bar
make[2]: Leaving directory `/tmp/s'
make[1]: Leaving directory `/tmp/s'
I expected the noisy foo -> bar call to not print "Entering directory"
Options are passed from a parent make to a sub-make using the MAKEFLAGS environment variable, to which the sub-make adds the command-line flags it received. If a sub-make doesn't receive -s (--silent), -w (--print-directory), or --no-print-directory, it automatically adds -w to its own MAKEFLAGS. The order of precedence for enabling and disabling directory printing seems to be (from weakest to strongest) -s, -w, --no-print-directory.
So, when you run make silent, the first recursive call adds -s to MAKEFLAGS, and the second call knows not to touch the flags. However, when you run make noisy, the first recursive call adds -w to MAKEFLAGS since you didn't tell it not to be silent, and from then on, -s won't have the effect you're looking for. You can use --no-print-directory instead, since it overrides -w.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With