提交 c22740f1 编写于 作者: G greg-williams

* Updated rakefile to work on Unix-based systems

git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@8 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
上级 6e2de5e5
......@@ -2,19 +2,30 @@
module RakefileConstants
C_EXTENSION = '.c'
OBJ_EXTENSION = '.obj'
BIN_EXTENSION = '.exe'
def Kernel.is_windows?
processor, platform, *rest = RUBY_PLATFORM.split("-")
platform == 'mswin32'
end
if Kernel.is_windows?
OBJ_EXTENSION = '.obj'
BIN_EXTENSION = '.exe'
else
OBJ_EXTENSION = '.o'
BIN_EXTENSION = '.out'
end
UNIT_TEST_PATH = 'test'
UNITY_PATH = '../src'
SOURCE_PATH = 'src'
BUILD_PATH = 'build'
UNITY_SRC = UNITY_PATH + '\unity.c'
UNITY_HDR = UNITY_PATH + '\unity.h'
UNITY_SRC = UNITY_PATH + '/unity.c'
UNITY_HDR = UNITY_PATH + '/unity.h'
COMPILER = 'gcc.exe'
LINKER = 'gcc.exe'
COMPILER = 'gcc'
LINKER = 'gcc'
end
......@@ -32,11 +43,11 @@ module RakefileHelpers
end
def compile src, obj
execute "#{COMPILER} -c -I#{SOURCE_PATH} -I#{UNITY_PATH} -DTEST #{src} -o#{obj}"
execute "#{COMPILER} -c -I#{SOURCE_PATH} -I#{UNITY_PATH} -DTEST #{src} -o #{obj}"
end
def link prerequisites, executable
execute "#{LINKER} -DTEST #{prerequisites.join(' ')} -o#{executable}"
execute "#{LINKER} -DTEST #{prerequisites.join(' ')} -o #{executable}"
end
def run_test executable
......
......@@ -2,27 +2,38 @@
module RakefileConstants
C_EXTENSION = '.c'
OBJ_EXTENSION = '.obj'
BIN_EXTENSION = '.exe'
def Kernel.is_windows?
processor, platform, *rest = RUBY_PLATFORM.split("-")
platform == 'mswin32'
end
if Kernel.is_windows?
OBJ_EXTENSION = '.obj'
BIN_EXTENSION = '.exe'
else
OBJ_EXTENSION = '.o'
BIN_EXTENSION = '.out'
end
UNIT_TEST_PATH = 'test'
UNITY_PATH = 'src'
SOURCE_PATH = 'src'
BUILD_PATH = 'build'
UNITY_SRC = UNITY_PATH + '\unity.c'
UNITY_HDR = UNITY_PATH + '\unity.h'
UNITY_SRC = UNITY_PATH + '/unity.c'
UNITY_HDR = UNITY_PATH + '/unity.h'
BIN_PATH = 'build'
UNITY_TEST_SRC = UNIT_TEST_PATH + '\testunity.c'
UNITY_TEST_RUNNER_SRC = UNIT_TEST_PATH + '\testunity_Runner.c'
UNITY_OBJ = BIN_PATH + '\unity' + OBJ_EXTENSION
UNITY_TEST_OBJ = BIN_PATH + '\testunity' + OBJ_EXTENSION
UNITY_TEST_RUNNER_OBJ = BIN_PATH + '\testunity_Runner' + OBJ_EXTENSION
UNITY_TEST_SRC = UNIT_TEST_PATH + '/testunity.c'
UNITY_TEST_RUNNER_SRC = UNIT_TEST_PATH + '/testunity_Runner.c'
UNITY_OBJ = BIN_PATH + '/unity' + OBJ_EXTENSION
UNITY_TEST_OBJ = BIN_PATH + '/testunity' + OBJ_EXTENSION
UNITY_TEST_RUNNER_OBJ = BIN_PATH + '/testunity_Runner' + OBJ_EXTENSION
UNITY_TEST_EXEC = UNITY_TEST_OBJ.ext BIN_EXTENSION
TEST_RESULTS = UNITY_TEST_OBJ.ext '.testpass'
COMPILER = 'gcc.exe'
LINKER = 'gcc.exe'
COMPILER = 'gcc'
LINKER = 'gcc'
end
......@@ -40,11 +51,11 @@ module RakefileHelpers
end
def compile src, obj
execute "#{COMPILER} -c -I#{SOURCE_PATH} -I#{UNITY_PATH} -DTEST #{src} -o#{obj}"
execute "#{COMPILER} -c -I#{SOURCE_PATH} -I#{UNITY_PATH} -DTEST #{src} -o #{obj}"
end
def link prerequisites, executable
execute "#{LINKER} -DTEST #{prerequisites.join(' ')} -o#{executable}"
execute "#{LINKER} -DTEST #{prerequisites.join(' ')} -o #{executable}"
end
def run_test executable
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册