PageRenderTime 13ms CodeModel.GetById 10ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.9.2/doc/example/Rakefile2

http://github.com/agross/netopenspace
#! | 35 lines | 27 code | 8 blank | 0 comment | 0 complexity | 93d02bece2c5357198e051e8ce4d96c0 MD5 | raw file
 1# Example Rakefile -*- ruby -*-
 2# Using the power of Ruby
 3
 4task :default => [:main]
 5
 6def ext(fn, newext)
 7  fn.sub(/\.[^.]+$/, newext)
 8end
 9
10SRCFILES = Dir['*.c']
11OBJFILES = SRCFILES.collect { |fn| ext(fn,".o") }
12
13OBJFILES.each do |objfile|
14  srcfile = ext(objfile, ".c")
15  file objfile => [srcfile] do |t|
16    sh "gcc #{srcfile} -c -o #{t.name}"
17  end
18end
19
20file "main" => OBJFILES do |t|
21  sh "gcc -o #{t.name} main.o a.o b.o"
22end
23
24task :clean do
25  rm_f FileList['*.o']
26  Dir['*~'].each { |fn| rm_f fn }
27end
28
29task :clobber => [:clean] do
30  rm_f "main"
31end
32
33task :run => ["main"] do
34  sh "./main"
35end