diff options
| author | Michael Forney <mforney@mforney.org> | 2020-06-21 14:38:52 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2020-06-22 22:47:59 -0700 |
| commit | 481eb203bf31b482514b0befd2126d751b3e9d28 (patch) | |
| tree | 7689b4936c794745673c8a70edaca4455a6128ca /ninja.lua | |
| parent | 9614d6ff951521d68a37101fb36d477c47819dd7 (diff) | |
Simplify object collection slightly
Diffstat (limited to 'ninja.lua')
| -rw-r--r-- | ninja.lua | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -304,18 +304,16 @@ function objects(srcs, deps) end function link(out, files, args) - local objs, nobjs = {}, 0 - local deps, ndeps = {}, 0 + local objs = {} + local deps = {} for _, file in ipairs(files) do if not file:hasprefix('$') then file = '$outdir/'..file end if file:hassuffix('.d') then - ndeps = ndeps + 1 - deps[ndeps] = file + deps[#deps + 1] = file else - nobjs = nobjs + 1 - objs[nobjs] = file + objs[#objs + 1] = file end end out = '$outdir/'..out @@ -325,7 +323,8 @@ function link(out, files, args) if next(deps) then local rsp = out..'.rsp' build('awk', rsp, {deps, '|', '$basedir/scripts/rsp.awk'}, {expr='-f $basedir/scripts/rsp.awk'}) - objs = {objs, '|', rsp} + objs[#objs + 1] = '|' + objs[#objs + 1] = rsp args.ldlibs = '@'..rsp end build('link', out, objs, args) |
