From d81eae88894154f2383c060583ded07a56016948 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Sat, 14 Dec 2013 13:57:52 +0100 Subject: [PATCH] Scripts now automatically recompile on change on linux, auto.lua normalizes input names a bit more --- platform/unix/configure.ac | 5 +++++ platform/unix/genmodules | 9 ++++----- src/scripts/auto.lua | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/platform/unix/configure.ac b/platform/unix/configure.ac index a54b3f592..4347329f0 100644 --- a/platform/unix/configure.ac +++ b/platform/unix/configure.ac @@ -121,6 +121,11 @@ AM_CONDITIONAL([LOVE_BUILD_EXE], [test "x$enable_exe" != xno]) AM_CONDITIONAL([LOVE_NOMPG123], [test "x$enable_mpg123" == xno]) AM_CONDITIONAL([LOVE_TARGET_OSX], [test "x$enable_osx" != xno]) +# Automatic script file rebuilding +AC_CHECK_PROGS([LUA_EXECUTABLE], ["${with_lua}${with_luaversion}" "${with_lua}" "lua"], [:]) +AS_VAR_IF([LUA_EXECUTABLE], [:], + [AC_MSG_WARN([Did not find a lua executable, you may need to update the scripts manually if you change them])], []) + # Set our includes as automake variable AC_SUBST([LOVE_INCLUDES], ["$includes"]) diff --git a/platform/unix/genmodules b/platform/unix/genmodules index f734c77cc..5be29fae5 100644 --- a/platform/unix/genmodules +++ b/platform/unix/genmodules @@ -115,6 +115,7 @@ AM_CPPFLAGS = -I$inc_current -I$inc_modules -I$inc_libraries -I$inc_libraries/en \$(vorbisfile_CFLAGS) AUTOMAKE_OPTIONS = subdir-objects SUBDIRS = +SUFFIXES = .lua .lua.h if LOVE_BUILD_EXE # LÖVE executable @@ -134,11 +135,9 @@ endif endif # Compile scripts -#scripts/%.lua.h: scripts/%.lua -# cd scripts; \ -# lua auto.lua \$* -#TODO: Figure out how to only do this on gnu make, and detect which lua -# executable to run +.lua.lua.h: + cd scripts; \ + \$(LUA_EXECUTABLE) auto.lua \$< # libLÖVE lib_LTLIBRARIES = liblove${love_suffix}.la diff --git a/src/scripts/auto.lua b/src/scripts/auto.lua index fdaa90212..c3cefd1ab 100644 --- a/src/scripts/auto.lua +++ b/src/scripts/auto.lua @@ -107,7 +107,8 @@ end for i, v in ipairs(arg) do --run the auto function for every argument --but do it with pcall, to catch errors - local ok, err = pcall(auto, v:gsub("%.lua$","")) + v = v:gsub("%.lua$", ""):gsub("^(.+)/", "") -- normalize input + local ok, err = pcall(auto, v) if not ok then --inform people we've failed print(v .. ": " .. err)