| OLD | NEW |
| 1 # Copyright 2011 the V8 project authors. All rights reserved. | 1 # Copyright 2012 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 |
| 11 # with the distribution. | 11 # with the distribution. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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++ | 30 CXX ?= g++ |
| 31 LINK ?= g++ | 31 LINK ?= g++ |
| 32 OUTDIR ?= out | 32 OUTDIR ?= out |
| 33 TESTJOBS ?= -j16 | 33 TESTJOBS ?= -j16 |
| 34 GYPFLAGS ?= | 34 GYPFLAGS ?= |
| 35 TESTFLAGS ?= | 35 TESTFLAGS ?= |
| 36 ANDROID_NDK_ROOT ?= |
| 37 ANDROID_TOOL_PREFIX = $(ANDROID_NDK_ROOT)/toolchain/bin/arm-linux-androideabi |
| 36 | 38 |
| 37 # Special build flags. Use them like this: "make library=shared" | 39 # Special build flags. Use them like this: "make library=shared" |
| 38 | 40 |
| 39 # library=shared || component=shared_library | 41 # library=shared || component=shared_library |
| 40 ifeq ($(library), shared) | 42 ifeq ($(library), shared) |
| 41 GYPFLAGS += -Dcomponent=shared_library | 43 GYPFLAGS += -Dcomponent=shared_library |
| 42 endif | 44 endif |
| 43 ifdef component | 45 ifdef component |
| 44 GYPFLAGS += -Dcomponent=$(component) | 46 GYPFLAGS += -Dcomponent=$(component) |
| 45 endif | 47 endif |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 TESTFLAGS += --no-presubmit | 88 TESTFLAGS += --no-presubmit |
| 87 endif | 89 endif |
| 88 | 90 |
| 89 # ----------------- available targets: -------------------- | 91 # ----------------- available targets: -------------------- |
| 90 # - "dependencies": pulls in external dependencies (currently: GYP) | 92 # - "dependencies": pulls in external dependencies (currently: GYP) |
| 91 # - any arch listed in ARCHES (see below) | 93 # - any arch listed in ARCHES (see below) |
| 92 # - any mode listed in MODES | 94 # - any mode listed in MODES |
| 93 # - every combination <arch>.<mode>, e.g. "ia32.release" | 95 # - every combination <arch>.<mode>, e.g. "ia32.release" |
| 94 # - "native": current host's architecture, release mode | 96 # - "native": current host's architecture, release mode |
| 95 # - any of the above with .check appended, e.g. "ia32.release.check" | 97 # - any of the above with .check appended, e.g. "ia32.release.check" |
| 98 # - "android": cross-compile for Android/ARM (release mode) |
| 96 # - default (no target specified): build all DEFAULT_ARCHES and MODES | 99 # - default (no target specified): build all DEFAULT_ARCHES and MODES |
| 97 # - "check": build all targets and run all tests | 100 # - "check": build all targets and run all tests |
| 98 # - "<arch>.clean" for any <arch> in ARCHES | 101 # - "<arch>.clean" for any <arch> in ARCHES |
| 99 # - "clean": clean all ARCHES | 102 # - "clean": clean all ARCHES |
| 100 | 103 |
| 101 # ----------------- internal stuff ------------------------ | 104 # ----------------- internal stuff ------------------------ |
| 102 | 105 |
| 103 # Architectures and modes to be compiled. Consider these to be internal | 106 # Architectures and modes to be compiled. Consider these to be internal |
| 104 # variables, don't override them (use the targets instead). | 107 # variables, don't override them (use the targets instead). |
| 105 ARCHES = ia32 x64 arm mips | 108 ARCHES = ia32 x64 arm mips |
| 106 DEFAULT_ARCHES = ia32 x64 arm | 109 DEFAULT_ARCHES = ia32 x64 arm |
| 107 MODES = release debug | 110 MODES = release debug |
| 108 | 111 |
| 109 # List of files that trigger Makefile regeneration: | 112 # List of files that trigger Makefile regeneration: |
| 110 GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \ | 113 GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \ |
| 111 preparser/preparser.gyp samples/samples.gyp src/d8.gyp \ | 114 preparser/preparser.gyp samples/samples.gyp src/d8.gyp \ |
| 112 test/cctest/cctest.gyp tools/gyp/v8.gyp | 115 test/cctest/cctest.gyp tools/gyp/v8.gyp |
| 113 | 116 |
| 114 # Generates all combinations of ARCHES and MODES, e.g. "ia32.release". | 117 # Generates all combinations of ARCHES and MODES, e.g. "ia32.release". |
| 115 BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES))) | 118 BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES))) |
| 116 # Generates corresponding test targets, e.g. "ia32.release.check". | 119 # Generates corresponding test targets, e.g. "ia32.release.check". |
| 117 CHECKS = $(addsuffix .check,$(BUILDS)) | 120 CHECKS = $(addsuffix .check,$(BUILDS)) |
| 118 # File where previously used GYPFLAGS are stored. | 121 # File where previously used GYPFLAGS are stored. |
| 119 ENVFILE = $(OUTDIR)/environment | 122 ENVFILE = $(OUTDIR)/environment |
| 120 | 123 |
| 121 .PHONY: all check clean dependencies $(ENVFILE).new native \ | 124 .PHONY: all check clean dependencies $(ENVFILE).new native \ |
| 122 $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \ | 125 $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \ |
| 123 $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) | 126 $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \ |
| 127 must-set-ANDROID_NDK_ROOT |
| 124 | 128 |
| 125 # Target definitions. "all" is the default. | 129 # Target definitions. "all" is the default. |
| 126 all: $(MODES) | 130 all: $(MODES) |
| 127 | 131 |
| 128 # Compile targets. MODES and ARCHES are convenience targets. | 132 # Compile targets. MODES and ARCHES are convenience targets. |
| 129 .SECONDEXPANSION: | 133 .SECONDEXPANSION: |
| 130 $(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES)) | 134 $(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES)) |
| 131 | 135 |
| 132 $(ARCHES): $(addprefix $$@.,$(MODES)) | 136 $(ARCHES): $(addprefix $$@.,$(MODES)) |
| 133 | 137 |
| 134 # Defines how to build a particular target (e.g. ia32.release). | 138 # Defines how to build a particular target (e.g. ia32.release). |
| 135 $(BUILDS): $(OUTDIR)/Makefile-$$(basename $$@) | 139 $(BUILDS): $(OUTDIR)/Makefile-$$(basename $$@) |
| 136 @$(MAKE) -C "$(OUTDIR)" -f Makefile-$(basename $@) \ | 140 @$(MAKE) -C "$(OUTDIR)" -f Makefile-$(basename $@) \ |
| 137 CXX="$(CXX)" LINK="$(LINK)" \ | 141 CXX="$(CXX)" LINK="$(LINK)" \ |
| 138 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ | 142 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ |
| 139 python -c "print raw_input().capitalize()") \ | 143 python -c "print raw_input().capitalize()") \ |
| 140 builddir="$(shell pwd)/$(OUTDIR)/$@" | 144 builddir="$(shell pwd)/$(OUTDIR)/$@" |
| 141 | 145 |
| 142 native: $(OUTDIR)/Makefile-native | 146 native: $(OUTDIR)/Makefile-native |
| 143 @$(MAKE) -C "$(OUTDIR)" -f Makefile-native \ | 147 @$(MAKE) -C "$(OUTDIR)" -f Makefile-native \ |
| 144 CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \ | 148 CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \ |
| 145 builddir="$(shell pwd)/$(OUTDIR)/$@" | 149 builddir="$(shell pwd)/$(OUTDIR)/$@" |
| 146 | 150 |
| 151 # TODO(jkummerow): add "android.debug" when we need it. |
| 152 android android.release: $(OUTDIR)/Makefile-android |
| 153 @$(MAKE) -C "$(OUTDIR)" -f Makefile-android \ |
| 154 CXX="$(ANDROID_TOOL_PREFIX)-g++" \ |
| 155 AR="$(ANDROID_TOOL_PREFIX)-ar" \ |
| 156 RANLIB="$(ANDROID_TOOL_PREFIX)-ranlib" \ |
| 157 CC="$(ANDROID_TOOL_PREFIX)-gcc" \ |
| 158 LD="$(ANDROID_TOOL_PREFIX)-ld" \ |
| 159 LINK="$(ANDROID_TOOL_PREFIX)-g++" \ |
| 160 BUILDTYPE=Release \ |
| 161 builddir="$(shell pwd)/$(OUTDIR)/android.release" |
| 162 |
| 147 # Test targets. | 163 # Test targets. |
| 148 check: all | 164 check: all |
| 149 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ | 165 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ |
| 150 --arch=$(shell echo $(DEFAULT_ARCHES) | sed -e 's/ /,/g') \ | 166 --arch=$(shell echo $(DEFAULT_ARCHES) | sed -e 's/ /,/g') \ |
| 151 $(TESTFLAGS) | 167 $(TESTFLAGS) |
| 152 | 168 |
| 153 $(addsuffix .check,$(MODES)): $$(basename $$@) | 169 $(addsuffix .check,$(MODES)): $$(basename $$@) |
| 154 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ | 170 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ |
| 155 --mode=$(basename $@) $(TESTFLAGS) | 171 --mode=$(basename $@) $(TESTFLAGS) |
| 156 | 172 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 171 rm -f $(OUTDIR)/Makefile-$(basename $@) | 187 rm -f $(OUTDIR)/Makefile-$(basename $@) |
| 172 rm -rf $(OUTDIR)/$(basename $@).release | 188 rm -rf $(OUTDIR)/$(basename $@).release |
| 173 rm -rf $(OUTDIR)/$(basename $@).debug | 189 rm -rf $(OUTDIR)/$(basename $@).debug |
| 174 find $(OUTDIR) -regex '.*\(host\|target\)-$(basename $@)\.mk' -delete | 190 find $(OUTDIR) -regex '.*\(host\|target\)-$(basename $@)\.mk' -delete |
| 175 | 191 |
| 176 native.clean: | 192 native.clean: |
| 177 rm -f $(OUTDIR)/Makefile-native | 193 rm -f $(OUTDIR)/Makefile-native |
| 178 rm -rf $(OUTDIR)/native | 194 rm -rf $(OUTDIR)/native |
| 179 find $(OUTDIR) -regex '.*\(host\|target\)-native\.mk' -delete | 195 find $(OUTDIR) -regex '.*\(host\|target\)-native\.mk' -delete |
| 180 | 196 |
| 197 android.clean: |
| 198 rm -f $(OUTDIR)/Makefile-android |
| 199 rm -rf $(OUTDIR)/android.release |
| 200 find $(OUTDIR) -regex '.*\(host\|target\)-android\.mk' -delete |
| 201 |
| 181 clean: $(addsuffix .clean,$(ARCHES)) native.clean | 202 clean: $(addsuffix .clean,$(ARCHES)) native.clean |
| 182 | 203 |
| 183 # GYP file generation targets. | 204 # GYP file generation targets. |
| 184 $(OUTDIR)/Makefile-ia32: $(GYPFILES) $(ENVFILE) | 205 $(OUTDIR)/Makefile-ia32: $(GYPFILES) $(ENVFILE) |
| 185 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ | 206 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
| 186 -Ibuild/standalone.gypi --depth=. -Dtarget_arch=ia32 \ | 207 -Ibuild/standalone.gypi --depth=. -Dtarget_arch=ia32 \ |
| 187 -S-ia32 $(GYPFLAGS) | 208 -S-ia32 $(GYPFLAGS) |
| 188 | 209 |
| 189 $(OUTDIR)/Makefile-x64: $(GYPFILES) $(ENVFILE) | 210 $(OUTDIR)/Makefile-x64: $(GYPFILES) $(ENVFILE) |
| 190 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ | 211 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
| 191 -Ibuild/standalone.gypi --depth=. -Dtarget_arch=x64 \ | 212 -Ibuild/standalone.gypi --depth=. -Dtarget_arch=x64 \ |
| 192 -S-x64 $(GYPFLAGS) | 213 -S-x64 $(GYPFLAGS) |
| 193 | 214 |
| 194 $(OUTDIR)/Makefile-arm: $(GYPFILES) $(ENVFILE) build/armu.gypi | 215 $(OUTDIR)/Makefile-arm: $(GYPFILES) $(ENVFILE) build/armu.gypi |
| 195 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ | 216 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
| 196 -Ibuild/standalone.gypi --depth=. -Ibuild/armu.gypi \ | 217 -Ibuild/standalone.gypi --depth=. -Ibuild/armu.gypi \ |
| 197 -S-arm $(GYPFLAGS) | 218 -S-arm $(GYPFLAGS) |
| 198 | 219 |
| 199 $(OUTDIR)/Makefile-mips: $(GYPFILES) $(ENVFILE) build/mipsu.gypi | 220 $(OUTDIR)/Makefile-mips: $(GYPFILES) $(ENVFILE) build/mipsu.gypi |
| 200 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ | 221 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
| 201 -Ibuild/standalone.gypi --depth=. -Ibuild/mipsu.gypi \ | 222 -Ibuild/standalone.gypi --depth=. -Ibuild/mipsu.gypi \ |
| 202 -S-mips $(GYPFLAGS) | 223 -S-mips $(GYPFLAGS) |
| 203 | 224 |
| 204 $(OUTDIR)/Makefile-native: $(GYPFILES) $(ENVFILE) | 225 $(OUTDIR)/Makefile-native: $(GYPFILES) $(ENVFILE) |
| 205 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ | 226 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
| 206 -Ibuild/standalone.gypi --depth=. -S-native $(GYPFLAGS) | 227 -Ibuild/standalone.gypi --depth=. -S-native $(GYPFLAGS) |
| 207 | 228 |
| 229 $(OUTDIR)/Makefile-android: $(GYPFILES) $(ENVFILE) build/android.gypi \ |
| 230 must-set-ANDROID_NDK_ROOT |
| 231 CC="${ANDROID_TOOL_PREFIX}-gcc" \ |
| 232 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
| 233 -Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \ |
| 234 -S-android $(GYPFLAGS) |
| 235 |
| 236 must-set-ANDROID_NDK_ROOT: |
| 237 ifndef ANDROID_NDK_ROOT |
| 238 $(error ANDROID_NDK_ROOT is not set) |
| 239 endif |
| 240 |
| 208 # Replaces the old with the new environment file if they're different, which | 241 # Replaces the old with the new environment file if they're different, which |
| 209 # will trigger GYP to regenerate Makefiles. | 242 # will trigger GYP to regenerate Makefiles. |
| 210 $(ENVFILE): $(ENVFILE).new | 243 $(ENVFILE): $(ENVFILE).new |
| 211 @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) >/dev/null; \ | 244 @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) >/dev/null; \ |
| 212 then rm $(ENVFILE).new; \ | 245 then rm $(ENVFILE).new; \ |
| 213 else mv $(ENVFILE).new $(ENVFILE); fi | 246 else mv $(ENVFILE).new $(ENVFILE); fi |
| 214 | 247 |
| 215 # Stores current GYPFLAGS in a file. | 248 # Stores current GYPFLAGS in a file. |
| 216 $(ENVFILE).new: | 249 $(ENVFILE).new: |
| 217 @mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS)" > $(ENVFILE).new; | 250 @mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS)" > $(ENVFILE).new; |
| 218 | 251 |
| 219 # Dependencies. | 252 # Dependencies. |
| 220 dependencies: | 253 dependencies: |
| 221 svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \ | 254 svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \ |
| 222 --revision 1026 | 255 --revision 1026 |
| OLD | NEW |