blob: 03047636cbffd8e1888ff34551beeffc6c2120c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
-include config.mk
VERSION=0.3
GIT_VERSION := $(shell [ -d .git ] && echo "-$$(git describe --always)")
CFLAGS ?= -g
CFLAGS += -DVERSION=\"$(VERSION)$(GIT_VERSION)\"
TARGETS = sircbot sircbot-send
ifneq (NOLUA,)
LUAPC ?= lua
PKGCONFIG ?= pkg-config
TARGETS += sircbot.so
LUA_CFLAGS = $(shell $(PKGCONFIG) --cflags $(LUAPC))
LUA_LIBS = $(shell $(PKGCONFIG) --libs $(LUAPC))
CFLAGS += $(LUA_CFLAGS)
endif
prefix ?= /usr/local
bindir ?= $(prefix)/bin
DESTDIR ?=
LUA_LIBDIR ?= $(prefix)/lib/lua/5.1
LUA_LUADIR ?= $(prefix)/share/lua/5.1
INSTALL ?= install
all: $(TARGETS)
sircbot: sircbot.o irc.o
$(CC) $(LDFLAGS) -o $@ $^
sircbot-send: sircbot-send.o
$(CC) $(LDFLAGS) -o $@ $^
sircbot.so: lsircbot.o
$(CC) -shared $(LDFLAGS) -o $@ $^ $(LUA_LIBS)
.c.o:
$(CC) -fPIC $(CFLAGS) -c $^
clean:
rm -f *.o $(TARGETS)
install: $(TARGETS)
$(INSTALL) -d $(DESTDIR)$(bindir)
$(INSTALL) sircbot $(DESTDIR)$(bindir)
$(INSTALL) sircbot-send $(DESTDIR)$(bindir)
ifneq (NOLUA,)
$(INSTALL) -d $(DESTDIR)$(LUA_LIBDIR)
$(INSTALL) sircbot.so $(DESTDIR)$(LUA_LIBDIR)
endif
|