node/deps/v8/Makefile

291 lines
10 KiB
Makefile
Raw Normal View History

2012-01-24 08:16:42 +08:00
# Copyright 2012 the V8 project authors. All rights reserved.
2011-08-12 14:59:21 +08:00
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Variable default definitions. Override them by exporting them in your shell.
2011-12-06 08:29:01 +08:00
CXX ?= g++
LINK ?= g++
2011-08-12 14:59:21 +08:00
OUTDIR ?= out
2013-01-01 16:28:07 +08:00
TESTJOBS ?=
2011-08-30 06:29:35 +08:00
GYPFLAGS ?=
2011-12-06 08:29:01 +08:00
TESTFLAGS ?=
2012-01-24 08:16:42 +08:00
ANDROID_NDK_ROOT ?=
2012-09-19 06:20:38 +08:00
ANDROID_TOOLCHAIN ?=
ANDROID_V8 ?= /data/local/v8
2011-08-30 06:29:35 +08:00
# Special build flags. Use them like this: "make library=shared"
# library=shared || component=shared_library
ifeq ($(library), shared)
GYPFLAGS += -Dcomponent=shared_library
endif
ifdef component
GYPFLAGS += -Dcomponent=$(component)
endif
# console=readline
ifdef console
GYPFLAGS += -Dconsole=$(console)
endif
# disassembler=on
ifeq ($(disassembler), on)
GYPFLAGS += -Dv8_enable_disassembler=1
endif
2011-12-06 08:29:01 +08:00
# objectprint=on
ifeq ($(objectprint), on)
GYPFLAGS += -Dv8_object_print=1
endif
2013-01-01 16:28:07 +08:00
# verifyheap=on
ifeq ($(verifyheap), on)
GYPFLAGS += -Dv8_enable_verify_heap=1
endif
2011-08-30 06:29:35 +08:00
# snapshot=off
ifeq ($(snapshot), off)
GYPFLAGS += -Dv8_use_snapshot='false'
endif
2012-09-19 06:20:38 +08:00
# extrachecks=on/off
ifeq ($(extrachecks), on)
GYPFLAGS += -Dv8_enable_extra_checks=1
endif
ifeq ($(extrachecks), off)
GYPFLAGS += -Dv8_enable_extra_checks=0
endif
2011-08-30 06:29:35 +08:00
# gdbjit=on
ifeq ($(gdbjit), on)
GYPFLAGS += -Dv8_enable_gdbjit=1
endif
# liveobjectlist=on
ifeq ($(liveobjectlist), on)
GYPFLAGS += -Dv8_use_liveobjectlist=true
endif
# vfp3=off
ifeq ($(vfp3), off)
2013-01-01 16:28:07 +08:00
GYPFLAGS += -Dv8_can_use_vfp3_instructions=false
2011-08-30 06:29:35 +08:00
else
2013-01-01 16:28:07 +08:00
GYPFLAGS += -Dv8_can_use_vfp3_instructions=true
2011-08-30 06:29:35 +08:00
endif
2012-03-13 12:46:36 +08:00
# debuggersupport=off
ifeq ($(debuggersupport), off)
GYPFLAGS += -Dv8_enable_debugger_support=0
endif
2011-09-09 07:03:35 +08:00
# soname_version=1.2.3
ifdef soname_version
GYPFLAGS += -Dsoname_version=$(soname_version)
endif
2011-12-06 08:29:01 +08:00
# werror=no
ifeq ($(werror), no)
GYPFLAGS += -Dwerror=''
endif
# presubmit=no
ifeq ($(presubmit), no)
TESTFLAGS += --no-presubmit
endif
2012-01-24 08:16:42 +08:00
# strictaliasing=off (workaround for GCC-4.5)
ifeq ($(strictaliasing), off)
GYPFLAGS += -Dv8_no_strict_aliasing=1
endif
2012-09-19 06:20:38 +08:00
# regexp=interpreted
ifeq ($(regexp), interpreted)
GYPFLAGS += -Dv8_interpreted_regexp=1
endif
# hardfp=on
ifeq ($(hardfp), on)
GYPFLAGS += -Dv8_use_arm_eabi_hardfloat=true
endif
2011-08-30 06:29:35 +08:00
# ----------------- available targets: --------------------
2011-09-09 07:03:35 +08:00
# - "dependencies": pulls in external dependencies (currently: GYP)
2011-08-30 06:29:35 +08:00
# - any arch listed in ARCHES (see below)
# - any mode listed in MODES
# - every combination <arch>.<mode>, e.g. "ia32.release"
2011-12-06 08:29:01 +08:00
# - "native": current host's architecture, release mode
2011-08-30 06:29:35 +08:00
# - any of the above with .check appended, e.g. "ia32.release.check"
2012-09-19 06:20:38 +08:00
# - "android": cross-compile for Android/ARM
2011-12-06 08:29:01 +08:00
# - default (no target specified): build all DEFAULT_ARCHES and MODES
2011-08-30 06:29:35 +08:00
# - "check": build all targets and run all tests
# - "<arch>.clean" for any <arch> in ARCHES
# - "clean": clean all ARCHES
# ----------------- internal stuff ------------------------
# Architectures and modes to be compiled. Consider these to be internal
# variables, don't override them (use the targets instead).
2012-09-19 06:20:38 +08:00
ARCHES = ia32 x64 arm mipsel
2011-12-06 08:29:01 +08:00
DEFAULT_ARCHES = ia32 x64 arm
2011-08-12 14:59:21 +08:00
MODES = release debug
2012-09-19 06:20:38 +08:00
ANDROID_ARCHES = android_ia32 android_arm
2011-08-12 14:59:21 +08:00
# List of files that trigger Makefile regeneration:
2011-08-30 06:29:35 +08:00
GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \
2011-08-12 14:59:21 +08:00
preparser/preparser.gyp samples/samples.gyp src/d8.gyp \
test/cctest/cctest.gyp tools/gyp/v8.gyp
# Generates all combinations of ARCHES and MODES, e.g. "ia32.release".
BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES)))
2012-09-19 06:20:38 +08:00
ANDROID_BUILDS = $(foreach mode,$(MODES), \
$(addsuffix .$(mode),$(ANDROID_ARCHES)))
2011-08-12 14:59:21 +08:00
# Generates corresponding test targets, e.g. "ia32.release.check".
2011-08-30 06:29:35 +08:00
CHECKS = $(addsuffix .check,$(BUILDS))
2012-09-19 06:20:38 +08:00
ANDROID_CHECKS = $(addsuffix .check,$(ANDROID_BUILDS))
2011-08-30 06:29:35 +08:00
# File where previously used GYPFLAGS are stored.
ENVFILE = $(OUTDIR)/environment
2011-08-12 14:59:21 +08:00
2011-12-06 08:29:01 +08:00
.PHONY: all check clean dependencies $(ENVFILE).new native \
2011-09-08 10:22:41 +08:00
$(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \
2012-01-24 08:16:42 +08:00
$(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \
2012-09-19 06:20:38 +08:00
$(ANDROID_ARCHES) $(ANDROID_BUILDS) $(ANDROID_CHECKS) \
must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN
2011-08-12 14:59:21 +08:00
2011-08-30 06:29:35 +08:00
# Target definitions. "all" is the default.
all: $(MODES)
2011-08-12 14:59:21 +08:00
2012-06-09 23:09:42 +08:00
# Special target for the buildbots to use. Depends on $(OUTDIR)/Makefile
# having been created before.
buildbot:
$(MAKE) -C "$(OUTDIR)" BUILDTYPE=$(BUILDTYPE) \
builddir="$(abspath $(OUTDIR))/$(BUILDTYPE)"
2012-09-19 06:20:38 +08:00
mips mips.release mips.debug:
@echo "V8 does not support big-endian MIPS builds at the moment," \
"please use little-endian builds (mipsel)."
2011-08-30 06:29:35 +08:00
# Compile targets. MODES and ARCHES are convenience targets.
.SECONDEXPANSION:
2011-12-06 08:29:01 +08:00
$(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES))
2011-08-12 14:59:21 +08:00
2011-08-30 06:29:35 +08:00
$(ARCHES): $(addprefix $$@.,$(MODES))
2011-08-12 14:59:21 +08:00
2011-08-30 06:29:35 +08:00
# Defines how to build a particular target (e.g. ia32.release).
2012-06-13 21:34:45 +08:00
$(BUILDS): $(OUTDIR)/Makefile.$$(basename $$@)
@$(MAKE) -C "$(OUTDIR)" -f Makefile.$(basename $@) \
2011-08-12 14:59:21 +08:00
CXX="$(CXX)" LINK="$(LINK)" \
BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
2013-01-01 16:28:07 +08:00
python -c "print raw_input().capitalize()") \
2011-08-12 14:59:21 +08:00
builddir="$(shell pwd)/$(OUTDIR)/$@"
2012-06-13 21:34:45 +08:00
native: $(OUTDIR)/Makefile.native
@$(MAKE) -C "$(OUTDIR)" -f Makefile.native \
2011-12-06 08:29:01 +08:00
CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \
builddir="$(shell pwd)/$(OUTDIR)/$@"
2012-09-19 06:20:38 +08:00
$(ANDROID_ARCHES): $(addprefix $$@.,$(MODES))
$(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) build/android.gypi \
must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN Makefile.android
@$(MAKE) -f Makefile.android $@ \
ARCH="$(basename $@)" \
MODE="$(subst .,,$(suffix $@))" \
OUTDIR="$(OUTDIR)" \
GYPFLAGS="$(GYPFLAGS)"
2012-01-24 08:16:42 +08:00
2011-08-12 14:59:21 +08:00
# Test targets.
check: all
2013-01-01 16:28:07 +08:00
@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
2011-12-06 08:29:01 +08:00
--arch=$(shell echo $(DEFAULT_ARCHES) | sed -e 's/ /,/g') \
$(TESTFLAGS)
2011-08-12 14:59:21 +08:00
$(addsuffix .check,$(MODES)): $$(basename $$@)
2013-01-01 16:28:07 +08:00
@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
2011-12-06 08:29:01 +08:00
--mode=$(basename $@) $(TESTFLAGS)
2011-08-12 14:59:21 +08:00
$(addsuffix .check,$(ARCHES)): $$(basename $$@)
2013-01-01 16:28:07 +08:00
@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
2011-12-06 08:29:01 +08:00
--arch=$(basename $@) $(TESTFLAGS)
2011-08-12 14:59:21 +08:00
$(CHECKS): $$(basename $$@)
2013-01-01 16:28:07 +08:00
@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
2011-12-06 08:29:01 +08:00
--arch-and-mode=$(basename $@) $(TESTFLAGS)
2012-09-19 06:20:38 +08:00
$(addsuffix .sync, $(ANDROID_BUILDS)): $$(basename $$@)
@tools/android-sync.sh $(basename $@) $(OUTDIR) \
$(shell pwd) $(ANDROID_V8)
$(addsuffix .check, $(ANDROID_BUILDS)): $$(basename $$@).sync
2013-01-01 16:28:07 +08:00
@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
2012-09-19 06:20:38 +08:00
--arch-and-mode=$(basename $@) \
--timeout=600 \
2013-01-01 16:28:07 +08:00
--command-prefix="tools/android-run.py"
2012-09-19 06:20:38 +08:00
$(addsuffix .check, $(ANDROID_ARCHES)): \
$(addprefix $$(basename $$@).,$(MODES)).check
2011-12-06 08:29:01 +08:00
native.check: native
2013-01-01 16:28:07 +08:00
@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR)/native \
2011-12-06 08:29:01 +08:00
--arch-and-mode=. $(TESTFLAGS)
2011-08-12 14:59:21 +08:00
# Clean targets. You can clean each architecture individually, or everything.
2012-09-19 06:20:38 +08:00
$(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)):
2012-06-13 21:34:45 +08:00
rm -f $(OUTDIR)/Makefile.$(basename $@)
2011-08-12 14:59:21 +08:00
rm -rf $(OUTDIR)/$(basename $@).release
rm -rf $(OUTDIR)/$(basename $@).debug
2012-06-13 21:34:45 +08:00
find $(OUTDIR) -regex '.*\(host\|target\).$(basename $@)\.mk' -delete
2011-08-12 14:59:21 +08:00
2011-12-06 08:29:01 +08:00
native.clean:
2012-06-13 21:34:45 +08:00
rm -f $(OUTDIR)/Makefile.native
2011-12-06 08:29:01 +08:00
rm -rf $(OUTDIR)/native
2012-06-13 21:34:45 +08:00
find $(OUTDIR) -regex '.*\(host\|target\).native\.mk' -delete
2012-06-09 23:09:42 +08:00
2012-09-19 06:20:38 +08:00
clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)) native.clean
2011-08-12 14:59:21 +08:00
# GYP file generation targets.
2012-09-19 06:20:38 +08:00
OUT_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ARCHES))
$(OUT_MAKEFILES): $(GYPFILES) $(ENVFILE)
2012-06-13 21:34:45 +08:00
GYP_GENERATORS=make \
2013-01-01 16:28:07 +08:00
build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
2012-06-13 21:34:45 +08:00
-Ibuild/standalone.gypi --depth=. \
-Dv8_target_arch=$(subst .,,$(suffix $@)) \
-S.$(subst .,,$(suffix $@)) $(GYPFLAGS)
2011-12-06 08:29:01 +08:00
2012-06-13 21:34:45 +08:00
$(OUTDIR)/Makefile.native: $(GYPFILES) $(ENVFILE)
GYP_GENERATORS=make \
2013-01-01 16:28:07 +08:00
build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
2012-06-13 21:34:45 +08:00
-Ibuild/standalone.gypi --depth=. -S.native $(GYPFLAGS)
2011-12-06 08:29:01 +08:00
2012-09-19 06:20:38 +08:00
must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN:
2012-01-24 08:16:42 +08:00
ifndef ANDROID_NDK_ROOT
2012-09-19 06:20:38 +08:00
ifndef ANDROID_TOOLCHAIN
$(error ANDROID_NDK_ROOT or ANDROID_TOOLCHAIN must be set))
endif
2012-01-24 08:16:42 +08:00
endif
2011-08-30 06:29:35 +08:00
# Replaces the old with the new environment file if they're different, which
# will trigger GYP to regenerate Makefiles.
$(ENVFILE): $(ENVFILE).new
@if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) >/dev/null; \
then rm $(ENVFILE).new; \
else mv $(ENVFILE).new $(ENVFILE); fi
# Stores current GYPFLAGS in a file.
$(ENVFILE).new:
2012-06-13 21:34:45 +08:00
@mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS)" > $(ENVFILE).new; \
echo "CXX=$(CXX)" >> $(ENVFILE).new
2011-09-09 07:03:35 +08:00
# Dependencies.
2013-01-01 16:28:07 +08:00
# Remember to keep these in sync with the DEPS file.
2011-09-09 07:03:35 +08:00
dependencies:
svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \
2013-01-01 16:28:07 +08:00
--revision 1501