[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Generating makefile for C library.
- From: "Heesob Park" <phasis@...>
- Date: Tue, 28 Oct 2008 15:22:10 +0900
2008/10/28 William Pursell <bill.pursell@gmail.com>:
> 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
>> 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()
>>
>
> (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?
>
I have no knowledge about libtool and I don't want to open a can of worms.
I just made it for my personal use.
Regards,
Park Heesob