src/Makefile: avoid verbosity checks inside targets #154
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL; DR: use a trick allowed by
GNU make
to avoid verbosity checks inside targets. Also, unify output according to logic ofrules.mk
fromChibiOS
: if verbosity then print full command only, if silent then print message only; but not both nor neither.I use projects with
make
for a few years myself but only recently I discovered this trick. Sometimes I use it myself when I need to switch on/off verbosity on the fly. I hope it will be useful here as well. But if it's too hacky to accept, then I will understand.Oh, and since there is
-f
flag forrm
, then ignoring possible errors (such asFile doesn't exist
) through-
prefix inside related call is not necessarily as far as I understand.Test builds (with and without
USE_VERBOSE_COMPILE=yes
) have been done successfully locally onUbuntu 18.04
withGNU Make 4.1
.One more thing. I'm aware that the original block:
comes from samples with
ChibiOS
. But since inrules.mk
there are checks forUSE_VERBOSE_COMPILE = yes ?
only anyway, I guess it will be more clear & less confusing to check for it here as well. But sorry in advance if I miss something here.Now I'm very curious to hear opinions about this refactoring. :)