-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile.v8
79 lines (68 loc) · 2.97 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
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
#-----------------------------------------------------------------------------#
#
# 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 = 6.0.283
AUTOV8_DIR = build/v8-git-mirror-$(AUTOV8_VERSION)
AUTOV8_OUT = build/v8-git-mirror-$(AUTOV8_VERSION)/out/native
AUTOV8_DEPOT_TOOLS = build/depot_tools
AUTOV8_LIB = $(AUTOV8_OUT)/libv8_nosnapshot.a
AUTOV8_STATIC_LIBS = libv8_base.a libv8_nosnapshot.a libv8_libplatform.a libv8_libbase.a libv8_libsampler.a libicui18n.a libicuuc.a
export PATH := $(abspath $(AUTOV8_DEPOT_TOOLS)):$(PATH)
SHLIB_LINK += $(addprefix $(AUTOV8_OUT)/, $(AUTOV8_STATIC_LIBS))
all: $(AUTOV8_LIB)
# For some reason, this solves parallel make dependency.
plv8_config.h plv8.so: $(AUTOV8_LIB)
$(AUTOV8_DEPOT_TOOLS):
mkdir -p build
cd build; git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
$(AUTOV8_DIR): $(AUTOV8_DEPOT_TOOLS)
cd build; fetch v8; cd v8; git checkout $(AUTOV8_VERSION); gclient sync
mv build/v8 $(AUTOV8_DIR)
$(AUTOV8_OUT)/third_party/icu/common/icudtb.dat:
$(AUTOV8_OUT)/third_party/icu/common/icudtl.dat:
$(AUTOV8_LIB): $(AUTOV8_DIR)
env CXXFLAGS=-fPIC CFLAGS=-fPIC $(MAKE) -C build/v8-git-mirror-$(AUTOV8_VERSION) native snapshot=off
test -f $(AUTOV8_OUT)/libv8_base.a || \
ln -s $(abspath $(AUTOV8_OUT)/obj.target/src/libv8_base.a) \
$(AUTOV8_OUT)/libv8_base.a
test -f $(AUTOV8_OUT)/libv8_nosnapshot.a || \
ln -s $(abspath $(AUTOV8_OUT)/obj.target/src/libv8_nosnapshot.a) \
$(AUTOV8_OUT)/libv8_nosnapshot.a
test -f $(AUTOV8_OUT)/libv8_libbase.a || \
ln -s $(abspath $(AUTOV8_OUT)/obj.target/src/libv8_libbase.a) \
$(AUTOV8_OUT)/libv8_libbase.a
test -f $(AUTOV8_OUT)/libv8_libplatform.a || \
ln -s $(abspath $(AUTOV8_OUT)/obj.target/src/libv8_libplatform.a) \
$(AUTOV8_OUT)/libv8_libplatform.a
test -f $(AUTOV8_OUT)/libv8_libsampler.a || \
ln -s $(abspath $(AUTOV8_OUT)/obj.target/src/libv8_libsampler.a) \
$(AUTOV8_OUT)/libv8_libsampler.a
test -f $(AUTOV8_OUT)/libicui18n.a || \
ln -s $(abspath $(AUTOV8_OUT)/obj.target/third_party/icu/libicui18n.a) \
$(AUTOV8_OUT)/libicui18n.a
test -f $(AUTOV8_OUT)/libicuuc.a || \
ln -s $(abspath $(AUTOV8_OUT)/obj.target/third_party/icu/libicuuc.a) \
$(AUTOV8_OUT)/libicuuc.a
include Makefile
CCFLAGS += -I$(AUTOV8_DIR)/include -I$(AUTOV8_DIR)
# We're gonna build static link. Rip it out after include Makefile
SHLIB_LINK := $(filter-out -lv8, $(SHLIB_LINK))
ifeq ($(OS),Windows_NT)
# noop for now
else
SHLIB_LINK += -L$(AUTOV8_OUT)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
CCFLAGS += -stdlib=libc++ -std=c++11
SHLIB_LINK += -stdlib=libc++
endif
ifeq ($(UNAME_S),Linux)
SHLIB_LINK += -lrt
endif
endif