Bart van Strien committed 49c2087

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

  • Participants
  • Parent commits a8fba28

Comments (0)

Files changed (3)

File platform/unix/

 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"], [:])
+		  [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"])

File platform/unix/genmodules

 AUTOMAKE_OPTIONS = subdir-objects
+SUFFIXES = .lua .lua.h
 # LÖVE executable
 # 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
+	cd scripts; \
+	\$(LUA_EXECUTABLE) auto.lua \$<
 # libLÖVE
 lib_LTLIBRARIES = liblove${love_suffix}.la

File src/scripts/auto.lua

 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)