help-make
[Top][All Lists]
Advanced

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

Re: VPATH and prerequisites


From: Joost Leeuwesteijn
Subject: Re: VPATH and prerequisites
Date: Sun, 30 Apr 2006 20:00:29 +0200
User-agent: Thunderbird 1.5.0.2 (Windows/20060308)

Paul D. Smith wrote:
%% Joost Leeuwesteijn <address@hidden> writes:

jl> You can check if make is run from the root directory by including a jl> first/default rule in the dir1 makefile that stops the build. Something jl> like:
  jl> ----------------------------------------
  jl> .PHONY : dir1_default_rule
  jl> dir1_default_rule :
  jl>       echo "ERROR: only run the toplevel makefile"
  jl>       <not sure what's the best way to bail out (exit 1?, $$(error ...)>

jl> and/or check on a variable that must be set by the toplevel makefile and jl> call $(error ...)
  jl> ----------------------------------------

You could instead check the MAKELEVEL variable to see whether this is
the top-level make, or a recursive invocation.

If you also want to rule out the single (sub)makefile "execution" you can't use MAKELEVEL, I believe. If you run 'make -f submakefile' the MAKELEVEL would still indicate toplevel make (right?), but I was trying to force execution of the toplevel makefile only. By bailing out in the default rule, or checking a variable that should be set by the toplevel makefile before including the submakefiles. If you execute the submakefile on it's own, I need to bail out because of variables that are supposed to be set from the toplevel makefile.

I was talking about the include situation, not recursion. My build environment doesn't use recursion; seems to be harmful ;-)

Regards,
Joost




reply via email to

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