I have a Makefile that traverses a list of directories, which works fine, however i want to not get the Entering/Leaving info message like below:
make[1]: Leaving directory `/home/zzz/aaa/bbb/ccc'
The bit of code that does the traversal (where ccc is one of the dirs in the SUBDIRS list and Makefile is in the bbb dir) is here:
@for i in $(SUBDIRS); do \
(cd $$i; make $@); \
done
I am guessing something needs doing with the (cd $$i; make $@) part, but cannot figure out what.
Thanks
GNU make decides whether to print this information according to the MAKELEVEL: if it is set and > 0 then it prints the info. You can unset or fake a zero MAKELEVEL, so GNU make thinks it is the initial invokation.
@for i in $(SUBDIRS); do \
(cd $$i; unset MAKELEVEL; make $@); \
done
should do the trick.
On the other hand, Recursive make considered harmful (google it). If you can, avoid it.
EDIT: As bobbogo points out, there is a GNU make option --no-print-directory; this is much better than my hack above.
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