我在想編譯彙編文件是否有一些等效的CPPPATH
?Scons;彙編器的構造變量包括目錄;
CPPPATH=include_dirs
完全適用於.cpp
文件,但它似乎沒有申請.S
文件。我得到像「沒有這樣的文件或目錄」的錯誤信息
那麼是否有某種'ASPATH'?
感謝
PS:至於解決方法目前我用ASFLAGS
與-I/my_path
,但我真的不喜歡它...
新增:
這種方法適用(ASFLAGS)
asm_dirs = '-I' + gen_build_dir + gen_file_dir + ' ' #relative path here
as_flags = asm_dirs + env['ASFLAGS']
t = env.Program('boot.elf', sources, CPPPATH=include_dirs, LIBPATH=lib_dirs, LIBS=libs, ASFLAGS=as_flags,
LINKFLAGS=link_flags)
這種方法沒有(CPPPATH)
include_dirs += [ #add path to 'CPPPATH'
gen_build_dir + gen_file_dir + ' '
]
t = env.Program('boot.elf', sources, CPPPATH=include_dirs, LIBPATH=lib_dirs, LIBS=libs, LINKFLAGS=link_flags)
詳細的腳本:
asm_cppflags = ('-S -Wno-invalid-offsetof ')
gen_build_dir = 'build/Italy4K6/rel/'
gen_file_dir = 'OS/UserAccess/'
gen_file_name = 'UserAccess_HandleSysCall_ConstGen'
src_full_name = gen_file_dir + gen_file_name + '.cpp'
obj_full_name = gen_build_dir + gen_file_dir + gen_file_name + '.o'
dst_full_name = gen_build_dir + gen_file_dir + gen_file_name + '.h'
a = env.Object(src_full_name, CPPFLAGS=asm_cppflags, CPPPATH=include_dirs)
gen = env.Command(target = "HEADER", source = "",
action = "cat " + obj_full_name + " | " + gen_script + " > " + dst_full_name)
Depends(gen, a)
asm_dirs = '-I' + gen_build_dir + gen_file_dir + ' '
as_flags = asm_dirs + env['ASFLAGS']
link_script = 'Targets/LinkerScripts/%s.ld' % product
link_flags = ('-nodefaultlibs -nostartfiles -Wl,-T -Wl,%s -Wl,-Map -Wl,LINK.MAP ' % link_script) + env['LINKFLAGS']
t = env.Program('boot.elf', sources, CPPPATH=include_dirs, LIBPATH=lib_dirs, LIBS=libs, ASFLAGS=as_flags,
LINKFLAGS=link_flags)
Depends(t, link_script)
您正在使用哪種彙編程序?哪個平臺? – bdbaddog
彙編ARM,GNU GCC工具鏈,在mac os下。 – user3124812