commit 5ade0bd8db1f484464ae7913f7c2f6892974b86d
parent 342557527accc69dbbb746d5144d3078b211c7b0
Author: Michael Savage <mikejsavage@gmail.com>
Date: Sun, 3 May 2020 10:40:28 +0300
Rebuild lua_combined.h when any .lua files change
Diffstat:
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/ggbuild/gen_ninja.lua b/ggbuild/gen_ninja.lua
@@ -121,12 +121,12 @@ local dir = "build/" .. OS_config
local output = { }
local function flatten_into( res, t )
- for _, x in ipairs( t ) do
- if type( x ) == "table" then
+ if type( t ) == "table" then
+ for _, x in ipairs( t ) do
flatten_into( res, x )
- else
- table.insert( res, x )
end
+ else
+ table.insert( res, t )
end
end
@@ -196,7 +196,7 @@ local function glob_impl( dir, rel, res, prefix, suffix, recursive )
end
end
-local function glob( srcs )
+function glob( srcs )
local res = { }
for _, pattern in ipairs( flatten( srcs ) ) do
if pattern:find( "*", 1, true ) then
diff --git a/make.lua b/make.lua
@@ -58,4 +58,4 @@ rule combine-lua
command = $lua ggbuild/pack_lua.lua src/lua main.lua
description = lua_combined.h
]] )
-print( "build build/lua_combined.h: combine-lua | ggbuild/pack_lua.lua" )
+print( "build build/lua_combined.h: combine-lua " .. table.concat( glob( "src/lua/*.lua" ), " " ) .. " | ggbuild/pack_lua.lua" )