[Scons-users] Ignore and Requires

Gary Oberbrunner garyo at oberbrunner.com
Wed Oct 15 20:44:36 EDT 2014


Actually, I think it might work, if I understand what you're doing.
The revision.cpp file starts as a dependency of the target.  Ignore()
removes that dependency.  Requires() re-adds it, but in the special
Requires way, so the file has to exist but changes to it don't trigger
a rebuild.  I'm not positive about this, haven't tried it myself.

Arvid, the ugly workaround you mention is the accepted method for
this, because it prevents the revision.cpp file from being in the
dependency tree in the first place.  But your idea to use Ignore is
clever; if it does actually work, let's put a testcase into SCons so
we can make sure it keeps working.

-- Gary

On Wed, Oct 15, 2014 at 8:31 PM, William Blevins <wblevins001 at gmail.com> wrote:
> Arvid,
>
> I'm not sure you can achieve this the way you desire.  Your approach
> fundamentally contradicts the results.  Using Requires makes the generated
> CPP-file an explicit dependency.  You are manually injecting the new
> CPP-file into the dependency graph.  Since the file new has a different
> name, methods like checking the md5sum cannot detect the lack of changes;
> thus, the library will always be linked.
>
> Is this a situation where you can use a soft-link to trick SCons into
> keeping a consistent file name?
>
> V/R,
> William
>
> On Wed, Oct 15, 2014 at 5:38 PM, Arvid Rosén <arvid at softube.com> wrote:
>>
>> Hi!
>>
>> I generate a .cpp file with a revision number. It is compiled and linked
>> with a lot of other object files. However, I don’t want to re-link if only
>> the revision number has changed.
>>
>> I thought order-only dependencies using ”Requires” function would solve
>> this, but if I state that the final binary ”Requires” the revision-object,
>> the binary is still always re-linked. I guess this is because the revision
>> object file is in the source list of the link command, so it gets added as
>> an implicit dependency. There is a ugly workaround (passing the revision
>> object as a link flag) in the user guide:
>> http://www.scons.org/doc/2.3.1/HTML/scons-user.html#idp2498640
>>
>> But, can I achieve the same thing by using the Ignore function followed by
>> Requires? It seems to work, but I don’t know if I am guarantied that the
>> files are built in the right order.
>>
>> Cheers,
>> Arvid
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>



-- 
Gary


More information about the Scons-users mailing list