-
Notifications
You must be signed in to change notification settings - Fork 24
/
Makefile
49 lines (36 loc) · 1.24 KB
/
Makefile
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
.PHONY: all install clean dist dist-all dist-bzip2 dist-gzip dist-zip
DIST_DIR=dist
# 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
INSTALL_DIR_LUA ?= /usr/share/lua/5.1
INSTALL_DIR_BIN ?= /usr/lib/lua/5.1
# Files
LIB = core.so
all:
$(CC) $(CFLAGS) $(RPM_OPT_FLAGS) -c -Iinclude -I$(LUA_INC_DIR) src/*.c
$(CC) $(LDFLAGS) $(RPM_LD_FLAGS) -o $(LIB) *.o -levent
dist dist-all: distdir dist-bzip2 dist-gzip dist-zip
distdir:
mkdir -p $(DIST_DIR)
VERSION=luaevent-$(shell git describe --abbrev=4 HEAD 2>/dev/null)
dist-bzip2: distdir
git archive --format=tar --prefix=$(VERSION)/ HEAD | bzip2 -9v > $(DIST_DIR)/$(VERSION).tar.bz2
dist-gzip: distdir
git archive --format=tar --prefix=$(VERSION)/ HEAD | gzip -9v > $(DIST_DIR)/$(VERSION).tar.gz
dist-zip: distdir
git archive --format=zip --prefix=$(VERSION)/ HEAD > $(DIST_DIR)/$(VERSION).zip
install:
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