diff options
Diffstat (limited to '')
-rw-r--r-- | linkers/wscript | 2 | ||||
-rw-r--r-- | rtemstoolkit/win32/ar.h (renamed from linkers/win32/ar.h) | 0 | ||||
-rw-r--r-- | rtemstoolkit/win32/sys/cdefs.h (renamed from linkers/win32/sys/cdefs.h) | 0 | ||||
-rw-r--r-- | rtemstoolkit/win32/sys/errno.h (renamed from linkers/win32/sys/errno.h) | 0 | ||||
-rw-r--r-- | rtemstoolkit/win32/sys/mman.h (renamed from linkers/win32/sys/mman.h) | 0 | ||||
-rw-r--r-- | rtemstoolkit/win32/sys/queue.h (renamed from linkers/win32/sys/queue.h) | 0 | ||||
-rw-r--r-- | rtemstoolkit/wscript | 15 | ||||
-rw-r--r-- | wscript | 27 |
8 files changed, 38 insertions, 6 deletions
diff --git a/linkers/wscript b/linkers/wscript index 6cfbedb..d48ce47 100644 --- a/linkers/wscript +++ b/linkers/wscript @@ -41,6 +41,8 @@ def build(bld): rtemstoolkit + '/elftoolchain/libelf', rtemstoolkit + '/elftoolchain/common', rtemstoolkit + '/libiberty'] + if bld.env.DEST_OS == 'win32': + conf['includes'] += [rtemstoolkit + '/win32'] conf['warningflags'] = ['-Wall', '-Wextra', '-pedantic'] conf['optflags'] = bld.env.C_OPTS conf['cflags'] = ['-pipe', '-g'] + conf['optflags'] diff --git a/linkers/win32/ar.h b/rtemstoolkit/win32/ar.h index e04874f..e04874f 100644 --- a/linkers/win32/ar.h +++ b/rtemstoolkit/win32/ar.h diff --git a/linkers/win32/sys/cdefs.h b/rtemstoolkit/win32/sys/cdefs.h index c96b517..c96b517 100644 --- a/linkers/win32/sys/cdefs.h +++ b/rtemstoolkit/win32/sys/cdefs.h diff --git a/linkers/win32/sys/errno.h b/rtemstoolkit/win32/sys/errno.h index 339f4fc..339f4fc 100644 --- a/linkers/win32/sys/errno.h +++ b/rtemstoolkit/win32/sys/errno.h diff --git a/linkers/win32/sys/mman.h b/rtemstoolkit/win32/sys/mman.h index 1882085..1882085 100644 --- a/linkers/win32/sys/mman.h +++ b/rtemstoolkit/win32/sys/mman.h diff --git a/linkers/win32/sys/queue.h b/rtemstoolkit/win32/sys/queue.h index 4ff0883..4ff0883 100644 --- a/linkers/win32/sys/queue.h +++ b/rtemstoolkit/win32/sys/queue.h diff --git a/rtemstoolkit/wscript b/rtemstoolkit/wscript index 544321a..5658dc5 100644 --- a/rtemstoolkit/wscript +++ b/rtemstoolkit/wscript @@ -38,7 +38,7 @@ def build(bld): # The include paths. # conf['includes'] = ['elftoolchain/libelf', 'elftoolchain/common', 'libiberty'] - if sys.platform == 'win32': + if bld.env.DEST_OS == 'win32': conf['includes'] += ['win32'] # @@ -122,9 +122,11 @@ def bld_libelf(bld, conf): # if sys.platform == 'win32': m4_rule = 'type ${SRC} | m4 -D SRCDIR=../rtemstoolkit/' + libelf[:-1] + '> ${TGT}"' - includes = ['win32'] else: m4_rule = 'm4 -D SRCDIR=../rtemstoolkit/' + libelf[:-1] + ' ${SRC} > ${TGT}' + if bld.env.DEST_OS == 'win32': + includes = ['win32'] + else: includes = [] bld(target = 'libelf_convert.c', source = libelf + 'libelf_convert.m4', rule = m4_rule) @@ -133,21 +135,22 @@ def bld_libelf(bld, conf): host_source = [] - if sys.platform == 'linux2': + if bld.env.DEST_OS == 'linux2': common = 'elftoolchain/common/' bld(target = common + 'native-elf-format.h', source = common + 'native-elf-format', name = 'native-elf-format', rule = './${SRC} > ${TGT}') bld.add_group () - elif sys.platform == 'win32': + elif bld.env.DEST_OS == 'win32': host_source += [libelf + 'mmap_win32.c'] bld.stlib(target = 'elf', features = 'c', install_path = None, uses = ['native-elf-format'], - includes = [bld.bldnode.abspath(), 'elftoolchain/libelf', 'elftoolchain/common'] + includes, + includes = [bld.bldnode.abspath(), + 'elftoolchain/libelf', 'elftoolchain/common'] + includes, cflags = conf['cflags'], source =[libelf + 'elf.c', libelf + 'elf_begin.c', @@ -230,7 +233,7 @@ def conf_libiberty(conf): conf.write_config_header('libiberty/config.h') def bld_libiberty(bld, conf): - if sys.platform == 'win32': + if bld.env.DEST_OS == 'win32': pex_host = 'libiberty/pex-win32.c' else: pex_host = 'libiberty/pex-unix.c' @@ -46,8 +46,24 @@ def options(ctx): default = '-O2', dest='c_opts', help = 'Set build options, default: -O2.') + ctx.add_option('--host', + default = 'native', + dest='host', + help = 'Set host to build for, default: none.') recurse(ctx) +def init(ctx): + try: + import waflib.Options + import waflib.ConfigSet + env = waflib.ConfigSet.ConfigSet() + env.load(waflib.Options.lockfile) + check_options(ctx, env.options['host']) + for sd in subdirs: + ctx.recurse(sd) + except: + pass + def configure(ctx): try: ctx.load("doxygen", tooldir = 'waf-tools') @@ -55,6 +71,7 @@ def configure(ctx): pass ctx.env.C_OPTS = ctx.options.c_opts.split(',') ctx.env.RTEMS_VERSION = ctx.options.rtems_version + check_options(ctx, ctx.options.host) recurse(ctx) def build(ctx): @@ -70,6 +87,16 @@ def rebuild(ctx): import waflib.Options waflib.Options.commands.extend(['clean', 'build']) +def check_options(ctx, host): + if host in ['mingw32']: + ctx.env.HOST = host + ctx.env.CC = '%s-gcc' % (host) + ctx.env.CXX = '%s-g++' % (host) + ctx.env.AR = '%s-ar' % (host) + ctx.env.PYTHON = 'python' + elif host is not 'native': + ctx.fatal('unknown host: %s' % (host)); + # # The doxy command. # |