aboutsummaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorcomex2015-07-07 15:19:20 -0400
committercomex2015-07-07 15:19:20 -0400
commit69752843f1b6460ebb23584401661613d0b5bacf (patch)
tree33e13dc21a4335aeb1cc114a5bddecdcc7628da3 /script
parent... (diff)
downloadsubstitute-69752843f1b6460ebb23584401661613d0b5bacf.tar.gz
tests
Diffstat (limited to 'script')
-rwxr-xr-xscript/gen-inject-asm.sh19
-rw-r--r--script/mconfig.py15
2 files changed, 20 insertions, 14 deletions
diff --git a/script/gen-inject-asm.sh b/script/gen-inject-asm.sh
index 161bbe7..633a1a5 100755
--- a/script/gen-inject-asm.sh
+++ b/script/gen-inject-asm.sh
@@ -1,5 +1,7 @@
#!/bin/sh
-cat <<END
+outfile="$1"
+shift
+(cat <<END
/* Generated by script/gen-inject-asm.sh. The relevant source is in-tree (make
* out/darwin-inject-asm.S), but this file has been checked in too, in case
* your C compiler doesn't support all of these architectures.
@@ -13,12 +15,11 @@ cat <<END
.globl _inject_page_start
_inject_page_start:
END
-outfile="$1"
-shift
-(for fn in "$@"; do
- echo ".align 2"
- echo ".globl _inject_start_$i"
- echo "_inject_start_$i:"
- printf ".byte "
- xxd -i < "$fn" | xargs echo
+while [ -n "$1" ]; do
+ echo ".align 2"
+ echo ".globl _inject_start_$1"
+ echo "_inject_start_$1:"
+ printf ".byte "
+ xxd -i < "$2" | xargs echo
+ shift 2
done) > "$outfile"
diff --git a/script/mconfig.py b/script/mconfig.py
index f056c10..e009675 100644
--- a/script/mconfig.py
+++ b/script/mconfig.py
@@ -30,7 +30,7 @@ def to_upper_and_underscore(s):
def argv_to_shell(argv):
quoteds = []
for arg in argv:
- if re.match('^[a-zA-Z0-9_\.@/+=-]+$', arg):
+ if re.match('^[a-zA-Z0-9_\.@/+=,-]+$', arg):
quoteds.append(arg)
else:
quoted = ''
@@ -1071,7 +1071,7 @@ def build_c_objs(emitter, machine, settings, sources, headers=[], settings_cb=No
my_settings = s
obj_fn = get_else_and(my_settings, 'override_obj_fn', lambda: guess_obj_fn(fn, settings), _expand)
is_cxx = get_else_and(my_settings, 'override_is_cxx', lambda: default_is_cxx(fn))
- includes = list(map(_expand, my_settings.get('c_includes', [])))
+ include_args = ['-I'+_expand(inc) for inc in my_settings.c_includes]
mach_settings = my_settings[machine.name]
dbg = ['-g'] if mach_settings.debug_info else []
cflags = _expand_argv(get_else_and(my_settings, 'override_cflags', lambda: (mach_settings.cxxflags if is_cxx else mach_settings.cflags)))
@@ -1081,9 +1081,11 @@ def build_c_objs(emitter, machine, settings, sources, headers=[], settings_cb=No
dep_fn = os.path.splitext(obj_fn)[0] + '.d'
mkdir_cmd = ['mkdir', '-p', dirname(obj_fn)]
- cmd = cc + dbg + cflags + ['-c', '-o', obj_fn, '-MMD', '-MF', dep_fn, fn]
+ cmd = cc + dbg + include_args + cflags + ['-c', '-o', obj_fn, '-MMD', '-MF', dep_fn, fn]
- emitter.add_command(my_settings, [obj_fn], [fn] + extra_deps, [mkdir_cmd, cmd], depfile=('makefile', dep_fn), expand=False)
+ cmds = [mkdir_cmd, cmd]
+ cmds = settings.get('modify_compile_commands', lambda x: x)(cmds)
+ emitter.add_command(my_settings, [obj_fn], [fn] + extra_deps, cmds, depfile=('makefile', dep_fn), expand=False)
for lset in my_settings.get('obj_ldflag_sets', ()):
ldflag_sets.add(tuple(lset))
@@ -1103,7 +1105,7 @@ def link_c_objs(emitter, machine, settings, link_type, link_out, objs, link_with
assert link_type in ('exec', 'dylib', 'staticlib', 'obj')
if link_type in ('exec', 'dylib'):
assert link_with_cxx in (False, True)
- cc_for_link = (tools.cxx if link_with_cxx else tools.cc).argv()
+ cc_for_link = _expand_argv(get_else_and(settings, 'override_ld', lambda: (tools.cxx if link_with_cxx else tools.cc).argv()))
if link_type == 'dylib':
typeflag = ['-dynamiclib'] if machine.is_darwin() else ['-shared']
else:
@@ -1118,6 +1120,7 @@ def link_c_objs(emitter, machine, settings, link_type, link_out, objs, link_with
elif link_type == 'obj':
cmds = [tools.cc.argv() + ['-Wl,-r', '-nostdlib', '-o', link_out] + objs]
cmds.insert(0, ['mkdir', '-p', dirname(link_out)])
+ cmds = settings.get('modify_link_commands', lambda x: x)(cmds)
emitter.add_command(settings, [link_out], objs + extra_deps, cmds, expand=False)
def build_and_link_c_objs(emitter, machine, settings, link_type, link_out, sources, headers=[], objs=[], settings_cb=None, force_cli=False, expand=True, extra_deps=[], extra_ldflags=[]):
@@ -1167,6 +1170,8 @@ settings_root.allow_autoclean_outside_out = False
post_parse_args_will_need.append(check_rule_hashes)
settings_root.auto_rerun_config = True
+settings_root.c_includes = []
+
emitters = {
'makefile': MakefileEmitter,
'ninja': NinjaEmitter,