Here is the draft version of make.lua works on Linux and Windows:
source = arg[1]
module = string.match(source,"^([^.]+)")
if package.config:sub(1,1)=="\\" then -- Windows
lua_root = package.path:match("^[^;]+;([^;]+)\\lua")
version = _VERSION:match("[%d\.]+$")
lua_lib = "\"" .. lua_root .. "\\lib\\lua" .. version .. ".lib\""
lua_inc = "-I\"" .. lua_root .. "\\include\""
cc = "cl.exe /LD"
ext = "/link /export:luaopen_"..module
else
lua_root = package.path:match("^[^;]+;([^;]+)/share")
lua_lib = "-L" .. lua_root .. "/lib"
lua_inc = "-I" .. lua_root .. "/include"
cc = "cc -shared -o " .. module .. ".so"
ext = ""
end
f = io.open("Makefile","w")
f:write("ALL:\n")
f:write(string.format("\t%s %s %s %s %s\n",cc,lua_inc,lua_lib,source,ext))
f:close()