On Tue, Feb 20, 2024 at 12:37:25AM +0100, Alejandro Colomar wrote:
> Do you know if there's a way to achieve something like this thing
> without breaking -Orecurse?

Hmm, I got it.  A variable, of course!

$ cat Makefile 
.PHONY: all f b foo bar
all: f b;

f:
        $(info  MAKE    foo)
        @$(MAKE) foo "RECURSIVE_MAKE_INFO=MAKE  foo:    "
b:
        $(info  MAKE    bar)
        @$(MAKE) bar "RECURSIVE_MAKE_INFO=MAKE  bar:    "

foo:
        $(info  $(RECURSIVE_MAKE_INFO)CC        foo)
        @sleep 1
        @echo errors from foo >&2
bar:
        $(info  $(RECURSIVE_MAKE_INFO)CC        bar)
        @echo errors from bar >&2


alx@debian:~/tmp$ make -j24 --no-print-directory 
MAKE    foo
MAKE    bar
MAKE    foo:    CC      foo
MAKE    bar:    CC      bar
errors from bar
errors from foo
alx@debian:~/tmp$ make -j24 --no-print-directory -Orecurse
MAKE    bar
MAKE    bar:    CC      bar
errors from bar
MAKE    foo
MAKE    foo:    CC      foo
errors from foo

Have a lovely day!
Alex


-- 
<https://www.alejandro-colomar.es/>
Looking for a remote C programming job at the moment.

Attachment: signature.asc
Description: PGP signature

Reply via email to