Quoting Stephan Beal <[email protected]>:
On Mon, Aug 17, 2009 at 7:39 PM, John Calcote <[email protected]>wrote:
Also, you might want to swap out "@make" in your makefile for "$(MAKE)",
like this:

api:
       $(MAKE) -C DIR1 $(MAKEFLAGS) api

i was under the impression (incorrectly?) that one of the advantages of
using $(MAKE) was to pass on flags. i.e. does $(MAKEFLAGS) not implicitly
get passed on via $(MAKE)?

You should never use "make" when invoking a recursive make (I suppose there might be legitimate reasons to do so but they are very rare). You should always and only use the variable $(MAKE).

You should definitely never use $(MAKEFLAGS) in a recipe like this. $(MAKEFLAGS) is designed to be passed to sub-makes _through the environment_, NOT via the command line.

Using $(MAKEFLAGS) on the command line WILL break if you invoke make with the proper sorts of command line arguments (in particular variable assignments that contain whitespace and other shell metacharacters).

Just write:

api:
        $(MAKE) -C DIR1 api

Cheers!



_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to