summaryrefslogtreecommitdiff
path: root/setup.lua
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2020-06-14 11:33:31 -0700
committerMichael Forney <mforney@mforney.org>2020-06-15 23:35:02 -0700
commit214296ab724829d700e09dc5863e38a8bd2e0565 (patch)
tree36048bf2ef71da1a4cac9dd7ee61e17e3ed34687 /setup.lua
parent8494d08ca91d3ed20978836e5817f6c2a69925ed (diff)
Make gen a local function
Diffstat (limited to 'setup.lua')
-rwxr-xr-xsetup.lua40
1 files changed, 20 insertions, 20 deletions
diff --git a/setup.lua b/setup.lua
index 7779bc59..ff62ee32 100755
--- a/setup.lua
+++ b/setup.lua
@@ -23,26 +23,7 @@ end
local recurse = not arg[1]
-function subgen(dir)
- local file = '$gendir/'..dir..'/local.ninja'
- subninja(file)
- table.insert(pkg.inputs.ninja, '$gendir/'..dir..'/ninja')
- table.insert(pkg.inputs.index, '$outdir/'..dir..'/root.index')
- table.insert(pkg.inputs.perms, '$outdir/'..dir..'/root.perms')
- table.insert(pkg.inputs.fspec, '$outdir/'..dir..'/root.fspec')
- local cmd = string.format('test -f %s/%s/local.ninja', pkg.gendir, dir)
- if recurse or not os.execute(cmd) then
- local oldpkg, oldout = pkg, io.output()
- if pkg.gendir ~= '.' then
- dir = pkg.gendir..'/'..dir
- end
- gen(dir)
- pkg = oldpkg
- io.output(oldout)
- end
-end
-
-function gen(gendir)
+local function gen(gendir)
local dir = basedir..'/'..gendir
local outdir = config.builddir..'/'..gendir
pkg={
@@ -148,4 +129,23 @@ function gen(gendir)
end
end
+function subgen(dir)
+ local file = '$gendir/'..dir..'/local.ninja'
+ subninja(file)
+ table.insert(pkg.inputs.ninja, '$gendir/'..dir..'/ninja')
+ table.insert(pkg.inputs.index, '$outdir/'..dir..'/root.index')
+ table.insert(pkg.inputs.perms, '$outdir/'..dir..'/root.perms')
+ table.insert(pkg.inputs.fspec, '$outdir/'..dir..'/root.fspec')
+ local cmd = string.format('test -f %s/%s/local.ninja', pkg.gendir, dir)
+ if recurse or not os.execute(cmd) then
+ local oldpkg, oldout = pkg, io.output()
+ if pkg.gendir ~= '.' then
+ dir = pkg.gendir..'/'..dir
+ end
+ gen(dir)
+ pkg = oldpkg
+ io.output(oldout)
+ end
+end
+
gen(arg[1] or '.')