Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (71 loc) · 3.1 KB
/
Copy pathMakefile
File metadata and controls
95 lines (71 loc) · 3.1 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
INSTALL = install
INSTALL_PROGRAM = $(INSTALL)
RM = rm -f
RM_DIR = rm -rf
LUA_VERSION= 5.4
# Generated by ./configure
include config.mk
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
LPEG_TARGET = macosx
else
LPEG_TARGET = linux
endif
# Standard targets
all: downstream pallene-tracer lpeg
clean:
$(RM_DIR) ./deps/lua/downstream
cd ./deps/pallene-tracer && $(MAKE) clean
cd ./deps/lpeg && $(MAKE) clean
distclean: clean
$(RM) config.mk
install: all
# Any change in the 'install' target should, probably, induce
# a corresponding change in the 'uninstall' target.
# Make all the requisite directories.
mkdir -p $(INSTALL_PREFIX)/include
mkdir -p $(INSTALL_PREFIX)/bin
mkdir -p $(INSTALL_PREFIX)/share/lua/$(LUA_VERSION)
mkdir -p $(INSTALL_PREFIX)/lib/lua/$(LUA_VERSION)
# Install all the dependencies first.
cd deps/lua/downstream && $(MAKE) install INSTALL_TOP=$(INSTALL_PREFIX) TO_BIN="plua pluac"
cd deps/pallene-tracer && $(MAKE) install PREFIX=$(INSTALL_PREFIX)
# Note that we have to manually copy these over because
# the Makefile for these projects do not provide an 'install'
# target.
$(INSTALL) deps/argparse/src/argparse.lua $(INSTALL_PREFIX)/share/lua/$(LUA_VERSION)
$(INSTALL) deps/lpeg/re.lua $(INSTALL_PREFIX)/share/lua/$(LUA_VERSION)
$(INSTALL) deps/lpeg/lpeg.so $(INSTALL_PREFIX)/lib/lua/$(LUA_VERSION)
# Install Pallene.
cp -r src/pallene/ $(INSTALL_PREFIX)/share/lua/$(LUA_VERSION)/pallene
cp -r src/bin/ $(INSTALL_PREFIX)/share/lua/$(LUA_VERSION)/bin
# Install the wrapper shell script (inspired by LuaRocks).
$(INSTALL_PROGRAM) pallenec $(INSTALL_PREFIX)/bin
uninstall:
# Uninstall all the dependencies.
cd ./deps/lua/downstream && $(MAKE) uninstall INSTALL_TOP=$(INSTALL_PREFIX) TO_BIN="plua pluac"
cd ./deps/pallene-tracer && $(MAKE) uninstall PREFIX=$(INSTALL_PREFIX)
$(RM) $(INSTALL_PREFIX)/share/lua/$(LUA_VERSION)/argparse.lua
$(RM) $(INSTALL_PREFIX)/share/lua/$(LUA_VERSION)/re.lua
$(RM) $(INSTALL_PREFIX)/lib/lua/$(LUA_VERSION)/lpeg.so
# Uninstall Pallene.
$(RM_DIR) $(INSTALL_PREFIX)/share/lua/$(LUA_VERSION)/pallene
$(RM_DIR) $(INSTALL_PREFIX)/share/lua/$(LUA_VERSION)/bin
# Uninstall the wrapper shell script (inspired by LuaRocks).
$(RM) $(INSTALL_PREFIX)/bin/pallenec
.PHONY: all clean distclean install uninstall pallene-tracer lpeg downstream
# Compilation
deps/lua/downstream: ./deps/lua/upstream
$(RM_DIR) ./deps/lua/downstream
cp -r ./deps/lua/upstream ./deps/lua/downstream
cp ./deps/lua/patches/gen-lua-core-h.awk ./deps/lua/downstream/src
cd ./deps/lua/downstream && patch -p1 < ../patches/expose-internal-apis.patch
cd ./deps/lua/downstream && $(MAKE) LUA_T=plua LUAC_T=pluac
downstream: deps/lua/downstream
pallene-tracer: downstream
cd ./deps/pallene-tracer && $(MAKE) LUA_PREFIX="../lua/downstream" LUA_BINDIR="../lua/downstream/src" LUA_INCDIR="../lua/downstream/src" LUA_LIBDIR="../lua/downstream/src"
lpeg: downstream
cd ./deps/lpeg && $(MAKE) $(LPEG_TARGET) LUADIR="../lua/downstream/src"
config.mk:
@echo You must run ./configure before make
@exit 1