-
Notifications
You must be signed in to change notification settings - Fork 238
/
Makefile
160 lines (134 loc) · 5.17 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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
V8_HOME ?= /home/danielbevenius/work/google/v8_src/v8
v8_out_dir := learning_v8
v8_build_dir := $(V8_HOME)/out/$(v8_out_dir)
v8_include_dir := $(V8_HOME)/include
v8_src_dir := $(V8_HOME)/src
v8_gen_dir := $(v8_build_dir)/gen
v8_dylibs := -lv8 -lv8_libplatform -lv8_libbase
objs := $(filter-out test/main,$(patsubst %.cc, %, $(wildcard test/*.cc)))
gtest_home := $(CURDIR)/deps/googletest/googletest
v8_gn_args = \
v8_monolithic=false \
v8_static_library=false \
use_custom_libcxx=false \
is_component_build=true \
treat_warnings_as_errors=false \
is_debug=true \
is_clang=false \
target_cpu="x64" \
use_goma=false \
use_gold=false \
goma_dir="None" \
v8_enable_backtrace=true \
v8_enable_disassembler=true \
v8_enable_object_print=true \
v8_enable_verify_heap=true \
v8_use_external_startup_data=false \
v8_enable_i18n_support=true \
v8_expose_symbols=true \
v8_enable_gdbjit=true \
v8_optimized_debug=false \
v8_enable_debugging_features=true \
v8_enable_fast_torque=false \
v8_enable_fast_mksnapshot=false \
is_asan = false
.PHONY: configure_v8
configure_v8:
cd $(V8_HOME) && gn gen out/$(v8_out_dir) --args='$(v8_gn_args)'
.PHONY: compile_v8
compile_v8:
cd $(V8_HOME) && ninja -C out/$(v8_out_dir)
CXXFLAGS = -Wall -g -O0 -std=c++14 -Wcast-function-type \
-fno-exceptions -fno-rtti \
-DV8_COMPRESS_POINTERS \
-I$(v8_include_dir) \
-I$(V8_HOME) \
-I$(v8_build_dir)/gen \
-L$(v8_build_dir) \
$(v8_dylibs) \
-Wl,-L$(v8_build_dir) -Wl,-rpath,$(v8_build_dir) -Wl,-lpthread
hello-world: hello-world.cc
$(CXX) ${CXXFLAGS} [email protected] -o $@
.PHONY: gtest-compile
gtest-compile: CXXFLAGS = --verbose -Wall -O0 -g -c $(gtest_home)/src/gtest-all.cc \
-o $(gtest_home)/gtest-all.o -std=c++14 \
-fno-exceptions -fno-rtti \
-I$(gtest_home) \
-I$(gtest_home)/include
gtest-compile:
${info Building gtest library}
$(CXX) ${CXXFLAGS} [email protected] -o $@
@mkdir -p $(CURDIR)/lib/gtest
${AR} -rv $(CURDIR)/lib/gtest/libgtest.a $(gtest_home)/gtest-all.o
.PHONY: gdb-hello
gdb-hello:
@LD_LIBRARY_PATH=$(v8_build_dir)/ gdb --cd=$(v8_build_dir) --args $(CURDIR)/hello-world
instances: snapshot_blob.bin instances.cc
$(CXX) ${CXXFLAGS} [email protected] -o $@
run-script: run-script.cc
$(CXX) ${CXXFLAGS} [email protected] -o $@
exceptions: snapshot_blob.bin exceptions.cc
$(CXX) ${CXXFLAGS} [email protected] -o $@
snapshot_blob.bin: $(v8_build_dir)/$@
@cp $(v8_build_dir)/$@ .
test/backingstore_test: CXXFLAGS += "-fsanitize=address"
test/%: CXXFLAGS += test/main.cc [email protected] -o $@ ./lib/gtest/libgtest.a \
-Wcast-function-type -Wno-unused-variable \
-Wno-class-memaccess -Wno-comment -Wno-unused-but-set-variable \
-DV8_INTL_SUPPORT \
-DDEBUG \
-I$(V8_HOME)/third_party/icu/source/common/ \
-I./deps/googletest/googletest/include \
-Wl,-lstdc++
test/%: test/%.cc test/v8_test_fixture.h
$(CXX) ${CXXFLAGS}
backingstore-asn: test/backingstore_test
test/isolate_test: obj_files:="${v8_build_dir}/obj/v8_base_without_compiler/snapshot.o"
test/map_test: obj_files:="${v8_build_dir}/obj/v8_base_without_compiler/map.o"
test/builtins_test: obj_files:="${v8_build_dir}/obj/v8_base_without_compiler/builtins.o ${v8_build_dir}/obj/v8_base_without_compiler/code.o"
test/map_test test/builtins_test test/isolate_test: test/map_test.cc test/builtins_test.cc test/isolate_test.cc
${CXX} -Wall -g -O0 test/main.cc $(subst ", ,${obj_files}) [email protected] -o $@ \
./lib/gtest/libgtest.a -std=c++14 \
-fno-exceptions -fno-rtti -Wcast-function-type -Wno-unused-variable \
-Wno-class-memaccess -Wno-comment -Wno-unused-but-set-variable \
-DV8_INTL_SUPPORT \
-DV8_COMPRESS_POINTERS \
-I$(v8_include_dir) \
-I$(V8_HOME) \
-I$(V8_HOME)/third_party/icu/source/common/ \
-I$(v8_build_dir)/gen \
-L$(v8_build_dir) \
-I./deps/googletest/googletest/include \
$(v8_dylibs) \
-Wl,-L$(v8_build_dir) -Wl,-rpath,$(v8_build_dir) -Wl,-L/usr/lib64 -Wl,-lstdc++ -Wl,-lpthread
V8_TORQUE_BUILTINS_FILES:=$(addprefix src/builtins/,$(notdir $(wildcard $(V8_HOME)/src/builtins/*.tq)))
V8_TORQUE_OBJECTS_FILES:=$(addprefix src/objects/,$(notdir $(wildcard $(V8_HOME)/src/objects/*.tq)))
V8_TORQUE_WASM_FILES:=$(addprefix src/wasm/,$(notdir $(wildcard $(V8_HOME)/src/wasm/*.tq)))
V8_TORQUE_TP_FILES:=$(addprefix src/third_party/,$(notdir $(wildcard $(V8_HOME)/src/third_party/*.tq)))
V8_TORQUE_TEST_FILES:=$(addprefix test/torque/,$(notdir $(wildcard $(V8_HOME)/test/torque/*.tq)))
torque-example: torque-example.tq
@mkdir -p gen/torque-generated
$(info Generating Torque files in gen/torque-generated)
@cp $< $(V8_HOME)
@$(v8_build_dir)/torque -o gen/torque-generated -v8-root $(V8_HOME) \
$(V8_TORQUE_BUILTINS_FILES) \
$(V8_TORQUE_OBJECTS_FILES) \
$(V8_TORQUE_WASM_FILES) \
$(V8_TORQUE_TP_FILES) \
$(V8_TORQUE_TEST_FILES) \
$<
@${RM} $(V8_HOME)/$<
.PHONY: all
all: snapshot_blob.bin $(objs)
.PHONY: check-all test-all test
check-all test-all test:
@for test in $(objs) ; do \
"$${test}" ; \
done
src/backing-store-org: src/backing-store-original.cc
g++ -g -fsanitize=address -o $@ $<
src/backing-store-new: src/backing-store-new.cc
g++ -g -fsanitize=address -o $@ $<
.PHONY: clean
clean:
@${RM} $(objs) hello-world