-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.v8
42 lines (35 loc) · 1.57 KB
/
Makefile.v8
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
#-----------------------------------------------------------------------------#
#
# Makefile for v8 static link
#
# 'make static' will download the v8 source and build it, then build plv8
# with statically link to v8 with snapshot. This assumes certain directory
# structure in v8 which may be different from version to another, but user
# can specify the v8 version by AUTOV8_VERSION, too.
#-----------------------------------------------------------------------------#
AUTOV8_VERSION = 3.14.5
AUTOV8_DIR = build/v8-$(AUTOV8_VERSION)
AUTOV8_OUT = build/v8-$(AUTOV8_VERSION)/out/native
AUTOV8_LIB = $(AUTOV8_OUT)/libv8_snapshot.a
AUTOV8_STATIC_LIBS = libv8_base.a libv8_snapshot.a
SHLIB_LINK += $(addprefix $(AUTOV8_OUT)/, $(AUTOV8_STATIC_LIBS))
all: $(AUTOV8_LIB)
# For some reason, this solves parallel make dependency.
plv8_config.h: $(AUTOV8_LIB)
$(AUTOV8_DIR):
mkdir -p build
curl -L 'https://github.com/v8/v8/archive/$(AUTOV8_VERSION).tar.gz' \
| tar zxf - -C build
$(AUTOV8_LIB): $(AUTOV8_DIR)
env CXXFLAGS=-fPIC $(MAKE) -C build/v8-$(AUTOV8_VERSION) dependencies
env CXXFLAGS=-fPIC $(MAKE) -C build/v8-$(AUTOV8_VERSION) native
test -f $(AUTOV8_OUT)/libv8_base.a || \
ln -s $(abspath $(AUTOV8_OUT)/obj.target/tools/gyp/libv8_base.a) \
$(AUTOV8_OUT)/libv8_base.a
test -f $(AUTOV8_OUT)/libv8_snapshot.a || \
ln -s $(abspath $(AUTOV8_OUT)/obj.target/tools/gyp/libv8_snapshot.a) \
$(AUTOV8_OUT)/libv8_snapshot.a
include Makefile
CCFLAGS += -I$(AUTOV8_DIR)/include
# We're gonna build static link. Rip it out after include Makefile
SHLIB_LINK := $(filter-out -lv8, $(SHLIB_LINK))