[Scons-users] Prefixing a command without messing up dependencies
Chris BeHanna
chris at behanna.org
Tue Jul 17 14:17:12 EDT 2012
On Jul 17, 2012, at 12:57 , Greg Ward wrote:
> Hi all --
>
> our build normally runs a lot of
>
> javac ... <sources>
>
> commands, and SCons correctly determines that the targets depend on
> javac as well as <sources>. However, javac emits lots of stupid
> warnings that are impossible to disable. I wrote a script to handle
> this, but it doesn't work like this:
>
> javac ... <sources> 2>&1 | filterJavac
>
> because I want to keep stdout and stderr distinct. So instead it works
> like this:
>
> filterJavac [options] -- javac ... <sources>
>
> where filterJavac runs javac as a subprocess and filters its stdout
> and stderr intelligently. Works great... except that now SCons thinks
> my compiler output depends on filterJavac, not on javac. I'd like to
> be able to toggle use of filterJavac with a command-line option, but
> that triggers lots of unnecessary rebuilds: "javac is no longer a
> dependency" and "filterJavac is a new dependency". Argh.
>
> Suggestions? I think I could easily make those targets all depend on
> javac, but there's still the problem of an unwanted dependency on
> filterJavac. Is there a way to overrule the usual "depend on argv[0]"
> trick?
Maybe make your command string something like
$( $FILTERJAVAC $) javac ... <sources>
where you set env['FILTERJAVAC'] to 'filterJavac [options] --' when you toggle it on, and leave it empty otherwise?
The $( and $) are supposed to prevent what lies between them from being used for hashing the command string.
--
Chris BeHanna
chris at behanna.org
More information about the Scons-users
mailing list