mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-25 04:11:44 +00:00
Move temporary dependency files to a temporary directory
This commit is contained in:
parent
3c2f1aec07
commit
e1a499f3a2
2
.gitignore
vendored
2
.gitignore
vendored
@ -34,7 +34,7 @@
|
||||
/doc/man/po4a/po/mkvtoolnix.pot
|
||||
/po/*.mo
|
||||
/po/mkvtoolnix.pot
|
||||
/rake.d/dependecy.d
|
||||
/rake.d/dependency.d
|
||||
/src/common/common.h.gch
|
||||
/src/common/common_pch.h.gch
|
||||
/src/info/*.moc.cpp
|
||||
|
15
Rakefile
15
Rakefile
@ -56,7 +56,8 @@ def setup_globals
|
||||
$all_objects = $all_sources.collect { |file| file.ext('o') }
|
||||
|
||||
$top_srcdir = c(:top_srcdir)
|
||||
$dependency_dir = "#{$top_srcdir}/rake.d/dependecy.d"
|
||||
$dependency_dir = "#{$top_srcdir}/rake.d/dependency.d"
|
||||
$dependency_tmp_dir = "#{$dependency_dir}/tmp"
|
||||
|
||||
$languages = {
|
||||
:applications => c(:TRANSLATIONS).split(/\s+/),
|
||||
@ -144,11 +145,14 @@ end
|
||||
|
||||
# Store compiler block for re-use
|
||||
cxx_compiler = lambda do |t|
|
||||
create_dependency_dirs
|
||||
|
||||
# t.sources is empty for a 'file' task (common_pch.h.o).
|
||||
sources = t.sources.empty? ? [ t.prerequisites.first ] : t.sources
|
||||
dep = dependency_output_name_for t.name
|
||||
|
||||
runq " CXX #{sources.first}", "#{c(:CXX)} #{$flags[:cxxflags]} #{$system_includes} -c -MMD -o #{t.name} #{sources.join(" ")}", :allow_failure => true
|
||||
handle_deps t.name, last_exit_code, skip_abspath=true
|
||||
runq " CXX #{sources.first}", "#{c(:CXX)} #{$flags[:cxxflags]} #{$system_includes} -c -MMD -MF #{dep} -o #{t.name} #{sources.join(" ")}", :allow_failure => true
|
||||
handle_deps t.name, last_exit_code, true
|
||||
end
|
||||
|
||||
# Precompiled headers
|
||||
@ -161,7 +165,10 @@ end
|
||||
rule '.o' => '.cpp', &cxx_compiler
|
||||
|
||||
rule '.o' => '.c' do |t|
|
||||
runq " CC #{t.source}", "#{c(:CC)} #{$flags[:cflags]} #{$system_includes} -c -MMD -o #{t.name} #{t.sources.join(" ")}", :allow_failure => true
|
||||
create_dependency_dirs
|
||||
dep = dependency_output_name_for t.name
|
||||
|
||||
runq " CC #{t.source}", "#{c(:CC)} #{$flags[:cflags]} #{$system_includes} -c -MMD -MF #{dep} -o #{t.name} #{t.sources.join(" ")}", :allow_failure => true
|
||||
handle_deps t.name, last_exit_code
|
||||
end
|
||||
|
||||
|
@ -69,8 +69,19 @@ def runq(msg, cmdline, options = {})
|
||||
run cmdline, options.clone.merge(:dont_echo => !verbose)
|
||||
end
|
||||
|
||||
def create_dependency_dirs
|
||||
[ $dependency_dir, $dependency_tmp_dir ].each do |dir|
|
||||
File.unlink(dir) if FileTest.exist?(dir) && !FileTest.directory?(dir)
|
||||
Dir.mkdir(dir) if !FileTest.exist?(dir)
|
||||
end
|
||||
end
|
||||
|
||||
def dependency_output_name_for file_name
|
||||
$dependency_tmp_dir + "/" + file_name.gsub(/\//, '_').ext('d')
|
||||
end
|
||||
|
||||
def handle_deps(target, exit_code, skip_abspath=false)
|
||||
dep_file = target.ext 'd'
|
||||
dep_file = dependency_output_name_for target
|
||||
get_out = lambda do
|
||||
File.unlink(dep_file) if FileTest.exist?(dep_file)
|
||||
exit exit_code if 0 != exit_code
|
||||
@ -79,10 +90,9 @@ def handle_deps(target, exit_code, skip_abspath=false)
|
||||
|
||||
FileTest.exist?(dep_file) || get_out.call
|
||||
|
||||
FileTest.exist?($dependency_dir) && !FileTest.directory?($dependency_dir) && File.unlink($dependency_dir)
|
||||
FileTest.exist?($dependency_dir) || Dir.mkdir($dependency_dir)
|
||||
create_dependency_dirs
|
||||
|
||||
File.open("#{$dependency_dir}/" + dep_file.gsub(/\//, '_').ext('rb'), "w") do |out|
|
||||
File.open("#{$dependency_dir}/" + target.gsub(/\//, '_').ext('rb'), "w") do |out|
|
||||
line = IO.readlines(dep_file).collect { |line| line.chomp }.join(" ").gsub(/\\/, ' ').gsub(/\s+/, ' ')
|
||||
if /(.+?):\s*([^\s].*)/.match(line)
|
||||
target = $1
|
||||
|
Loading…
Reference in New Issue
Block a user