help-make
[Top][All Lists]
Advanced

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

RE: how make concludes that target is out of date


From: sharan basappa
Subject: RE: how make concludes that target is out of date
Date: Fri, 01 Jun 2007 12:42:41 +0000

Thanks a lot Dave, but I have some questions based on your answers ..

You mention that target is always a file, but there are situations where I might
use make to simply execute shell commands. In such situations I might have
many low level rules that basically execute shell commands and I might
build more abstract rules using these low level rules. In such cases, the leaf rules might not have prereqs, but rest of the rules will have target and prereqs and
none of them might be actual files ..



From: "Dave Korn" <address@hidden>
To: "'sharan basappa'" <address@hidden>,<address@hidden>
Subject: RE: how make concludes that target is out of date
Date: Fri, 1 Jun 2007 12:38:10 +0100

On 01 June 2007 12:22, sharan basappa wrote:

> I have following make rules in my file
>
> one : a.c
>         echo "hello"
>
> two : c.c
>         echo "hello"
>
>
> a.c exists and c.c does not exist ..
>
> My question is
>
> a) How make takes up a rule and decides that target is
> out of date and hence command needs to be executed.

If the target does not exist or is older than any prereq it needs rebuilding
and the associated commands are executed.

> b) If the target is not a file

The target is always a file. Your makefile above describes how to produce two output files, called 'one' and 'two', from two input files, a.c and c.c. The fact that your commands do not actually create files named 'one' or 'two'
is incidental.

> but prereq is and this preq file exists then
> what happens.
> Rule one above a.c exists but make exits with message make: `one' is up to
> date.

You must have a file called 'one' in the directory where you are working, I
get the hello.

> c) If target exists but prereq does not. If you refer to second rule above
> then
> make does not execute the command echo "hello" and exits with message
> make: *** No rule to make target `c.c', needed by `two'.  Stop.

Yep, you have told it that 'two' is a file made depending on 'c.c', so it
assumes that if there is no 'c.c', and it also cannot find a rule in the
makefile to create 'c.c', then your commands for creating 'two' will fail
because they do not have 'c.c', so it prints an error.

> I would be glad if someone could point me to right documentation to
> understand better

  "info make", or "man make" depending on which format you prefer.


    cheers,
      DaveK
--
Can't think of a witty .sigline today....


_________________________________________________________________
Spice up your IM conversations. New, colorful and animated emoticons. Get chatting! http://server1.msn.co.in/SP05/emoticons/





reply via email to

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