Brad Phelan wrote:
> Hi Rakers,
>
> Am new here to the list. Am joining because of a special requirement. I
> have been hacking the Rake source code without too much success to get
> the following requirements to work.
>
>
It is always good to try and describe what you want to others. The
comment I made about scoping path names for FileTask gave me a few
ideas. I implemented the path as a named scope for FileTask and it seems
to work ok.
I've included a zip file with the directory. Unzip it and just do
rake
or
rake clean
and you will see the hierarchical build working. Also included is a half
attempt at construction environments which doesn't quite yet work. My
main rakefile is
require 'cscanner'
Rake::Task.env do |env|
env[:CCFLAGS] = "-DFOO=2"
file 'main.out' => [ 'main.o' ]
end
Rake::Task.env do |env|
env[:CCFLAGS] = "-DBAR=5"
file 'main2.out' => [ 'main2.o' ]
end
task :default => ['main.out', 'main2.out', 'sub/main3.out' ]
task :clean do
sh "rm *.o*"
sh "rm sub/*.o*"
end
rake 'sub/sub'
and the child rake file (sub/sub.rake) in the directory sub is
require 'cscanner'
Rake::Task.env do |env|
env[:CCFLAGS] = "-DBAR=1 "
env[:CCPATH] = ["."]
file 'main3.out'
end
The output from the build is
(in /home/phelan/ruby/rake)
cc -DFOO=2 main.c -c -o main.o
cc -o main.out main.o
cc -DBAR=5 main2.c -c -o main2.o
cc -o main2.out main2.o
cc -DBAR=1 -I. sub/main3.c -c -o sub/main3.o
cc -DBAR=1 -o sub/main3.out sub/main3.o
As you can see the CCFLAGS are not propagated to all rules. Not sure
why??????
The Rake::Task.env block just opens a new construction environment where you
can set build specific flags. It is an orthogonal concept to the
heirarchical build.
Regards
Brad
http://xtargets.com
_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel