1 Add the compilation of a shared library.
2 Compile the lua binary with the shared library.
3 And install the shared library.
4 The variable BUILDMODE allows to switch between static and dynamic mode.
6 Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
9 ===================================================================
14 TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
16 +TO_SOLIB = liblua.so.$(R)
19 # Lua version and release.
22 cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
23 cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
24 + test -f src/$(TO_SOLIB) && cd src && $(INSTALL_EXEC) $(TO_SOLIB) $(INSTALL_LIB) || :
25 + test -f src/$(TO_SOLIB) && ln -sf $(TO_SOLIB) $(INSTALL_LIB)/liblua.so || :
26 cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
27 cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
28 cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
30 ===================================================================
34 PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
38 CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
39 lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
40 lundump.o lvm.o lzio.o
42 LUAC_O= luac.o print.o
44 ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
45 +ifneq (dynamic,$(BUILDMODE))
46 ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
48 +ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
61 $(LUA_A): $(CORE_O) $(LIB_O)
62 $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
65 +$(LUA_SO): $(CORE_O) $(LIB_O)
66 + $(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $?
67 + ln -fs $@.$(PKG_VERSION) $@
69 +ifneq (dynamic,$(BUILDMODE))
70 $(LUA_T): $(LUA_O) $(LUA_A)
71 $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
73 +$(LUA_T): $(LUA_O) $(LUA_SO)
74 + $(CC) -o $@ -L. $(MYLDFLAGS) $(LUA_O) -llua $(LIBS)
77 $(LUAC_T): $(LUAC_O) $(LUA_A)
78 $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)