[Omake] Order of evaluation

Jason Hickey jyh at cs.caltech.edu
Tue Jun 13 10:54:43 PDT 2006


Benjamin Pierce wrote:
> OK, here's today's question... :-)
> 
> One of the generated modules in the Harmony build can be constructed  in 
> either of two ways:
>    - When we're building a binary that's going to be installed  
> elsewhere in the filesystem,
>      this module gets built from a whole bunch of other files in a  
> complicated way.
>    - When we're building a binary that's going to be used "in  place" 
> (i.e., during testing),
>      we can get by with a stub version of this module that has no  
> dependencies.

This should be close to what you want.  The TARGETS variable defines the 
targets that were passed on the command line, so you can use that to 
decide what to do (documentation magically appeared on the web site:).

.PHONY: fast slow

if $(mem fast, $(TARGETS))
     slow:
        eprintln(fast is not slow)
        exit(1)
     foo.ml: foo.ml.fast
        cp $< $@
else
     fast:
        eprintln(slow is not fast)
        exit(1)
     foo.ml: slow.cmo
        echo "open Slow" > $@

fast slow .DEFAULT: foo.ml

Jason

-- 
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