lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Heesob Park wrote:

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
 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 = ""

f ="Makefile","w")
f:write(string.format("\t%s %s %s %s %s\n",cc,lua_inc,lua_lib,source,ext))

(I realize this is a "draft version", but ... )
This does not work on Linux.  It works only on
a Linux in which cc exists in the PATH and can
take a -shared argument to build a dso, etc.  To extend
this module beyond a 'draft' version that works on
a wide variety of platforms, you're going to wind
up with yet another libtool replacement.  Why
not just use libtool to begin with?

William Pursell