OLD | NEW |
---|---|
1 # Copyright 2012 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 |
(...skipping 16 matching lines...) Expand all Loading... | |
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 ?= | 36 ANDROID_NDK_ROOT ?= |
37 ANDROID_TOOL_PREFIX = $(ANDROID_NDK_ROOT)/toolchain/bin/arm-linux-androideabi | |
38 ANDROID_V8 ?= /data/local/v8 | 37 ANDROID_V8 ?= /data/local/v8 |
39 | 38 |
40 # Special build flags. Use them like this: "make library=shared" | 39 # Special build flags. Use them like this: "make library=shared" |
41 | 40 |
42 # library=shared || component=shared_library | 41 # library=shared || component=shared_library |
43 ifeq ($(library), shared) | 42 ifeq ($(library), shared) |
44 GYPFLAGS += -Dcomponent=shared_library | 43 GYPFLAGS += -Dcomponent=shared_library |
45 endif | 44 endif |
46 ifdef component | 45 ifdef component |
47 GYPFLAGS += -Dcomponent=$(component) | 46 GYPFLAGS += -Dcomponent=$(component) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 # - "<arch>.clean" for any <arch> in ARCHES | 113 # - "<arch>.clean" for any <arch> in ARCHES |
115 # - "clean": clean all ARCHES | 114 # - "clean": clean all ARCHES |
116 | 115 |
117 # ----------------- internal stuff ------------------------ | 116 # ----------------- internal stuff ------------------------ |
118 | 117 |
119 # Architectures and modes to be compiled. Consider these to be internal | 118 # Architectures and modes to be compiled. Consider these to be internal |
120 # variables, don't override them (use the targets instead). | 119 # variables, don't override them (use the targets instead). |
121 ARCHES = ia32 x64 arm mipsel | 120 ARCHES = ia32 x64 arm mipsel |
122 DEFAULT_ARCHES = ia32 x64 arm | 121 DEFAULT_ARCHES = ia32 x64 arm |
123 MODES = release debug | 122 MODES = release debug |
123 ANDROID_ARCHES = ia32.android arm.android | |
Jakob Kummerow
2012/07/17 16:29:57
Can we swap these around (to "android.ia32")? Just
| |
124 ANDROID_MODES = android.release android.debug | 124 ANDROID_MODES = android.release android.debug |
125 | 125 |
126 # List of files that trigger Makefile regeneration: | 126 # List of files that trigger Makefile regeneration: |
127 GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \ | 127 GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \ |
128 preparser/preparser.gyp samples/samples.gyp src/d8.gyp \ | 128 preparser/preparser.gyp samples/samples.gyp src/d8.gyp \ |
129 test/cctest/cctest.gyp tools/gyp/v8.gyp | 129 test/cctest/cctest.gyp tools/gyp/v8.gyp |
130 | 130 |
131 # Generates all combinations of ARCHES and MODES, e.g. "ia32.release". | 131 # Generates all combinations of ARCHES and MODES, e.g. "ia32.release". |
132 BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES))) | 132 BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES))) |
133 ANDROID_BUILDS = $(foreach mode,$(suffix $(ANDROID_MODES)), \ | |
Jakob Kummerow
2012/07/17 16:29:57
Let's s/$(suffix $(ANDROID_MODES))/$(MODES)/ here
| |
134 $(addsuffix $(mode),$(ANDROID_ARCHES))) | |
133 # Generates corresponding test targets, e.g. "ia32.release.check". | 135 # Generates corresponding test targets, e.g. "ia32.release.check". |
134 CHECKS = $(addsuffix .check,$(BUILDS)) | 136 CHECKS = $(addsuffix .check,$(BUILDS)) |
137 ANDROID_CHECKS = $(addsuffix .check,$(ANDROID_BUILDS)) | |
135 # File where previously used GYPFLAGS are stored. | 138 # File where previously used GYPFLAGS are stored. |
136 ENVFILE = $(OUTDIR)/environment | 139 ENVFILE = $(OUTDIR)/environment |
137 | 140 |
138 .PHONY: all check clean dependencies $(ENVFILE).new native \ | 141 .PHONY: all check clean dependencies $(ENVFILE).new native \ |
139 $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \ | 142 $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \ |
140 $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \ | 143 $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \ |
144 $(ANDROID_ARCHES) $(ANDROID_BUILD) $(ANDROID_CHECKS) \ | |
Jakob Kummerow
2012/07/17 16:29:57
s/ANDROID_BUILD/ANDROID_BUILDS/
| |
141 must-set-ANDROID_NDK_ROOT | 145 must-set-ANDROID_NDK_ROOT |
142 | 146 |
143 # Target definitions. "all" is the default. | 147 # Target definitions. "all" is the default. |
144 all: $(MODES) | 148 all: $(MODES) |
145 | 149 |
146 # Special target for the buildbots to use. Depends on $(OUTDIR)/Makefile | 150 # Special target for the buildbots to use. Depends on $(OUTDIR)/Makefile |
147 # having been created before. | 151 # having been created before. |
148 buildbot: | 152 buildbot: |
149 $(MAKE) -C "$(OUTDIR)" BUILDTYPE=$(BUILDTYPE) \ | 153 $(MAKE) -C "$(OUTDIR)" BUILDTYPE=$(BUILDTYPE) \ |
150 builddir="$(abspath $(OUTDIR))/$(BUILDTYPE)" | 154 builddir="$(abspath $(OUTDIR))/$(BUILDTYPE)" |
(...skipping 14 matching lines...) Expand all Loading... | |
165 CXX="$(CXX)" LINK="$(LINK)" \ | 169 CXX="$(CXX)" LINK="$(LINK)" \ |
166 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ | 170 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ |
167 python -c "print raw_input().capitalize()") \ | 171 python -c "print raw_input().capitalize()") \ |
168 builddir="$(shell pwd)/$(OUTDIR)/$@" | 172 builddir="$(shell pwd)/$(OUTDIR)/$@" |
169 | 173 |
170 native: $(OUTDIR)/Makefile.native | 174 native: $(OUTDIR)/Makefile.native |
171 @$(MAKE) -C "$(OUTDIR)" -f Makefile.native \ | 175 @$(MAKE) -C "$(OUTDIR)" -f Makefile.native \ |
172 CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \ | 176 CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \ |
173 builddir="$(shell pwd)/$(OUTDIR)/$@" | 177 builddir="$(shell pwd)/$(OUTDIR)/$@" |
174 | 178 |
175 android: $(ANDROID_MODES) | 179 $(ANDROID_ARCHES): $(addprefix $$@,$(suffix $(ANDROID_MODES))) |
Jakob Kummerow
2012/07/17 16:29:57
Again, s/$(suffix $(ANDROID_MODES))/$(MODES)/.
| |
176 | 180 |
177 $(ANDROID_MODES): $(OUTDIR)/Makefile.android | 181 $(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$(basename $$@) |
178 » @$(MAKE) -C "$(OUTDIR)" -f Makefile.android \ | 182 » $(MAKE) -C "$(OUTDIR)" -f Makefile.$(basename $@) \ |
179 » CXX="$(ANDROID_TOOL_PREFIX)-g++" \ | 183 » CXX="$(shell ls $(ANDROID_TOOLCHAIN)/*-g++)" \ |
180 » AR="$(ANDROID_TOOL_PREFIX)-ar" \ | 184 » AR="$(shell ls $(ANDROID_TOOLCHAIN)/*-ar)" \ |
181 » RANLIB="$(ANDROID_TOOL_PREFIX)-ranlib" \ | 185 » RANLIB="$(shell ls $(ANDROID_TOOLCHAIN)/*-ranlib)" \ |
182 » CC="$(ANDROID_TOOL_PREFIX)-gcc" \ | 186 » CC="$(shell ls $(ANDROID_TOOLCHAIN)/*-gcc)" \ |
183 » LD="$(ANDROID_TOOL_PREFIX)-ld" \ | 187 » LD="$(shell ls $(ANDROID_TOOLCHAIN)/*-ld)" \ |
184 » LINK="$(ANDROID_TOOL_PREFIX)-g++" \ | 188 » LINK="$(shell ls $(ANDROID_TOOLCHAIN)/*-g++)" \ |
185 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ | 189 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ |
186 python -c "print raw_input().capitalize()") \ | 190 python -c "print raw_input().capitalize()") \ |
187 builddir="$(shell pwd)/$(OUTDIR)/$@" | 191 builddir="$(shell pwd)/$(OUTDIR)/$@" |
188 | 192 |
189 # Test targets. | 193 # Test targets. |
190 check: all | 194 check: all |
191 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ | 195 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ |
192 --arch=$(shell echo $(DEFAULT_ARCHES) | sed -e 's/ /,/g') \ | 196 --arch=$(shell echo $(DEFAULT_ARCHES) | sed -e 's/ /,/g') \ |
193 $(TESTFLAGS) | 197 $(TESTFLAGS) |
194 | 198 |
195 $(addsuffix .check,$(MODES)): $$(basename $$@) | 199 $(addsuffix .check,$(MODES)): $$(basename $$@) |
196 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ | 200 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ |
197 --mode=$(basename $@) $(TESTFLAGS) | 201 --mode=$(basename $@) $(TESTFLAGS) |
198 | 202 |
199 $(addsuffix .check,$(ARCHES)): $$(basename $$@) | 203 $(addsuffix .check,$(ARCHES)): $$(basename $$@) |
200 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ | 204 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ |
201 --arch=$(basename $@) $(TESTFLAGS) | 205 --arch=$(basename $@) $(TESTFLAGS) |
202 | 206 |
203 $(CHECKS): $$(basename $$@) | 207 $(CHECKS): $$(basename $$@) |
204 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ | 208 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ |
205 --arch-and-mode=$(basename $@) $(TESTFLAGS) | 209 --arch-and-mode=$(basename $@) $(TESTFLAGS) |
206 | 210 |
207 $(addsuffix .sync, $(ANDROID_MODES)): $$(basename $$@) | 211 $(addsuffix .sync, $(ANDROID_BUILDS)): $$(basename $$@) |
208 @tools/android-sync.sh $(basename $@) $(OUTDIR) \ | 212 @tools/android-sync.sh $(basename $@) $(OUTDIR) \ |
209 $(shell pwd) $(ANDROID_V8) | 213 $(shell pwd) $(ANDROID_V8) |
210 | 214 |
211 $(addsuffix .check, $(ANDROID_MODES)): $$(basename $$@).sync | 215 $(addsuffix .check, $(ANDROID_BUILDS)): $$(basename $$@).sync |
212 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ | 216 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ |
213 --arch-and-mode=$(basename $@) \ | 217 --arch-and-mode=$(basename $@) \ |
214 --special-command="tools/android-run.py @" | 218 --special-command="tools/android-run.py @" |
215 | 219 |
216 android.check: android.release.check android.debug.check | 220 $(addsuffix .check, $(ANDROID_ARCHES)): $$(basename $$@).debug.check \ |
217 | 221 $$(basename $$@).release.check |
218 native.check: native | 222 native.check: native |
219 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR)/native \ | 223 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR)/native \ |
220 --arch-and-mode=. $(TESTFLAGS) | 224 --arch-and-mode=. $(TESTFLAGS) |
221 | 225 |
222 # Clean targets. You can clean each architecture individually, or everything. | 226 # Clean targets. You can clean each architecture individually, or everything. |
223 $(addsuffix .clean,$(ARCHES)) android.clean: | 227 $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)): |
224 rm -f $(OUTDIR)/Makefile.$(basename $@) | 228 rm -f $(OUTDIR)/Makefile.$(basename $@) |
225 rm -rf $(OUTDIR)/$(basename $@).release | 229 rm -rf $(OUTDIR)/$(basename $@).release |
226 rm -rf $(OUTDIR)/$(basename $@).debug | 230 rm -rf $(OUTDIR)/$(basename $@).debug |
227 find $(OUTDIR) -regex '.*\(host\|target\).$(basename $@)\.mk' -delete | 231 find $(OUTDIR) -regex '.*\(host\|target\).$(basename $@)\.mk' -delete |
228 | 232 |
229 native.clean: | 233 native.clean: |
230 rm -f $(OUTDIR)/Makefile.native | 234 rm -f $(OUTDIR)/Makefile.native |
231 rm -rf $(OUTDIR)/native | 235 rm -rf $(OUTDIR)/native |
232 find $(OUTDIR) -regex '.*\(host\|target\).native\.mk' -delete | 236 find $(OUTDIR) -regex '.*\(host\|target\).native\.mk' -delete |
233 | 237 |
234 clean: $(addsuffix .clean,$(ARCHES)) native.clean android.clean | 238 clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)) native.clean |
235 | 239 |
236 # GYP file generation targets. | 240 # GYP file generation targets. |
237 MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ARCHES)) | 241 MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ARCHES)) |
238 $(MAKEFILES): $(GYPFILES) $(ENVFILE) | 242 $(MAKEFILES): $(GYPFILES) $(ENVFILE) |
239 GYP_GENERATORS=make \ | 243 GYP_GENERATORS=make \ |
240 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ | 244 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
241 -Ibuild/standalone.gypi --depth=. \ | 245 -Ibuild/standalone.gypi --depth=. \ |
242 -Dv8_target_arch=$(subst .,,$(suffix $@)) \ | 246 -Dv8_target_arch=$(subst .,,$(suffix $@)) \ |
243 -S.$(subst .,,$(suffix $@)) $(GYPFLAGS) | 247 -S.$(subst .,,$(suffix $@)) $(GYPFLAGS) |
244 | 248 |
245 $(OUTDIR)/Makefile.native: $(GYPFILES) $(ENVFILE) | 249 $(OUTDIR)/Makefile.native: $(GYPFILES) $(ENVFILE) |
246 GYP_GENERATORS=make \ | 250 GYP_GENERATORS=make \ |
247 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ | 251 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
248 -Ibuild/standalone.gypi --depth=. -S.native $(GYPFLAGS) | 252 -Ibuild/standalone.gypi --depth=. -S.native $(GYPFLAGS) |
249 | 253 |
250 $(OUTDIR)/Makefile.android: $(GYPFILES) $(ENVFILE) build/android.gypi \ | 254 ANDROID_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ANDROID_ARCHES)) |
255 $(ANDROID_MAKEFILES): $(GYPFILES) $(ENVFILE) build/android.gypi \ | |
251 must-set-ANDROID_NDK_ROOT | 256 must-set-ANDROID_NDK_ROOT |
252 GYP_GENERATORS=make \ | 257 GYP_GENERATORS=make \ |
253 » CC="${ANDROID_TOOL_PREFIX}-gcc" \ | 258 » CC="$(shell ls $(ANDROID_TOOLCHAIN)/*-gcc)" \ |
254 » CXX="${ANDROID_TOOL_PREFIX}-g++" \ | 259 » CXX="$(shell ls $(ANDROID_TOOLCHAIN)/*-g++)" \ |
255 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ | 260 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
256 -Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \ | 261 -Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \ |
257 » -S.android $(GYPFLAGS) | 262 » -S$(suffix $(basename $@)).$(subst .,,$(suffix $@)) \ |
Jakob Kummerow
2012/07/17 16:29:57
This line would become simpler if you defined:
AND
| |
263 » $(GYPFLAGS) | |
258 | 264 |
259 must-set-ANDROID_NDK_ROOT: | 265 must-set-ANDROID_NDK_ROOT: |
260 ifndef ANDROID_NDK_ROOT | 266 ifndef ANDROID_NDK_ROOT |
261 $(error ANDROID_NDK_ROOT is not set) | 267 $(error ANDROID_NDK_ROOT is not set) |
262 endif | 268 endif |
263 | 269 |
264 # Replaces the old with the new environment file if they're different, which | 270 # Replaces the old with the new environment file if they're different, which |
265 # will trigger GYP to regenerate Makefiles. | 271 # will trigger GYP to regenerate Makefiles. |
266 $(ENVFILE): $(ENVFILE).new | 272 $(ENVFILE): $(ENVFILE).new |
267 @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) >/dev/null; \ | 273 @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) >/dev/null; \ |
268 then rm $(ENVFILE).new; \ | 274 then rm $(ENVFILE).new; \ |
269 else mv $(ENVFILE).new $(ENVFILE); fi | 275 else mv $(ENVFILE).new $(ENVFILE); fi |
270 | 276 |
271 # Stores current GYPFLAGS in a file. | 277 # Stores current GYPFLAGS in a file. |
272 $(ENVFILE).new: | 278 $(ENVFILE).new: |
273 @mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS)" > $(ENVFILE).new; \ | 279 @mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS)" > $(ENVFILE).new; \ |
274 echo "CXX=$(CXX)" >> $(ENVFILE).new | 280 echo "CXX=$(CXX)" >> $(ENVFILE).new |
275 | 281 |
276 # Dependencies. | 282 # Dependencies. |
277 dependencies: | 283 dependencies: |
278 svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \ | 284 svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \ |
279 --revision 1282 | 285 --revision 1282 |
OLD | NEW |