On Fri, 2019-05-31 at 11:50 +1000, Robert Prije wrote:
> foo:
>       $$(make bar)
> 
> bar:
>       @echo "echo bar"
> 
> (tabs seem to have been lost. Please insert as necessary)
> 
> results in the following error:
> 
> $ make foo
> $(make bar)
> /bin/sh: make[1]:: command not found
> make: *** [Makefile:2: foo] Error 127
> 
> strace confirms that make really is trying to find a file named
> "make[1]" including the "[1]" suffix.

If you change the makefile to simply run the command and print the
output, instead of trying to execute it, you'll see the problem.

By default when make recurses it prints a note about this to stdout so
the user knows that a new makefile has been invoked:

  make bar
  make[1]: Entering directory '/tmp'
  echo bar
  make[1]: Leaving directory '/tmp'

If you want to avoid these messages, you need to use the
--no-print-directory option; write your makefile with:

  foo:
        $$($(MAKE) --no-print-directory bar)

  bar:
        @echo "echo bar"

(you should always use $(MAKE), never just make, when invoking make
recursively).


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to