bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nested calls of make in secondary expansions cause "command not foun


From: Paul Smith
Subject: Re: Nested calls of make in secondary expansions cause "command not found"
Date: Fri, 31 May 2019 08:51:48 -0400
User-agent: Evolution 3.32.1-2

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).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]