summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-08-21 15:01:05 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-08-21 15:01:05 +0100
commit5af1a482eaf75f0930ce7f9b8fca96e13db9c79e (patch)
treed17b8a039b1e6f82d53df4c11079744145450e71
parentecb823b3a3b8a1f084ecb466af34acf242f65538 (diff)
downloadlua-5af1a482eaf75f0930ce7f9b8fca96e13db9c79e.tar.gz
Update build to include Debian-style make
-rw-r--r--Makefile23
-rw-r--r--lua.morph4
-rw-r--r--src/Makefile21
3 files changed, 46 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 209a132..63d6565 100644
--- a/Makefile
+++ b/Makefile
@@ -126,3 +126,26 @@ lecho:
.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho
# (end of Makefile)
+
+export V = 5.1
+export LIBTOOL = libtool --quiet --tag=CC
+# See libtool manual about how to set this
+export LIB_VERSION = 0:0:0
+
+debian_clean:
+ cd src; $(MAKE) $@
+
+debian_test: debian_linux
+ src/lua$(V) test/hello.lua
+
+debian_install: debian_linux
+ cd src; mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN)
+ cd src; $(LIBTOOL) --mode=install $(INSTALL_EXEC) lua$(V) luac$(V) $(INSTALL_BIN)
+ cd src; $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
+ cd src; $(LIBTOOL) --mode=install $(INSTALL_DATA) liblua$(V).la $(INSTALL_LIB)
+ $(foreach NAME,$(TO_MAN),$(INSTALL_DATA) doc/$(NAME) $(INSTALL_MAN)/$(basename $(NAME))$(V)$(suffix $(NAME));)
+
+# ISSUE: MYCFLAGS not honored in the case of a CFLAGS override
+debian_linux:
+ cd src; $(MAKE) debian_all CFLAGS+=-DLUA_USE_LINUX \
+ LIB_LIBS="-lm -ldl" LUA_LIBS="" LDFLAGS="$(LDFLAGS)"
diff --git a/lua.morph b/lua.morph
index 05582ee..b52d726 100644
--- a/lua.morph
+++ b/lua.morph
@@ -6,9 +6,9 @@
"sed -i -e '/^linux:/{n;s/-lreadline//g;s/-lhistory//g;s/-lncurses//g}' src/Makefile"
],
"build-commands": [
- "make PLAT=linux INSTALL_TOP=\"$PREFIX\""
+ "make debian_linux INSTALL_TOP=\"$PREFIX\""
],
"install-commands": [
- "make INSTALL_TOP=\"$DESTDIR/$PREFIX\" install"
+ "make INSTALL_TOP=\"$DESTDIR/$PREFIX\" debian_install"
]
}
diff --git a/src/Makefile b/src/Makefile
index e0d4c9f..05f4b2a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -180,3 +180,24 @@ print.o: print.c ldebug.h lstate.h lua.h luaconf.h lobject.h llimits.h \
ltm.h lzio.h lmem.h lopcodes.h lundump.h
# (end of Makefile)
+
+LIB_NAME = liblua$(V).la
+LIB_OBJS = $(CORE_O:.o=.lo) $(LIB_O:.o=.lo)
+
+%.lo %.o: %.c
+ $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
+
+$(LIB_NAME) $(LIB_NAME:.la=.a): $(LIB_OBJS)
+ $(LIBTOOL) --mode=link $(CC) -version-info $(LIB_VERSION) \
+ -o $(LIB_NAME) $(LIB_OBJS) $(LIB_LIBS)
+
+lua$(V): $(LUA_O) $(LIB_NAME)
+ $(LIBTOOL) --mode=link $(CC) -static -Wl,-E -o $@ $(LUA_O) $(LIB_NAME) $(LUA_LIBS) $(LDFLAGS)
+
+luac$(V): $(LUAC_O) $(LIB_NAME)
+ $(LIBTOOL) --mode=link $(CC) -static -o $@ $(LUAC_O) $(LIB_NAME)
+
+debian_clean:
+ $(LIBTOOL) --mode=clean $(RM) $(ALL_O:.o=.lo) $(LIB_NAME) lua$(V) luac$(V)
+
+debian_all: $(LIB_NAME) lua$(V) luac$(V)