1
- # Copyright 2011 the V8 project authors. All rights reserved.
1
+ # Copyright 2012 the V8 project authors. All rights reserved.
2
2
# Redistribution and use in source and binary forms, with or without
3
3
# modification, are permitted provided that the following conditions are
4
4
# met:
@@ -33,6 +33,8 @@ OUTDIR ?= out
33
33
TESTJOBS ?= -j16
34
34
GYPFLAGS ?=
35
35
TESTFLAGS ?=
36
+ ANDROID_NDK_ROOT ?=
37
+ ANDROID_TOOL_PREFIX = $(ANDROID_NDK_ROOT ) /toolchain/bin/arm-linux-androideabi
36
38
37
39
# Special build flags. Use them like this: "make library=shared"
38
40
85
87
ifeq ($(presubmit ) , no)
86
88
TESTFLAGS += --no-presubmit
87
89
endif
90
+ # strictaliasing=off (workaround for GCC-4.5)
91
+ ifeq ($(strictaliasing ) , off)
92
+ GYPFLAGS += -Dv8_no_strict_aliasing=1
93
+ endif
88
94
89
95
# ----------------- available targets: --------------------
90
96
# - "dependencies": pulls in external dependencies (currently: GYP)
93
99
# - every combination <arch>.<mode>, e.g. "ia32.release"
94
100
# - "native": current host's architecture, release mode
95
101
# - any of the above with .check appended, e.g. "ia32.release.check"
102
+ # - "android": cross-compile for Android/ARM (release mode)
96
103
# - default (no target specified): build all DEFAULT_ARCHES and MODES
97
104
# - "check": build all targets and run all tests
98
105
# - "<arch>.clean" for any <arch> in ARCHES
@@ -120,7 +127,8 @@ ENVFILE = $(OUTDIR)/environment
120
127
121
128
.PHONY : all check clean dependencies $(ENVFILE ) .new native \
122
129
$(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \
123
- $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES))
130
+ $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \
131
+ must-set-ANDROID_NDK_ROOT
124
132
125
133
# Target definitions. "all" is the default.
126
134
all : $(MODES )
@@ -144,6 +152,18 @@ native: $(OUTDIR)/Makefile-native
144
152
CXX=" $( CXX) " LINK=" $( LINK) " BUILDTYPE=Release \
145
153
builddir=" $( shell pwd) /$( OUTDIR) /$@ "
146
154
155
+ # TODO(jkummerow): add "android.debug" when we need it.
156
+ android android.release : $(OUTDIR ) /Makefile-android
157
+ @$(MAKE ) -C " $( OUTDIR) " -f Makefile-android \
158
+ CXX=" $( ANDROID_TOOL_PREFIX) -g++" \
159
+ AR=" $( ANDROID_TOOL_PREFIX) -ar" \
160
+ RANLIB=" $( ANDROID_TOOL_PREFIX) -ranlib" \
161
+ CC=" $( ANDROID_TOOL_PREFIX) -gcc" \
162
+ LD=" $( ANDROID_TOOL_PREFIX) -ld" \
163
+ LINK=" $( ANDROID_TOOL_PREFIX) -g++" \
164
+ BUILDTYPE=Release \
165
+ builddir=" $( shell pwd) /$( OUTDIR) /android.release"
166
+
147
167
# Test targets.
148
168
check : all
149
169
@tools/test-wrapper-gypbuild.py $(TESTJOBS ) --outdir=$(OUTDIR ) \
@@ -178,6 +198,11 @@ native.clean:
178
198
rm -rf $(OUTDIR ) /native
179
199
find $(OUTDIR ) -regex ' .*\(host\|target\)-native\.mk' -delete
180
200
201
+ android.clean :
202
+ rm -f $(OUTDIR ) /Makefile-android
203
+ rm -rf $(OUTDIR ) /android.release
204
+ find $(OUTDIR ) -regex ' .*\(host\|target\)-android\.mk' -delete
205
+
181
206
clean : $(addsuffix .clean,$(ARCHES ) ) native.clean
182
207
183
208
# GYP file generation targets.
@@ -205,6 +230,18 @@ $(OUTDIR)/Makefile-native: $(GYPFILES) $(ENVFILE)
205
230
build/gyp/gyp --generator-output=" $( OUTDIR) " build/all.gyp \
206
231
-Ibuild/standalone.gypi --depth=. -S-native $(GYPFLAGS )
207
232
233
+ $(OUTDIR ) /Makefile-android : $(GYPFILES ) $(ENVFILE ) build/android.gypi \
234
+ must-set-ANDROID_NDK_ROOT
235
+ CC="${ANDROID_TOOL_PREFIX}-gcc" \
236
+ build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
237
+ -Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \
238
+ -S-android $(GYPFLAGS)
239
+
240
+ must-set-ANDROID_NDK_ROOT :
241
+ ifndef ANDROID_NDK_ROOT
242
+ $(error ANDROID_NDK_ROOT is not set)
243
+ endif
244
+
208
245
# Replaces the old with the new environment file if they're different, which
209
246
# will trigger GYP to regenerate Makefiles.
210
247
$(ENVFILE ) : $(ENVFILE ) .new
0 commit comments