diff options
| author | Michael Forney <mforney@mforney.org> | 2020-02-29 23:58:59 -0800 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2020-03-01 20:48:09 -0800 |
| commit | 95231e7f5ac6ce0c6f44379efc03cf5c095a29eb (patch) | |
| tree | 710003fd40df9f8133ae73302e6ea239eeb16a1a /pkg/binutils | |
| parent | 51acd63e8e6c901a191c99f23e9970bd9cd1eec8 (diff) | |
binutils: Generate ldemul-list.sh with a shell script
Diffstat (limited to 'pkg/binutils')
| -rw-r--r-- | pkg/binutils/gen.lua | 19 | ||||
| -rw-r--r-- | pkg/binutils/ldemul.sh | 4 |
2 files changed, 12 insertions, 11 deletions
diff --git a/pkg/binutils/gen.lua b/pkg/binutils/gen.lua index e5179169..8e3ce57d 100644 --- a/pkg/binutils/gen.lua +++ b/pkg/binutils/gen.lua @@ -327,16 +327,13 @@ sub('ld.ninja', function() '-I $outdir/bfd', '-I $srcdir/bfd', } - local f = io.open(pkg.dir..'/ld/ldemul-list.h', 'w') - for _, emul in ipairs(emuls) do - f:write(string.format('extern ld_emulation_xfer_type ld_%s_emulation;\n', emul)) - end - f:write('#define EMULATION_LIST ') - for _, emul in ipairs(emuls) do - f:write(string.format('&ld_%s_emulation, ', emul)) - end - f:write('0\n') - f:close() + local deps = { + '$gendir/deps', + '$outdir/ld/ldemul-list.h', + } + + rule('ldemul', 'sh $dir/ldemul.sh $emuls >$out') + build('ldemul', '$outdir/ld/ldemul-list.h', {'|', '$dir/ldemul.sh'}, {emuls=emuls}) build('copy', '$outdir/ld/stringify.sed', '$srcdir/ld/emultempl/astring.sed') rule('genscripts', string.format([[cd $outdir/ld && LIB_PATH= sh $$OLDPWD/$srcdir/ld/genscripts.sh $$OLDPWD/$srcdir/ld /lib '' '' %s %s %s '' /lib '%s' /lib no yes $emul %s]], config.target.platform, config.target.platform, config.target.platform, table.concat(emuls, ' '), config.target.platform)) @@ -369,7 +366,7 @@ sub('ld.ninja', function() libctf.a.d ]], srcs, - }) + }, deps) file('bin/ld', '755', '$outdir/bin/ld') sym(string.format('bin/%s-ld', config.target.platform), 'ld') man{'ld/ld.1'} diff --git a/pkg/binutils/ldemul.sh b/pkg/binutils/ldemul.sh new file mode 100644 index 00000000..f80b8d50 --- /dev/null +++ b/pkg/binutils/ldemul.sh @@ -0,0 +1,4 @@ +printf 'extern ld_emulation_xfer_type ld_%s_emulation;\n' "$@" +printf '#define EMULATION_LIST ' +printf '&ld_%s_emulation, ' "$@" +printf '0\n' |
