[Omake] Deciding when a file has changed
Jason Hickey
jyh at cs.caltech.edu
Wed Apr 25 14:01:25 PDT 2007
Hi Jared,
Is it possible to extract the name of the program from the script?
That way, you could add it as a scanner dependency, and things would
work correctly. Here is an example, where I'm generating a file
called "foo" by executing the "myscript" shell script.
# Figure out the actual dependencies for foo by scanning the script
.SCANNER: scan-foo: myscript
section
dep =
awk(myscript)
case $'# the name you are looking for is: \([A-Za-z0-9]+\)'
dep = $1
export
if $(dep)
println($"foo: $(dep)")
# Specify the custom scanner
foo: myscript :scanner: scan-foo
myscript
.DEFAULT: foo
In this case, I'm using the awk function to look for a string in the
script, but you can do anything you want, like running the script in
some mode that prints what it would do without actually executing
it. In the .SCANNER rule, you just need to print out a line
"<target>: <dependencies>" with the actual dependencies.
Jason
On Apr 25, 2007, at 11:42 AM, Jared C. Davis wrote:
> Hi,
>
> Is there a way to tell Omake to use a particular file's modified date,
> instead of its contents, to decide if it has changed?
>
> I have a shell script whose contents do not change, but the program it
> invokes has been updated. Normally I would just add a dependency on
> this program, but in this case I don't want to do that since, for
> stupid reasons beyond my control, the program's name is not the same
> across different platforms.
>
> Thanks,
> Jared
>
> --
> Jared C. Davis <jared at cs.utexas.edu>
> 3600 Greystone Drive #604
> Austin, TX 78731
> http://www.cs.utexas.edu/users/jared/
> _______________________________________________
> Omake mailing list
> Omake at metaprl.org
> https://lists.metaprl.org/mailman/listinfo/omake
--
Jason Hickey http://www.cs.caltech.edu/~jyh
Caltech Computer Science Tel: 626-395-6568 FAX: 626-792-4257
More information about the Omake
mailing list