OLD | NEW |
1 # Copyright 2011 the V8 project authors. All rights reserved. | 1 # Copyright 2011 the V8 project authors. All rights reserved. |
2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
4 # met: | 4 # met: |
5 # | 5 # |
6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
(...skipping 13 matching lines...) Expand all Loading... |
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 | 28 |
29 # Variable default definitions. Override them by exporting them in your shell. | 29 # Variable default definitions. Override them by exporting them in your shell. |
30 CXX ?= "g++" # For distcc: export CXX="distcc g++" | 30 CXX ?= "g++" # For distcc: export CXX="distcc g++" |
31 LINK ?= "g++" | 31 LINK ?= "g++" |
32 OUTDIR ?= out | 32 OUTDIR ?= out |
33 TESTJOBS ?= -j16 | 33 TESTJOBS ?= -j16 |
34 GYPFLAGS ?= -Dv8_can_use_vfp_instructions=true | 34 GYPFLAGS ?= |
35 | 35 |
36 # Architectures and modes to be compiled. | 36 # Special build flags. Use them like this: "make library=shared" |
| 37 |
| 38 # library=shared || component=shared_library |
| 39 ifeq ($(library), shared) |
| 40 GYPFLAGS += -Dcomponent=shared_library |
| 41 endif |
| 42 ifdef component |
| 43 GYPFLAGS += -Dcomponent=$(component) |
| 44 endif |
| 45 # console=readline |
| 46 ifdef console |
| 47 GYPFLAGS += -Dconsole=$(console) |
| 48 endif |
| 49 # disassembler=on |
| 50 ifeq ($(disassembler), on) |
| 51 GYPFLAGS += -Dv8_enable_disassembler=1 |
| 52 endif |
| 53 # snapshot=off |
| 54 ifeq ($(snapshot), off) |
| 55 GYPFLAGS += -Dv8_use_snapshot='false' |
| 56 endif |
| 57 # gdbjit=on |
| 58 ifeq ($(gdbjit), on) |
| 59 GYPFLAGS += -Dv8_enable_gdbjit=1 |
| 60 endif |
| 61 # liveobjectlist=on |
| 62 ifeq ($(liveobjectlist), on) |
| 63 GYPFLAGS += -Dv8_use_liveobjectlist=true |
| 64 endif |
| 65 # vfp3=off |
| 66 ifeq ($(vfp3), off) |
| 67 GYPFLAGS += -Dv8_can_use_vfp_instructions=false |
| 68 else |
| 69 GYPFLAGS += -Dv8_can_use_vfp_instructions=true |
| 70 endif |
| 71 |
| 72 # ----------------- available targets: -------------------- |
| 73 # - any arch listed in ARCHES (see below) |
| 74 # - any mode listed in MODES |
| 75 # - every combination <arch>.<mode>, e.g. "ia32.release" |
| 76 # - any of the above with .check appended, e.g. "ia32.release.check" |
| 77 # - default (no target specified): build all ARCHES and MODES |
| 78 # - "check": build all targets and run all tests |
| 79 # - "<arch>.clean" for any <arch> in ARCHES |
| 80 # - "clean": clean all ARCHES |
| 81 |
| 82 # ----------------- internal stuff ------------------------ |
| 83 |
| 84 # Architectures and modes to be compiled. Consider these to be internal |
| 85 # variables, don't override them (use the targets instead). |
37 ARCHES = ia32 x64 arm | 86 ARCHES = ia32 x64 arm |
38 MODES = release debug | 87 MODES = release debug |
39 | 88 |
40 # List of files that trigger Makefile regeneration: | 89 # List of files that trigger Makefile regeneration: |
41 GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \ | 90 GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \ |
42 preparser/preparser.gyp samples/samples.gyp src/d8.gyp \ | 91 preparser/preparser.gyp samples/samples.gyp src/d8.gyp \ |
43 test/cctest/cctest.gyp tools/gyp/v8.gyp | 92 test/cctest/cctest.gyp tools/gyp/v8.gyp |
44 | 93 |
45 # Generates all combinations of ARCHES and MODES, e.g. "ia32.release". | 94 # Generates all combinations of ARCHES and MODES, e.g. "ia32.release". |
46 BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES))) | 95 BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES))) |
| 96 # Generates corresponding test targets, e.g. "ia32.release.check". |
47 CHECKS = $(addsuffix .check,$(BUILDS)) | 97 CHECKS = $(addsuffix .check,$(BUILDS)) |
48 # Generates corresponding test targets, e.g. "ia32.release.check". | 98 # File where previously used GYPFLAGS are stored. |
| 99 ENVFILE = $(OUTDIR)/environment |
49 | 100 |
50 .PHONY: all release debug ia32 x64 arm $(BUILDS) | 101 .PHONY: all clean $(ENVFILE).new \ |
| 102 $(ARCHES) $(MODES) $(BUILDS) $(addsuffix .clean,$(ARCHES)) |
51 | 103 |
52 # Target definitions. "all" is the default, you can specify any others on the | 104 # Target definitions. "all" is the default. |
53 # command line, e.g. "make ia32". Targets defined in $(BUILDS), e.g. | 105 all: $(MODES) |
54 # "ia32.debug", can also be specified. | |
55 all: release debug | |
56 | 106 |
57 release: $(addsuffix .release,$(ARCHES)) | 107 # Compile targets. MODES and ARCHES are convenience targets. |
| 108 .SECONDEXPANSION: |
| 109 $(MODES): $(addsuffix .$$@,$(ARCHES)) |
58 | 110 |
59 debug: $(addsuffix .debug,$(ARCHES)) | 111 $(ARCHES): $(addprefix $$@.,$(MODES)) |
60 | 112 |
61 ia32: $(addprefix ia32.,$(MODES)) | 113 # Defines how to build a particular target (e.g. ia32.release). |
62 | |
63 x64: $(addprefix x64.,$(MODES)) | |
64 | |
65 arm: $(addprefix arm.,$(MODES)) | |
66 | |
67 .SECONDEXPANSION: | |
68 $(BUILDS): $(OUTDIR)/Makefile-$$(basename $$@) | 114 $(BUILDS): $(OUTDIR)/Makefile-$$(basename $$@) |
69 @$(MAKE) -C "$(OUTDIR)" -f Makefile-$(basename $@) \ | 115 @$(MAKE) -C "$(OUTDIR)" -f Makefile-$(basename $@) \ |
70 CXX="$(CXX)" LINK="$(LINK)" \ | 116 CXX="$(CXX)" LINK="$(LINK)" \ |
71 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ | 117 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ |
72 python -c "print raw_input().capitalize()") \ | 118 python -c "print raw_input().capitalize()") \ |
73 builddir="$(shell pwd)/$(OUTDIR)/$@" | 119 builddir="$(shell pwd)/$(OUTDIR)/$@" |
74 | 120 |
75 # Test targets. | 121 # Test targets. |
76 check: all | 122 check: all |
77 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) | 123 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) |
78 | 124 |
79 $(addsuffix .check,$(MODES)): $$(basename $$@) | 125 $(addsuffix .check,$(MODES)): $$(basename $$@) |
80 » @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) --mode=$(
basename $@) | 126 » @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ |
| 127 » --mode=$(basename $@) |
81 | 128 |
82 $(addsuffix .check,$(ARCHES)): $$(basename $$@) | 129 $(addsuffix .check,$(ARCHES)): $$(basename $$@) |
83 » @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) --arch=$(
basename $@) | 130 » @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ |
| 131 » --arch=$(basename $@) |
84 | 132 |
85 $(CHECKS): $$(basename $$@) | 133 $(CHECKS): $$(basename $$@) |
86 » @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) --arch-an
d-mode=$(basename $@) | 134 » @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ |
| 135 » --arch-and-mode=$(basename $@) |
87 | 136 |
88 # Clean targets. You can clean each architecture individually, or everything. | 137 # Clean targets. You can clean each architecture individually, or everything. |
89 $(addsuffix .clean,$(ARCHES)): | 138 $(addsuffix .clean,$(ARCHES)): |
90 rm -f $(OUTDIR)/Makefile-$(basename $@) | 139 rm -f $(OUTDIR)/Makefile-$(basename $@) |
91 rm -rf $(OUTDIR)/$(basename $@).release | 140 rm -rf $(OUTDIR)/$(basename $@).release |
92 rm -rf $(OUTDIR)/$(basename $@).debug | 141 rm -rf $(OUTDIR)/$(basename $@).debug |
93 find $(OUTDIR) -regex '.*\(host\|target\)-$(basename $@)\.mk' -delete | 142 find $(OUTDIR) -regex '.*\(host\|target\)-$(basename $@)\.mk' -delete |
94 | 143 |
95 clean: $(addsuffix .clean,$(ARCHES)) | 144 clean: $(addsuffix .clean,$(ARCHES)) |
96 | 145 |
97 # GYP file generation targets. | 146 # GYP file generation targets. |
98 $(OUTDIR)/Makefile-ia32: $(GYPFILES) | 147 $(OUTDIR)/Makefile-ia32: $(GYPFILES) $(ENVFILE) |
99 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ | 148 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
100 » -Ibuild/standalone.gypi --depth=. -Dtarget_arch=ia32 -S-ia
32 \ | 149 » -Ibuild/standalone.gypi --depth=. -Dtarget_arch=ia32 \ |
101 » $(GYPFLAGS) | 150 » -S-ia32 $(GYPFLAGS) |
102 | 151 |
103 $(OUTDIR)/Makefile-x64: $(GYPFILES) | 152 $(OUTDIR)/Makefile-x64: $(GYPFILES) $(ENVFILE) |
104 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ | 153 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
105 » -Ibuild/standalone.gypi --depth=. -Dtarget_arch=x64 -S-x64
\ | 154 » -Ibuild/standalone.gypi --depth=. -Dtarget_arch=x64 \ |
106 » $(GYPFLAGS) | 155 » -S-x64 $(GYPFLAGS) |
107 | 156 |
108 $(OUTDIR)/Makefile-arm: $(GYPFILES) build/armu.gypi | 157 $(OUTDIR)/Makefile-arm: $(GYPFILES) $(ENVFILE) |
109 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ | 158 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
110 » -Ibuild/standalone.gypi --depth=. -Ibuild/armu.gypi -S-arm
\ | 159 » -Ibuild/standalone.gypi --depth=. -Ibuild/armu.gypi \ |
111 » $(GYPFLAGS) | 160 » -S-arm $(GYPFLAGS) |
| 161 |
| 162 # Replaces the old with the new environment file if they're different, which |
| 163 # will trigger GYP to regenerate Makefiles. |
| 164 $(ENVFILE): $(ENVFILE).new |
| 165 » @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) >/dev/null; \ |
| 166 » then rm $(ENVFILE).new; \ |
| 167 » else mv $(ENVFILE).new $(ENVFILE); fi |
| 168 |
| 169 # Stores current GYPFLAGS in a file. |
| 170 $(ENVFILE).new: |
| 171 » @mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS)" > $(ENVFILE).new; |
OLD | NEW |