I'm trying to write a Rakefile that both builds my code normally when I run rake compile
but puts the targets in a different directory and builds with -DTEST
when I run rake test
. I cannot for the life of me figure out how to do it, though. I've got something like this at the moment:
SRC = FileList['src/*.erl']
OBJ = SRC.pathmap("%{src,ebin}/X.beam")
rule ".beam" => ["%{ebin,src}X.erl"] do |t|
sh "erlc ... -o ebin #{t.source}"
end
task :compile => OBJ
What I'd like is a task :test
that put the compiler output into ebin_test
(basically changed all instances of ebin
into ebin_test
in the above code) and added a -DTEST to the sh
call. Anyone got any ideas?