From e17c3a26635020e2308f8a0a0b5f6b328d46792e Mon Sep 17 00:00:00 2001 From: Fabien Fleutot Date: Tue, 3 Feb 2009 20:27:48 +0100 Subject: [PATCH] smarter lib regeneration under win32 --- src/build-utils/precompile.lua | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/build-utils/precompile.lua b/src/build-utils/precompile.lua index 957154c..bf8aef9 100644 --- a/src/build-utils/precompile.lua +++ b/src/build-utils/precompile.lua @@ -14,13 +14,23 @@ if not cfg.command or not cfg.directory then error ("Usage: "..arg[0].." command= directory=") end -local f = io.popen ("dir /S /b " .. cfg.directory) +-- List all files, recursively, from newest to oldest +local f = io.popen ("dir /S /b /o-D " .. cfg.directory) + +local file_seen = { } for src in f:lines() do + file_seen[src] = true local base = src:match "^(.+)%.mlua$" if base then - local cmd = cfg.command.." "..src.." -o "..base..".luac" - print (cmd) - os.execute (cmd) + local target = base..".luac" + if file_seen[target] then + -- the target file has been listed before the source ==> it's newer + print ("("..target.." up-to-date)") + else + local cmd = cfg.command.." "..src.." -o "..target + print (cmd) + os.execute (cmd) + end end end -- 2.44.0