-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
38 lines (34 loc) · 917 Bytes
/
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
PREFIX ?= /usr/local
LUA ?= luajit
ABIVER ?= 5.1
PREFIX_LMOD ?= $(PREFIX)/share/lua/$(ABIVER)
INSTALL ?= install
CFLAGS ?= -std=c99 -O2 -g -fPIC
LIBEXT := so
# Scripts and extras
OBJS := dns
LIBS := $(addsuffix .lua,$(OBJS))
EXTRA := $(wildcard dns/*)
CLIB := kdns_clib.$(LIBEXT)
# Rules
all: check
#check: $(addsuffix .test,$(OBJS))
check: $(CLIB)
@echo "[*] static analysis"
@luacheck --codes --formatter TAP . --exclude-files *.test.lua config.lua dns.lua
@echo "[*] unit tests"
@busted --lua=$(LUA) -o TAP
clean:
$(RM) $(CLIB)
$(CLIB): src/utils.c src/murmurhash3.c
$(CC) $(CFLAGS) -shared $^ -o $(CLIB)
install:
$(INSTALL) -d $(PREFIX_LMOD)/dns
$(INSTALL) $(EXTRA) $(PREFIX_LMOD)/dns
$(INSTALL) $(LIBS) $(CLIB) $(PREFIX_LMOD)/
uninstall:
rm -f $(addprefix $(PREFIX_LMOD)/,$(EXTRA) $(LIBS)) $(CLIB)
rmdir $(PREFIX_LMOD)/dns
%.test: %.test.lua $(CLIB)
$(LUA) $<
.PHONY: all check install uninstall