2011-08-05 09:44:30 +00:00
|
|
|
# Copyright 2011 the V8 project authors. All rights reserved.
|
|
|
|
# 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.
|
|
|
|
CXX ?= "g++" # For distcc: export CXX="distcc g++"
|
|
|
|
LINK ?= "g++"
|
|
|
|
OUTDIR ?= out
|
|
|
|
TESTJOBS ?= -j16
|
2011-08-26 11:23:51 +00:00
|
|
|
GYPFLAGS ?=
|
|
|
|
|
|
|
|
# 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
|
|
|
|
# snapshot=off
|
|
|
|
ifeq ($(snapshot), off)
|
|
|
|
GYPFLAGS += -Dv8_use_snapshot='false'
|
|
|
|
endif
|
|
|
|
# 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)
|
|
|
|
GYPFLAGS += -Dv8_can_use_vfp_instructions=false
|
|
|
|
else
|
|
|
|
GYPFLAGS += -Dv8_can_use_vfp_instructions=true
|
|
|
|
endif
|
|
|
|
|
|
|
|
# ----------------- available targets: --------------------
|
2011-09-07 13:48:29 +00:00
|
|
|
# - "dependencies": pulls in external dependencies (currently: GYP)
|
2011-08-26 11:23:51 +00:00
|
|
|
# - any arch listed in ARCHES (see below)
|
|
|
|
# - any mode listed in MODES
|
|
|
|
# - every combination <arch>.<mode>, e.g. "ia32.release"
|
|
|
|
# - any of the above with .check appended, e.g. "ia32.release.check"
|
|
|
|
# - default (no target specified): build all ARCHES and MODES
|
|
|
|
# - "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).
|
2011-08-05 09:44:30 +00:00
|
|
|
ARCHES = ia32 x64 arm
|
|
|
|
MODES = release debug
|
|
|
|
|
|
|
|
# List of files that trigger Makefile regeneration:
|
2011-08-25 14:50:09 +00:00
|
|
|
GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \
|
2011-08-05 09:44:30 +00: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)))
|
|
|
|
# Generates corresponding test targets, e.g. "ia32.release.check".
|
2011-08-26 11:23:51 +00:00
|
|
|
CHECKS = $(addsuffix .check,$(BUILDS))
|
|
|
|
# File where previously used GYPFLAGS are stored.
|
|
|
|
ENVFILE = $(OUTDIR)/environment
|
2011-08-05 09:44:30 +00:00
|
|
|
|
2011-09-07 13:48:29 +00:00
|
|
|
.PHONY: all check clean dependencies $(ENVFILE).new \
|
2011-08-31 13:01:28 +00:00
|
|
|
$(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \
|
|
|
|
$(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES))
|
2011-08-05 09:44:30 +00:00
|
|
|
|
2011-08-26 11:23:51 +00:00
|
|
|
# Target definitions. "all" is the default.
|
|
|
|
all: $(MODES)
|
2011-08-05 09:44:30 +00:00
|
|
|
|
2011-08-26 11:23:51 +00:00
|
|
|
# Compile targets. MODES and ARCHES are convenience targets.
|
|
|
|
.SECONDEXPANSION:
|
|
|
|
$(MODES): $(addsuffix .$$@,$(ARCHES))
|
2011-08-05 09:44:30 +00:00
|
|
|
|
2011-08-26 11:23:51 +00:00
|
|
|
$(ARCHES): $(addprefix $$@.,$(MODES))
|
2011-08-05 09:44:30 +00:00
|
|
|
|
2011-08-26 11:23:51 +00:00
|
|
|
# Defines how to build a particular target (e.g. ia32.release).
|
2011-08-05 09:44:30 +00:00
|
|
|
$(BUILDS): $(OUTDIR)/Makefile-$$(basename $$@)
|
|
|
|
@$(MAKE) -C "$(OUTDIR)" -f Makefile-$(basename $@) \
|
|
|
|
CXX="$(CXX)" LINK="$(LINK)" \
|
|
|
|
BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
|
|
|
|
python -c "print raw_input().capitalize()") \
|
|
|
|
builddir="$(shell pwd)/$(OUTDIR)/$@"
|
|
|
|
|
|
|
|
# Test targets.
|
|
|
|
check: all
|
2011-08-10 11:07:31 +00:00
|
|
|
@tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR)
|
2011-08-05 09:44:30 +00:00
|
|
|
|
2011-08-10 11:07:31 +00:00
|
|
|
$(addsuffix .check,$(MODES)): $$(basename $$@)
|
2011-08-26 11:23:51 +00:00
|
|
|
@tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \
|
|
|
|
--mode=$(basename $@)
|
2011-08-05 09:44:30 +00:00
|
|
|
|
|
|
|
$(addsuffix .check,$(ARCHES)): $$(basename $$@)
|
2011-08-26 11:23:51 +00:00
|
|
|
@tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \
|
|
|
|
--arch=$(basename $@)
|
2011-08-05 09:44:30 +00:00
|
|
|
|
|
|
|
$(CHECKS): $$(basename $$@)
|
2011-08-26 11:23:51 +00:00
|
|
|
@tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \
|
|
|
|
--arch-and-mode=$(basename $@)
|
2011-08-05 09:44:30 +00:00
|
|
|
|
|
|
|
# Clean targets. You can clean each architecture individually, or everything.
|
|
|
|
$(addsuffix .clean,$(ARCHES)):
|
|
|
|
rm -f $(OUTDIR)/Makefile-$(basename $@)
|
|
|
|
rm -rf $(OUTDIR)/$(basename $@).release
|
|
|
|
rm -rf $(OUTDIR)/$(basename $@).debug
|
2011-08-25 14:50:09 +00:00
|
|
|
find $(OUTDIR) -regex '.*\(host\|target\)-$(basename $@)\.mk' -delete
|
2011-08-05 09:44:30 +00:00
|
|
|
|
|
|
|
clean: $(addsuffix .clean,$(ARCHES))
|
|
|
|
|
|
|
|
# GYP file generation targets.
|
2011-08-26 11:23:51 +00:00
|
|
|
$(OUTDIR)/Makefile-ia32: $(GYPFILES) $(ENVFILE)
|
2011-08-05 09:44:30 +00:00
|
|
|
build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
|
2011-08-26 11:23:51 +00:00
|
|
|
-Ibuild/standalone.gypi --depth=. -Dtarget_arch=ia32 \
|
|
|
|
-S-ia32 $(GYPFLAGS)
|
2011-08-05 09:44:30 +00:00
|
|
|
|
2011-08-26 11:23:51 +00:00
|
|
|
$(OUTDIR)/Makefile-x64: $(GYPFILES) $(ENVFILE)
|
2011-08-05 09:44:30 +00:00
|
|
|
build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
|
2011-08-26 11:23:51 +00:00
|
|
|
-Ibuild/standalone.gypi --depth=. -Dtarget_arch=x64 \
|
|
|
|
-S-x64 $(GYPFLAGS)
|
2011-08-05 09:44:30 +00:00
|
|
|
|
2011-08-26 11:23:51 +00:00
|
|
|
$(OUTDIR)/Makefile-arm: $(GYPFILES) $(ENVFILE)
|
2011-08-05 09:44:30 +00:00
|
|
|
build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
|
2011-08-26 11:23:51 +00:00
|
|
|
-Ibuild/standalone.gypi --depth=. -Ibuild/armu.gypi \
|
|
|
|
-S-arm $(GYPFLAGS)
|
|
|
|
|
|
|
|
# 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:
|
|
|
|
@mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS)" > $(ENVFILE).new;
|
2011-09-07 13:48:29 +00:00
|
|
|
|
|
|
|
# Dependencies.
|
|
|
|
dependencies:
|
|
|
|
svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \
|
|
|
|
--revision 1026
|