lua-users home
lua-l archive

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


> Anyone know how to write a Makefile.am in order to generate a .so Lua
> module?

Just for your information.

   http://sf.net/projects/mk-configure
   http://mova.org/~cheusov/pub/mk-configure/mkc-presentation.pdf

mk-configure is not Lua-centric.
It is a full-featured replacement for GNU autotools.
Latest version has support for Lua.

==================================================
$  cat Makefile
LUA_CMODULE=    foo

.include <mkc.lib.mk>
==================================================
$  mkcmake
checking for program pkg-config... /usr/pkg/bin/pkg-config
checking for [pkg-config] lua... 1 (yes)
checking for [pkg-config] lua --cflags... -I/usr/pkg/include
checking for [pkg-config] lua --libs... -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -llua -lm
checking for [pkg-config] lua --variable=INSTALL_CMOD... /usr/pkg/lib/lua/5.1
checking for header lua.h... yes
checking for program cc... /usr/bin/cc
cc  -DHAVE_HEADER_LUA_H=1   -I/usr/pkg/include  -c -fPIC -DPIC foo.c -o foo.os
building shared foo library (version )
cc -shared -Wl,-soname -Wl,libfoo.so.1 -o foo.so  foo.os -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -llua -lm
==================================================
$  mkcmake installdirs install DESTDIR=/tmp/fakeroot
for d in _ /tmp/fakeroot/usr/pkg/lib/lua/5.1; do  test "$d" = _ ||
/usr/bin/install -d "$d";  done
/usr/bin/install   -c -o cheusov  -g users -m 644 foo.so
/tmp/fakeroot/usr/pkg/lib/lua/5.1/foo.so
==================================================
$

-- 
Best regards, Aleksey Cheusov.