Merge pull request #23 from fperrad/patch-2
[luajson.git] / Makefile
blob777c8b2bbf8efd3e57a02ecbf01c5e24637e5de4
2 # Makefile to prepare releases and run tests
5 DISTOPS= dist distclean dist-all dist-bzip2 dist-gzip dist-tar dist-zip
6 .PHONY: all clean check $(DISTOPS) distcheck install
8 LUA_BIN=lua
9 LUNIT_BIN=lunit
10 VERSION=luajson-$(shell git describe --abbrev=4 HEAD 2>/dev/null)
12 MKDIR=mkdir -p
13 PREFIX ?= /usr/local
14 INSTALL_TOP= $(PREFIX)
16 INSTALL_LMOD= $(INSTALL_TOP)/share/lua/5.1
17 INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/5.1
19 all:
20 @echo Building nothing - no binaries
22 clean:
23 @echo Cleaning nothing - no binaries
25 $(DISTOPS):
26 $(MAKE) $(MFLAGS) -C dist $@
28 # Config to make sure that Lua uses the contained Lua code
29 LUA_PATH_SETUP=LUA_PATH="?/init.lua;../lua/?.lua;../lua/?/init.lua;$(LUA_PATH);"
30 LUA_SETUP=LUA_OLD_INIT="$(LUA_INIT)" LUA_INIT="@hook_require.lua" $(LUA_PATH_SETUP)
32 check-regression:
33 cd tests && $(LUA_SETUP) $(LUA_BIN) regressionTest.lua
34 check-unit:
35 cd tests && $(LUA_SETUP) $(LUNIT_BIN) lunit-*.lua
37 check: check-regression check-unit
39 distcheck-tar: dist-tar
40 $(MKDIR) tmp
41 tar -C tmp -xf dist/$(VERSION).tar
42 cd tmp/$(VERSION) && make check
43 rm -rf tmp
45 distcheck-zip: dist-zip
46 $(MKDIR) tmp
47 unzip -q -d tmp dist/$(VERSION).zip
48 cd tmp/$(VERSION) && make check
49 rm -rf tmp
51 distcheck: distcheck-zip distcheck-tar
54 install:
55 $(MKDIR) $(DESTDIR)$(INSTALL_LMOD)
56 cp -p -r lua/* $(DESTDIR)$(INSTALL_LMOD)