|
| 1 | +# Copyright 2011 the V8 project authors. All rights reserved. |
| 2 | +# Redistribution and use in source and binary forms, with or without |
| 3 | +# modification, are permitted provided that the following conditions are |
| 4 | +# met: |
| 5 | +# |
| 6 | +# * Redistributions of source code must retain the above copyright |
| 7 | +# notice, this list of conditions and the following disclaimer. |
| 8 | +# * Redistributions in binary form must reproduce the above |
| 9 | +# copyright notice, this list of conditions and the following |
| 10 | +# disclaimer in the documentation and/or other materials provided |
| 11 | +# with the distribution. |
| 12 | +# * Neither the name of Google Inc. nor the names of its |
| 13 | +# contributors may be used to endorse or promote products derived |
| 14 | +# from this software without specific prior written permission. |
| 15 | +# |
| 16 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | + |
| 28 | + |
| 29 | +# Variable default definitions. Override them by exporting them in your shell. |
| 30 | +CXX ?= "g++" # For distcc: export CXX="distcc g++" |
| 31 | +LINK ?= "g++" |
| 32 | +OUTDIR ?= out |
| 33 | +TESTJOBS ?= -j16 |
| 34 | +GYPFLAGS ?= -Dv8_can_use_vfp_instructions=true |
| 35 | + |
| 36 | +# Architectures and modes to be compiled. |
| 37 | +ARCHES = ia32 x64 arm |
| 38 | +MODES = release debug |
| 39 | + |
| 40 | +# List of files that trigger Makefile regeneration: |
| 41 | +GYPFILES = build/all.gyp build/common.gypi build/v8-features.gypi \ |
| 42 | + preparser/preparser.gyp samples/samples.gyp src/d8.gyp \ |
| 43 | + test/cctest/cctest.gyp tools/gyp/v8.gyp |
| 44 | + |
| 45 | +# Generates all combinations of ARCHES and MODES, e.g. "ia32.release". |
| 46 | +BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES))) |
| 47 | +CHECKS = $(addsuffix .check,$(BUILDS)) |
| 48 | +# Generates corresponding test targets, e.g. "ia32.release.check". |
| 49 | + |
| 50 | +.PHONY: all release debug ia32 x64 arm $(BUILDS) |
| 51 | + |
| 52 | +# Target definitions. "all" is the default, you can specify any others on the |
| 53 | +# command line, e.g. "make ia32". Targets defined in $(BUILDS), e.g. |
| 54 | +# "ia32.debug", can also be specified. |
| 55 | +all: release debug |
| 56 | + |
| 57 | +release: $(addsuffix .release,$(ARCHES)) |
| 58 | + |
| 59 | +debug: $(addsuffix .debug,$(ARCHES)) |
| 60 | + |
| 61 | +ia32: $(addprefix ia32.,$(MODES)) |
| 62 | + |
| 63 | +x64: $(addprefix x64.,$(MODES)) |
| 64 | + |
| 65 | +arm: $(addprefix arm.,$(MODES)) |
| 66 | + |
| 67 | +.SECONDEXPANSION: |
| 68 | +$(BUILDS): $(OUTDIR)/Makefile-$$(basename $$@) |
| 69 | + @$(MAKE) -C "$(OUTDIR)" -f Makefile-$(basename $@) \ |
| 70 | + CXX="$(CXX)" LINK="$(LINK)" \ |
| 71 | + BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ |
| 72 | + python -c "print raw_input().capitalize()") \ |
| 73 | + builddir="$(shell pwd)/$(OUTDIR)/$@" |
| 74 | + |
| 75 | +# Test targets. |
| 76 | +check: all |
| 77 | + @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) |
| 78 | + |
| 79 | +$(addsuffix .check,$(MODES)): $$(basename $$@) |
| 80 | + @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) --mode=$(basename $@) |
| 81 | + |
| 82 | +$(addsuffix .check,$(ARCHES)): $$(basename $$@) |
| 83 | + @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) --arch=$(basename $@) |
| 84 | + |
| 85 | +$(CHECKS): $$(basename $$@) |
| 86 | + @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) --arch-and-mode=$(basename $@) |
| 87 | + |
| 88 | +# Clean targets. You can clean each architecture individually, or everything. |
| 89 | +$(addsuffix .clean,$(ARCHES)): |
| 90 | + rm -f $(OUTDIR)/Makefile-$(basename $@) |
| 91 | + rm -rf $(OUTDIR)/$(basename $@).release |
| 92 | + rm -rf $(OUTDIR)/$(basename $@).debug |
| 93 | + |
| 94 | +clean: $(addsuffix .clean,$(ARCHES)) |
| 95 | + |
| 96 | +# GYP file generation targets. |
| 97 | +$(OUTDIR)/Makefile-ia32: $(GYPFILES) |
| 98 | + build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
| 99 | + -Ibuild/common.gypi --depth=. -Dtarget_arch=ia32 -S-ia32 \ |
| 100 | + $(GYPFLAGS) |
| 101 | + |
| 102 | +$(OUTDIR)/Makefile-x64: $(GYPFILES) |
| 103 | + build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
| 104 | + -Ibuild/common.gypi --depth=. -Dtarget_arch=x64 -S-x64 \ |
| 105 | + $(GYPFLAGS) |
| 106 | + |
| 107 | +$(OUTDIR)/Makefile-arm: $(GYPFILES) build/armu.gypi |
| 108 | + build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
| 109 | + -Ibuild/common.gypi --depth=. -Ibuild/armu.gypi -S-arm \ |
| 110 | + $(GYPFLAGS) |
0 commit comments