help-make
[Top][All Lists]
Advanced

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

Re: a question about why implicit rule must use the path found by direct


From: Paul Smith
Subject: Re: a question about why implicit rule must use the path found by directory search!!
Date: Mon, 27 Sep 2010 08:34:15 -0400

On Mon, 2010-09-27 at 10:06 +0330, ali hagigat wrote:
> /root> touch di4/preq1.u
> ---------------------------------
> vpath preq1.u di4
> all6: preq1.u
>       @echo "kkkkk"
> %.u: preq2
>       @echo "hhhhh"
>       @touch $@
> preq2:
>       @echo "llllll"
> ---------------------------------
> The manual says:
> 4.4.5 Directory Search and Implicit Rules
> The recipes of implicit rules normally use automatic variables as a
> matter of necessity;
> consequently they will use the file names found by directory search
> with no extra effort.
> ----------------------------------
> In the example I wrote, why 'di4/preq1.u' is not touched by '@touch $@'?
> Why the pathname found by directory search means 'di4/preq1.u' was not
> used by the automatic variable of our implicit rule($@)?

This is because of rule 4b in the search algorithm, summarized there as:

        In short, if `make' must rebuild, then the target is rebuilt
        locally, not in the directory found via directory search.

Since preq1.u is being rebuilt, it's built using the path in the
makefile (preq1.u) not the path found via directory search.  So, $@ (the
name of the target to build) is preq1.u, not di4/preq1.u.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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