help-make
[Top][All Lists]
Advanced

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

Re: Is there some option to make all targets phony?


From: Paul Smith
Subject: Re: Is there some option to make all targets phony?
Date: Mon, 17 Aug 2009 23:53:06 -0600
User-agent: Internet Messaging Program (IMP) H3 (4.1.6)

Quoting Stephan Beal <address@hidden>:
On Mon, Aug 17, 2009 at 7:39 PM, John Calcote <address@hidden>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!





reply via email to

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