aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile13
-rw-r--r--lua/lsircbot.c (renamed from lsircbot.c)0
2 files changed, 8 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 0304763..217110b 100644
--- a/Makefile
+++ b/Makefile
@@ -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