git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@216 bf332499-1b4d-0410-844d-d2d48d5cc64c

This commit is contained in:
mvandervoord
2012-01-24 23:09:25 +00:00
parent 5f1521a8af
commit 1538407030
2 changed files with 17 additions and 23 deletions
+10 -14
View File
@@ -92,10 +92,11 @@ module RakefileHelpers
def compile(file, defines=[])
compiler = build_compiler_fields
cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " +
"#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" +
"#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}"
execute(cmd_str)
cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " +
"#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}"
obj_file = "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}"
execute(cmd_str + obj_file)
return obj_file
end
def build_linker_fields
@@ -199,8 +200,7 @@ module RakefileHelpers
#compile source file header if it exists
src_file = find_source_file(header, include_dirs)
if !src_file.nil?
compile(src_file, test_defines)
obj_list << header.ext($cfg['compiler']['object_files']['extension'])
obj_list << compile(src_file, test_defines)
end
end
@@ -215,12 +215,10 @@ module RakefileHelpers
runner_path = $cfg['compiler']['runner_path'] + runner_name
end
compile(runner_path, test_defines)
obj_list << runner_name.ext($cfg['compiler']['object_files']['extension'])
obj_list << compile(runner_path, test_defines)
# Build the test module
compile(test, test_defines)
obj_list << test_base.ext($cfg['compiler']['object_files']['extension'])
obj_list << compile(test, test_defines)
# Link the test executable
link_it(test_base, obj_list)
@@ -257,15 +255,13 @@ module RakefileHelpers
extract_headers(main_path).each do |header|
src_file = find_source_file(header, include_dirs)
if !src_file.nil?
compile(src_file)
obj_list << header.ext($cfg['compiler']['object_files']['extension'])
obj_list << compile(src_file)
end
end
# Build the main source file
main_base = File.basename(main_path, C_EXTENSION)
compile(main_path)
obj_list << main_base.ext($cfg['compiler']['object_files']['extension'])
obj_list << compile(main_path)
# Create the executable
link_it(main_base, obj_list)
+7 -9
View File
@@ -85,9 +85,10 @@ module RakefileHelpers
def compile(file, defines=[])
compiler = build_compiler_fields
cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{defines.inject(''){|all, a| ' -D'+a+all }}#{compiler[:options]}#{compiler[:includes]} #{file} " +
"#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" +
"#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}"
execute(cmd_str)
"#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}"
obj_file = "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}"
execute(cmd_str + obj_file)
return obj_file
end
def build_linker_fields
@@ -203,8 +204,7 @@ module RakefileHelpers
# Compile corresponding source file if it exists
src_file = find_source_file(header, include_dirs)
if !src_file.nil?
compile(src_file)
obj_list << header.ext($cfg['compiler']['object_files']['extension'])
obj_list << compile(src_file)
end
end
@@ -212,12 +212,10 @@ module RakefileHelpers
runner_name = test_base + '_runner.c'
runner_path = $cfg['compiler']['source_path'] + runner_name
UnityTestRunnerGenerator.new(SYSTEST_GENERATED_FILES_PATH + cmock_config).run(test, runner_path)
compile(runner_path)
obj_list << runner_name.ext($cfg['compiler']['object_files']['extension'])
obj_list << compile(runner_path)
# Build the test module
compile(test)
obj_list << test_base.ext($cfg['compiler']['object_files']['extension'])
obj_list << compile(test)
# Link the test executable
link_it(test_base, obj_list)