summaryrefslogtreecommitdiffhomepage
path: root/Rakefile
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-01-26 22:19:00 +0900
committerGitHub <[email protected]>2019-01-26 22:19:00 +0900
commit2f62178ddacfe360c04c7715fd4cfaacddefff6b (patch)
treee6c815771b6b2369967b1b2176fc4cb95f868c02 /Rakefile
parent1e67c98c85fdd32276d858ef9089214398ca8f30 (diff)
parent107dc0c7789acfeeed8de8b9d1f78996e0838f99 (diff)
downloadmruby-2f62178ddacfe360c04c7715fd4cfaacddefff6b.tar.gz
mruby-2f62178ddacfe360c04c7715fd4cfaacddefff6b.zip
Merge pull request #4235 from shuujii/avoid-side-effect-when-run-rake
Avoid a side effect when run Rake without execution of tasks
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile17
1 files changed, 10 insertions, 7 deletions
diff --git a/Rakefile b/Rakefile
index 47da28166..6c160a5ed 100644
--- a/Rakefile
+++ b/Rakefile
@@ -32,20 +32,25 @@ load "#{MRUBY_ROOT}/tasks/benchmark.rake"
load "#{MRUBY_ROOT}/tasks/gitlab.rake"
+def install_D(src, dst)
+ opts = { :verbose => $verbose }
+ FileUtils.rm_f dst, opts
+ FileUtils.mkdir_p File.dirname(dst), opts
+ FileUtils.cp src, dst, opts
+end
+
##############################
# generic build targets, rules
task :default => :all
bin_path = ENV['INSTALL_DIR'] || "#{MRUBY_ROOT}/bin"
-FileUtils.mkdir_p bin_path, { :verbose => $verbose }
depfiles = MRuby.targets['host'].bins.map do |bin|
install_path = MRuby.targets['host'].exefile("#{bin_path}/#{bin}")
source_path = MRuby.targets['host'].exefile("#{MRuby.targets['host'].build_dir}/bin/#{bin}")
file install_path => source_path do |t|
- FileUtils.rm_f t.name, { :verbose => $verbose }
- FileUtils.cp t.prerequisites.first, t.name, { :verbose => $verbose }
+ install_D t.prerequisites.first, t.name
end
install_path
@@ -78,8 +83,7 @@ MRuby.each_target do |target|
install_path = MRuby.targets['host'].exefile("#{bin_path}/#{bin}")
file install_path => exec do |t|
- FileUtils.rm_f t.name, { :verbose => $verbose }
- FileUtils.cp t.prerequisites.first, t.name, { :verbose => $verbose }
+ install_D t.prerequisites.first, t.name
end
depfiles += [ install_path ]
elsif target == MRuby.targets['host-debug']
@@ -87,8 +91,7 @@ MRuby.each_target do |target|
install_path = MRuby.targets['host-debug'].exefile("#{bin_path}/#{bin}")
file install_path => exec do |t|
- FileUtils.rm_f t.name, { :verbose => $verbose }
- FileUtils.cp t.prerequisites.first, t.name, { :verbose => $verbose }
+ install_D t.prerequisites.first, t.name
end
depfiles += [ install_path ]
end