#-----------------------------------------------------------------------------# # # 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 = 5.4.500.43 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_snapshot.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_LIB): $(AUTOV8_DIR) env CXXFLAGS=-fPIC CFLAGS=-fPIC $(MAKE) -C build/v8-git-mirror-$(AUTOV8_VERSION) native 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