Scripts now automatically recompile on change on linux, auto.lua normalizes input names a bit more

This commit is contained in:
Bart van Strien
2013-12-14 13:57:52 +01:00
parent e02cbd4704
commit d81eae8889
3 changed files with 11 additions and 6 deletions
+5
View File
@@ -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"])
+4 -5
View File
@@ -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
+2 -1
View File
@@ -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)