aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 96206488cb3474b8eacd3d5c4e7367628f128918 (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
# Utilities
INSTALL = install
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644

# Flags
CFLAGS = -Wall -fpic
LDFLAGS = -shared

# Directories
LUA_INC_DIR ?= /usr/include/lua5.1
LUA_LIB_DIR ?= /usr/lib

INSTALL_DIR_LUA ?= /usr/share/lua/5.1
INSTALL_DIR_BIN ?= /usr/lib/lua/5.1

# Files
LUA_LIB ?= lua5.1
LIB = core.so

all:
	$(CC) $(CFLAGS) -c -Iinclude -I$(LUA_INC_DIR) src/*.c
	$(CC) $(LDFLAGS) -o $(LIB) *.o -L$(LUA_LIB_DIR) -l$(LUA_LIB) -levent

install: all
	mkdir -p $(DESTDIR)$(INSTALL_DIR_LUA)
	$(INSTALL_DATA) lua/luaevent.lua $(DESTDIR)$(INSTALL_DIR_LUA)/luaevent.lua
	mkdir -p $(DESTDIR)$(INSTALL_DIR_BIN)/luaevent/
	$(INSTALL_PROGRAM) $(LIB) $(DESTDIR)$(INSTALL_DIR_BIN)/luaevent/$(LIB)

clean:
	rm -f *.so
	rm -f *.o