Rakefile: provide default_targets target even if default target is overriden

This commit is contained in:
Moritz Bunkus 2024-10-25 15:00:07 +02:00
parent 70cfb3c012
commit 5ff981a942
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85

View File

@ -264,15 +264,6 @@ def generate_helper_files
end
def define_default_task
if !c(:DEFAULT_TARGET).empty?
desc "Build target '#{c(:DEFAULT_TARGET)}' by default"
task :default => c(:DEFAULT_TARGET)
return
end
desc "Build everything"
# The applications themselves
targets = $applications.clone
targets += $tools.map { |name| "src/tools/#{$application_subdirs[name]}#{name}" + c(:EXEEXT) }
@ -309,12 +300,21 @@ def define_default_task
targets += $benchmark_programs
task :default => targets do
task :default_targets => targets
if !c(:DEFAULT_TARGET).empty?
desc "Build target '#{c(:DEFAULT_TARGET)}' by default"
task :default => c(:DEFAULT_TARGET)
else
desc "Build everything"
task :default => :default_targets do
build_duration = Time.now - $build_start
build_duration = sprintf("%02d:%02d.%03d", (build_duration / 60).to_i, build_duration.to_i % 60, (build_duration * 1000).to_i % 1000)
puts "Done after #{build_duration}. Enjoy :)"
end
end
return if %r{drake(?:\.exe)?$}i.match($PROGRAM_NAME)
return if !Rake.application.top_level_tasks.empty? && (Rake.application.top_level_tasks != ["default"])