[Scons-users] clarification on Depends()

Jason Kenny dragon512 at live.com
Tue Jun 5 20:47:36 EDT 2018


I think of this more as a make rule.

I want to say for whatever reason that if the fake.txt is out of date that mean hello.c is out of date.

So something like:

Fake.txt:

Hello.c:fake.txt

Hello.o:hello.c
              cc hello.c

Here in make land a change to fake.txt will spawn all rules that have fake.txt as a source.

From what I understand the Depend() is generally pointless as the execution logic only cares about implicit depends of the source via the scanner, and if the source has a builder. If it has a builder then we care about depends of the source node, as now it is technically a target in the other builder. I can get different behavior via one of three ways.


  1.  Make an empty do nothing builder to make a depends() as a source of the of the node
  2.  Change/add a different decider to say this node is up-to-date if and only if it and any depends are all up-to-date. Currently this only returns True if this node in question is up-to-date, not if anything it depends on is as well.
  3.  Change the executor to care about depends of a source even if it does not have a builder

Honestly there are special cases in which this is useful. Most of the time the scanner is the way to go.

Jason

From: Bill Deegan <bill at baddogconsulting.com>
Sent: Tuesday, June 5, 2018 7:25 PM
To: SCons users mailing list <scons-users at scons.org>
Cc: Jason Kenny <dragon512 at live.com>
Subject: Re: [Scons-users] clarification on Depends()



On Tue, Jun 5, 2018 at 3:27 PM, Marc Branchaud <marcnarc at xiplink.com<mailto:marcnarc at xiplink.com>> wrote:
On 2018-06-05 12:05 AM, Jason Kenny wrote:
HI,

I just want to clarify behavior of Depends() in SCons.

I have a small sample:

Depends(["hello.c")],["fake.txt"])

Program("hello","hello.c")

If I run this sample “hello” will build. If I change fake.txt, nothing will rebuild.

Right.  This is because you have nothing that builds hello.c, so SCons doesn't care that hello.c depends on anything.

But SCons does know how to build hello.o.  That knowledge is implicit in the Program builder.  So SCons respects
        Depends("hello.o", "fake.txt")

Put another way, SCons only performs actions to build hello.o (and, ultimately, hello), so it only cares about dependencies for the actions it undertakes.

You could also use the target returned by the Program builder:
        hello_target = Program("hello", "hello.c")
        Depends(hello_target, "fake.txt")
This achieves the same thing, and lets you avoid knowing the Program builder's intermediate artifacts.

It would rebuild hello, but not necessarily rebuild hello.o

So not exactly the same thing.

-Bill


                M.

I have a tree like this:

+-hello

   | +-hello.o

   | | +-hello.c

   | | +-fake.txt

   | | +-/usr/bin/gcc

   | +-/usr/bin/gcc

If I change the sample to this ( depends() is not hello.o vs hello.c)

Depends(["hello.c")],["fake.txt"])

Program("hello","hello.c")

Now when I change fake.txt hello.o will rebuild. The tree here looks like:

+-hello

   | +-hello.o

   | | +-hello.c

   | | +-fake.txt

   | | +-/usr/bin/gcc

   | +-/usr/bin/gcc

Is this right… I have to know the target of a builder to use? I cannot use the source of a builder?

Jason



_______________________________________________
Scons-users mailing list
Scons-users at scons.org<mailto:Scons-users at scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7Ca25e1c3b08b94567e3c808d5cb43e88c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636638414874226947&sdata=9xTM%2Fogjcekowt8cySadqFPfrk7mKGWBLzEwON2hL0U%3D&reserved=0>
_______________________________________________
Scons-users mailing list
Scons-users at scons.org<mailto:Scons-users at scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7Ca25e1c3b08b94567e3c808d5cb43e88c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636638414874226947&sdata=9xTM%2Fogjcekowt8cySadqFPfrk7mKGWBLzEwON2hL0U%3D&reserved=0>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180606/191d4f15/attachment-0001.html>


More information about the Scons-users mailing list