-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathMakefile
56 lines (41 loc) · 1.31 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
49
50
51
52
53
54
55
56
#
# Makefile to prepare releases and run tests
#
DISTOPS= dist distclean dist-all dist-bzip2 dist-gzip dist-tar dist-zip
.PHONY: all clean check $(DISTOPS) distcheck install
LUA_BIN=lua
LUNIT_BIN=lunit
VERSION=luajson-$(shell git describe --abbrev=4 HEAD 2>/dev/null)
MKDIR=mkdir -p
PREFIX ?= /usr/local
INSTALL_TOP= $(PREFIX)
INSTALL_LMOD= $(INSTALL_TOP)/share/lua/5.1
INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/5.1
all:
@echo Building nothing - no binaries
clean:
@echo Cleaning nothing - no binaries
$(DISTOPS):
$(MAKE) $(MFLAGS) -C dist $@
# Config to make sure that Lua uses the contained Lua code
LUA_PATH_SETUP=LUA_PATH="?/init.lua;../lua/?.lua;../lua/?/init.lua;$(LUA_PATH);"
LUA_SETUP=LUA_OLD_INIT="$(LUA_INIT)" LUA_INIT="@hook_require.lua" $(LUA_PATH_SETUP)
check-regression:
cd tests && $(LUA_SETUP) $(LUA_BIN) regressionTest.lua
check-unit:
cd tests && $(LUA_SETUP) $(LUNIT_BIN) --interpreter $(LUA_BIN) lunit-*.lua
check: check-regression check-unit
distcheck-tar: dist-tar
$(MKDIR) tmp
tar -C tmp -xf dist/$(VERSION).tar
cd tmp/$(VERSION) && make check
rm -rf tmp
distcheck-zip: dist-zip
$(MKDIR) tmp
unzip -q -d tmp dist/$(VERSION).zip
cd tmp/$(VERSION) && make check
rm -rf tmp
distcheck: distcheck-zip distcheck-tar
install:
$(MKDIR) $(DESTDIR)$(INSTALL_LMOD)
cp -p -r lua/* $(DESTDIR)$(INSTALL_LMOD)