diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2015-06-19 08:40:52 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2015-06-19 08:43:02 +0200 |
commit | fe552a1422cb40b99159947c5f8f66bd99a13d4c (patch) | |
tree | f2d06be41b59085aadc7dc6defd23fb19e3138cc | |
parent | 7e29992497f891666d9eaa25a1b80544b8e5efa5 (diff) | |
download | sircbot-fe552a1422cb40b99159947c5f8f66bd99a13d4c.tar.bz2 sircbot-fe552a1422cb40b99159947c5f8f66bd99a13d4c.tar.xz |
lua: add support for building multiple versions
It might be handy to be able to build Lua module for multiple Lua
versions.
-rw-r--r-- | Makefile | 13 | ||||
-rw-r--r-- | lua/lsircbot.c (renamed from lsircbot.c) | 0 |
2 files changed, 8 insertions, 5 deletions
@@ -9,12 +9,11 @@ CFLAGS += -DVERSION=\"$(VERSION)$(GIT_VERSION)\" TARGETS = sircbot sircbot-send ifneq (NOLUA,) -LUAPC ?= lua +LUA_VERSION ?= 5.1 +LUAPC ?= lua$(LUA_VERSION) PKGCONFIG ?= pkg-config -TARGETS += sircbot.so +TARGETS += lua/$(LUA_VERSION)/sircbot.so LUA_CFLAGS = $(shell $(PKGCONFIG) --cflags $(LUAPC)) -LUA_LIBS = $(shell $(PKGCONFIG) --libs $(LUAPC)) -CFLAGS += $(LUA_CFLAGS) endif prefix ?= /usr/local @@ -32,12 +31,16 @@ sircbot: sircbot.o irc.o sircbot-send: sircbot-send.o $(CC) $(LDFLAGS) -o $@ $^ -sircbot.so: lsircbot.o +lua/$(LUA_VERSION)/sircbot.so: lua/$(LUA_VERSION)/lsircbot.o $(CC) -shared $(LDFLAGS) -o $@ $^ $(LUA_LIBS) .c.o: $(CC) -fPIC $(CFLAGS) -c $^ +lua/$(LUA_VERSION)/%.o: lua/%.c + mkdir -p "$(dir $@)" + $(CC) -fPIC $(CFLAGS) $(LUA_CFLAGS) -o $@ -c $^ + clean: rm -f *.o $(TARGETS) diff --git a/lsircbot.c b/lua/lsircbot.c index 0b97d5a..0b97d5a 100644 --- a/lsircbot.c +++ b/lua/lsircbot.c |