[sdks] Don't package android-sources on Windows
[mono-project.git] / sdks / builds / android.mk
blob7596ced8b6a2e33ee0146da502d392dd117418bc
2 ANDROID_URI?=https://dl.google.com/android/repository/
3 ANT_URI?=https://archive.apache.org/dist/ant/binaries/
5 ANDROID_SDK_PREFIX?=$(ANDROID_TOOLCHAIN_DIR)/sdk
6 ANDROID_TOOLCHAIN_PREFIX?=$(ANDROID_TOOLCHAIN_DIR)/toolchains
7 ANDROID_NEW_NDK=$(shell if test `grep 'Pkg\.Revision' $(ANDROID_TOOLCHAIN_DIR)/ndk/source.properties | cut -d '=' -f 2 | tr -d ' ' | cut -d '.' -f 1` -ge 18; then echo yes; else echo no; fi)
9 android_SOURCES_DIR = $(TOP)/sdks/out/android-sources
11 ifneq ($(UNAME),Windows)
12 android_ARCHIVE += android-sources
13 ADDITIONAL_PACKAGE_DEPS += $(android_SOURCES_DIR)
14 endif
17 # Parameters:
18 # $(1): target
19 # $(2): dir
20 # $(3): subdir (optional)
21 # $(4): stamp (optional, default to $(1))
22 define AndroidProvisioningTemplate
24 $$(ANDROID_TOOLCHAIN_CACHE_DIR)/$(1).zip:
25 mkdir -p $$(dir $$@)
26 wget --no-verbose -O $$@ $$(ANDROID_URI)$(1).zip
28 $$(ANDROID_TOOLCHAIN_DIR)/$(2)/.stamp-$$(or $(4),$(1)): $$(ANDROID_TOOLCHAIN_CACHE_DIR)/$(1).zip
29 mkdir -p $$(dir $$@)
30 rm -rf $$(ANDROID_TOOLCHAIN_DIR)/$(2)$$(if $(3),/$(3))
31 ./unzip-android-archive.sh "$$<" "$$(ANDROID_TOOLCHAIN_DIR)/$(2)$$(if $(3),/$(3))"
32 touch $$@
34 .PHONY: provision-android
35 provision-android: $$(ANDROID_TOOLCHAIN_DIR)/$(2)/.stamp-$$(or $(4),$(1))
37 endef
40 # Parameters:
41 # $(1): target
42 # $(2): dir
43 # $(3): subdir (optional)
44 # $(4): stamp (optional, default to $(1))
45 define AndroidProvisioningTemplateStub
47 .PHONY: provision-android-$(1)
48 provision-android-$(1):
49 @echo "TODO: provision $(2)/.stamp-$$(or $(4),$(1)) for $$(UNAME)"
51 .PHONY: provision-android
52 provision-android: provision-android-$(1)
54 endef
56 ifeq ($(UNAME),Darwin)
57 $(eval $(call AndroidProvisioningTemplate,android-ndk-$(ANDROID_NDK_VERSION)-darwin-x86_64,ndk,,ndk))
58 $(eval $(call AndroidProvisioningTemplate,platform-tools_r$(ANDROID_PLATFORM_TOOLS_VERSION)-darwin,sdk,platform-tools))
59 $(eval $(call AndroidProvisioningTemplate,sdk-tools-darwin-$(ANDROID_SDKTOOLS_VERSION),sdk,tools))
60 $(eval $(call AndroidProvisioningTemplate,cmake-$(ANDROID_CMAKE_VERSION)-darwin-x86_64,sdk,cmake/$(ANDROID_CMAKE_VERSION)))
61 else ifeq ($(UNAME),Linux)
62 $(eval $(call AndroidProvisioningTemplate,android-ndk-$(ANDROID_NDK_VERSION)-linux-x86_64,ndk,,ndk))
63 $(eval $(call AndroidProvisioningTemplate,platform-tools_r$(ANDROID_PLATFORM_TOOLS_VERSION)-linux,sdk,platform-tools))
64 $(eval $(call AndroidProvisioningTemplate,sdk-tools-linux-$(ANDROID_SDKTOOLS_VERSION),sdk,tools))
65 $(eval $(call AndroidProvisioningTemplate,cmake-$(ANDROID_CMAKE_VERSION)-linux-x86_64,sdk,cmake/$(ANDROID_CMAKE_VERSION)))
66 else ifeq ($(UNAME),Windows)
67 $(eval $(call AndroidProvisioningTemplateStub,android-ndk-$(ANDROID_NDK_VERSION)-win32-x86_64,ndk,,ndk))
68 $(eval $(call AndroidProvisioningTemplateStub,platform-tools_r$(ANDROID_PLATFORM_TOOLS_VERSION)-win32,sdk,platform-tools))
69 $(eval $(call AndroidProvisioningTemplateStub,sdk-tools-win32-$(ANDROID_SDKTOOLS_VERSION),sdk,tools))
70 $(eval $(call AndroidProvisioningTemplateStub,cmake-$(ANDROID_CMAKE_VERSION)-win32-x86_64,sdk,cmake/$(ANDROID_CMAKE_VERSION)))
71 endif
74 # Parameters:
75 # $(1): target
76 # $(2): arch
77 # $(3): abi_name
78 # $(4): host_triple
80 # Flags:
81 # android-$(1)_CFLAGS
82 # android-$(1)_CXXFLAGS
83 # android-$(1)_LDFLAGS
84 define AndroidTargetTemplate
86 _android-$(1)_AR=$$(ANDROID_TOOLCHAIN_PREFIX)/$(1)-clang/bin/$(3)-ar
87 _android-$(1)_AS=$$(ANDROID_TOOLCHAIN_PREFIX)/$(1)-clang/bin/$(3)-as
88 _android-$(1)_CC=$$(CCACHE) $$(ANDROID_TOOLCHAIN_PREFIX)/$(1)-clang/bin/$(3)-clang
89 _android-$(1)_CXX=$$(CCACHE) $$(ANDROID_TOOLCHAIN_PREFIX)/$(1)-clang/bin/$(3)-clang++
90 _android-$(1)_CPP=$$(CCACHE) $$(ANDROID_TOOLCHAIN_PREFIX)/$(1)-clang/bin/$(3)-$$(if $(wildcard $$(ANDROID_TOOLCHAIN_PREFIX)/$(1)-clang/bin/$(3)-cpp),cpp,clang -E)
91 _android-$(1)_CXXCPP=$$(CCACHE) $$(ANDROID_TOOLCHAIN_PREFIX)/$(1)-clang/bin/$(3)-$$(if $(wildcard $$(ANDROID_TOOLCHAIN_PREFIX)/$(1)-clang/bin/$(3)-cpp),cpp,clang++ -E)
92 _android-$(1)_DLLTOOL=
93 _android-$(1)_LD=$$(ANDROID_TOOLCHAIN_PREFIX)/$(1)-clang/bin/$(3)-ld
94 _android-$(1)_OBJDUMP="$$(ANDROID_TOOLCHAIN_PREFIX)/$(1)-clang/bin/$(3)-objdump"
95 _android-$(1)_RANLIB=$$(ANDROID_TOOLCHAIN_PREFIX)/$(1)-clang/bin/$(3)-ranlib
96 _android-$(1)_CMAKE=$$(ANDROID_SDK_PREFIX)/cmake/$(ANDROID_CMAKE_VERSION)/bin/cmake
97 _android-$(1)_STRIP=$$(ANDROID_TOOLCHAIN_PREFIX)/$(1)-clang/bin/$(3)-strip
99 _android-$(1)_AC_VARS= \
100 mono_cv_uscore=yes \
101 ac_cv_func_sched_getaffinity=no \
102 ac_cv_func_sched_setaffinity=no \
103 ac_cv_func_shm_open_working_with_mmap=no
105 _android-$(1)_CFLAGS= \
106 -fstack-protector \
107 -DMONODROID=1 $$(if $$(filter $$(ANDROID_NEW_NDK),yes),-D__ANDROID_API__=$$(ANDROID_SDK_VERSION_$(1)))
109 _android-$(1)_CXXFLAGS= \
110 -fstack-protector \
111 -DMONODROID=1 $$(if $$(filter $$(ANDROID_NEW_NDK),yes),-D__ANDROID_API__=$$(ANDROID_SDK_VERSION_$(1)))
114 _android-$(1)_CPPFLAGS= \
115 -I$$(ANDROID_TOOLCHAIN_PREFIX)/$(1)-clang/sysroot/usr/include
117 _android-$(1)_CXXCPPFLAGS= \
118 -I$$(ANDROID_TOOLCHAIN_PREFIX)/$(1)-clang/sysroot/usr/include
120 _android-$(1)_LDFLAGS= \
121 -z now -z relro -z noexecstack \
122 -ldl -lm -llog -lc -lgcc \
123 -Wl,-rpath-link=$$(ANDROID_TOOLCHAIN_DIR)/ndk/platforms/android-$$(ANDROID_SDK_VERSION_$(1))/arch-$(2)/usr/lib,-dynamic-linker=/system/bin/linker \
124 -L$$(ANDROID_TOOLCHAIN_DIR)/ndk/platforms/android-$$(ANDROID_SDK_VERSION_$(1))/arch-$(2)/usr/lib
126 _android-$(1)_CONFIGURE_FLAGS= \
127 --disable-boehm \
128 --disable-executables \
129 --disable-iconv \
130 --disable-mcs-build \
131 --disable-nls \
132 --enable-dynamic-btls \
133 --enable-maintainer-mode \
134 --enable-minimal=ssa,portability,attach,verifier,full_messages,sgen_remset,sgen_marksweep_par,sgen_marksweep_fixed,sgen_marksweep_fixed_par,sgen_copying,logging,security,shared_handles,interpreter \
135 --enable-monodroid \
136 --with-btls-android-ndk=$$(ANDROID_TOOLCHAIN_DIR)/ndk \
137 --with-btls-android-api=$$(ANDROID_SDK_VERSION_$(1)) \
138 $$(if $$(filter $$(ANDROID_NEW_NDK),yes),--with-btls-android-ndk-asm-workaround) \
139 --with-btls-android-cmake-toolchain=$$(ANDROID_TOOLCHAIN_DIR)/ndk/build/cmake/android.toolchain.cmake \
140 --with-sigaltstack=yes \
141 --with-tls=pthread \
142 --without-ikvm-native \
143 --disable-cooperative-suspend \
144 --disable-hybrid-suspend \
145 --disable-crash-reporting
147 .stamp-android-$(1)-toolchain: | $$(if $$(IGNORE_PROVISION_ANDROID),,provision-android)
148 python "$$(ANDROID_TOOLCHAIN_DIR)/ndk/build/tools/make_standalone_toolchain.py" --verbose --force --api=$$(ANDROID_SDK_VERSION_$(1)) --arch=$(2) --install-dir=$$(ANDROID_TOOLCHAIN_PREFIX)/$(1)-clang
149 touch $$@
151 $$(eval $$(call RuntimeTemplate,android,$(1),$(4)))
153 endef
156 # Parameters:
157 # $(1): target
158 # $(2): arch
159 # $(3): abi_name
160 # $(4): host_triple
162 # Flags:
163 # android-$(1)_CFLAGS
164 # android-$(1)_CXXFLAGS
165 # android-$(1)_LDFLAGS
166 define AndroidTargetTemplateStub
168 .stamp-android-$(1)-toolchain: | $$(if $$(IGNORE_PROVISION_ANDROID),,provision-android)
169 touch $$@
171 $$(eval $$(call RuntimeTemplateStub,android,$(1),$(4)))
173 endef
175 ## android-armeabi-v7a
176 android-armeabi-v7a_CFLAGS=-D__POSIX_VISIBLE=201002 -DSK_RELEASE -DNDEBUG -UDEBUG -fpic -march=armv7-a -mtune=cortex-a8 -mfpu=vfp -mfloat-abi=softfp
177 android-armeabi-v7a_CXXFLAGS=-D__POSIX_VISIBLE=201002 -DSK_RELEASE -DNDEBUG -UDEBUG -fpic -march=armv7-a -mtune=cortex-a8 -mfpu=vfp -mfloat-abi=softfp
178 android-armeabi-v7a_LDFLAGS=-Wl,--fix-cortex-a8
179 ifeq ($(UNAME),Windows)
180 $(eval $(call AndroidTargetTemplateStub,armeabi-v7a,arm,arm-linux-androideabi,armv5-linux-androideabi))
181 else
182 $(eval $(call AndroidTargetTemplate,armeabi-v7a,arm,arm-linux-androideabi,armv5-linux-androideabi))
183 endif
185 ## android-arm64-v8a
186 android-arm64-v8a_CFLAGS=-D__POSIX_VISIBLE=201002 -DSK_RELEASE -DNDEBUG -UDEBUG -fpic -DL_cuserid=9 -DANDROID64
187 android-arm64-v8a_CXXFLAGS=-D__POSIX_VISIBLE=201002 -DSK_RELEASE -DNDEBUG -UDEBUG -fpic -DL_cuserid=9 -DANDROID64
188 ifeq ($(UNAME),Windows)
189 $(eval $(call AndroidTargetTemplateStub,arm64-v8a,arm64,aarch64-linux-android,aarch64-linux-android))
190 else
191 $(eval $(call AndroidTargetTemplate,arm64-v8a,arm64,aarch64-linux-android,aarch64-linux-android))
192 endif
194 ## android-x86
195 ifeq ($(UNAME),Windows)
196 $(eval $(call AndroidTargetTemplateStub,x86,x86,i686-linux-android,i686-linux-android))
197 else
198 $(eval $(call AndroidTargetTemplate,x86,x86,i686-linux-android,i686-linux-android))
199 endif
201 ## android-x86_64
202 android-x86_64_CFLAGS=-DL_cuserid=9
203 android-x86_64_CXXFLAGS=-DL_cuserid=9
204 ifeq ($(UNAME),Windows)
205 $(eval $(call AndroidTargetTemplateStub,x86_64,x86_64,x86_64-linux-android,x86_64-linux-android))
206 else
207 $(eval $(call AndroidTargetTemplate,x86_64,x86_64,x86_64-linux-android,x86_64-linux-android))
208 endif
211 # Parameters
212 # $(1): target
214 # Flags:
215 # android-$(1)_CFLAGS
216 # android-$(1)_CXXFLAGS
217 define AndroidHostTemplate
219 _android-$(1)_AR=ar
220 _android-$(1)_AS=as
221 _android-$(1)_CC=cc
222 _android-$(1)_CXX=c++
223 _android-$(1)_CXXCPP=cpp
224 _android-$(1)_LD=ld
225 _android-$(1)_RANLIB=ranlib
226 _android-$(1)_STRIP=strip
228 _android-$(1)_CFLAGS= \
229 $$(if $$(filter $$(UNAME),Darwin),-mmacosx-version-min=10.9)
231 _android-$(1)_CONFIGURE_FLAGS= \
232 --disable-boehm \
233 --disable-iconv \
234 --disable-mono-debugger \
235 --disable-nls \
236 --disable-mcs-build \
237 --enable-dynamic-btls \
238 --enable-maintainer-mode \
239 --enable-monodroid \
240 --with-mcs-docs=no \
241 --without-ikvm-native \
242 --disable-crash-reporting
244 .stamp-android-$(1)-toolchain:
245 touch $$@
247 $$(eval $$(call RuntimeTemplate,android,$(1)))
249 endef
251 # on Windows, we use the AndroidHostMxeTemplate, instead
252 ifneq ($(UNAME),Windows)
253 $(eval $(call AndroidHostTemplate,host-$(UNAME)))
254 endif
257 # Parameters
258 # $(1): target
259 # $(2): arch
260 define AndroidHostMxeTemplate
262 _android-$(1)_PATH=$$(MXE_PREFIX)/bin
264 _android-$(1)_AR=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-ar
265 _android-$(1)_AS=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-as
266 _android-$(1)_CC=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-gcc
267 _android-$(1)_CXX=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-g++
268 _android-$(1)_DLLTOOL=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-dlltool
269 _android-$(1)_LD=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-ld
270 _android-$(1)_OBJDUMP=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-objdump
271 _android-$(1)_RANLIB=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-ranlib
272 _android-$(1)_STRIP=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-strip
274 # On Cygwin, assume x86_64-mingw32-zlib and i686-mingw32-zlib are installed
275 # TODO: WSL packages will depend on the distro
276 _android-$(1)_AC_VARS= \
277 $$(if $$(filter $$(UNAME),Windows),,ac_cv_header_zlib_h=no) \
278 ac_cv_search_dlopen=no
280 _android-$(1)_CFLAGS= \
281 -DXAMARIN_PRODUCT_VERSION=0 \
282 $$(if $$(filter $$(UNAME),Windows),,-I$$(MXE_PREFIX)/opt/mingw-zlib/usr/$(2)-w64-mingw32/include)
284 _android-$(1)_CXXFLAGS= \
285 -DXAMARIN_PRODUCT_VERSION=0 \
286 $$(if $$(filter $$(UNAME),Windows),,-I$$(MXE_PREFIX)/opt/mingw-zlib/usr/$(2)-w64-mingw32/include)
288 _android-$(1)_CONFIGURE_FLAGS= \
289 --disable-boehm \
290 --disable-llvm \
291 --disable-mcs-build \
292 --disable-nls \
293 --enable-static-gcc-libs \
294 --enable-maintainer-mode \
295 --enable-monodroid \
296 --with-monodroid \
297 --disable-crash-reporting
299 ifeq ($(UNAME),Darwin)
300 _android-$(1)_LDFLAGS= \
301 $$(MXE_PREFIX)/opt/mingw-zlib/usr/$(2)-w64-mingw32/lib/libz.a
302 endif
304 .stamp-android-$(1)-toolchain:
305 touch $$@
307 .stamp-android-$(1)-$$(CONFIGURATION)-configure: | $(if $(IGNORE_PROVISION_MXE),,provision-mxe)
309 $$(eval $$(call RuntimeTemplate,android,$(1),$(2)-w64-mingw32))
311 endef
313 ifneq ($(UNAME),Windows)
314 $(eval $(call AndroidHostMxeTemplate,host-mxe-Win32,i686))
315 $(eval $(call AndroidHostMxeTemplate,host-mxe-Win64,x86_64))
316 else
317 # on Windows the MinGW-built Mono is the host Mono. But we have to use the cross template
318 # because 'gcc' is the cygwin or WSL compiler, while the x86_64-w64-mingw32-gcc is the windows native compiler.
319 # TODO: build $(eval $(call AndroidHostMxeTemplate,host-mxe-Win64,x86_64))
320 # TODO: also build $(eval $(call AndroidHostMxeTemplate,host-mxe-Win32,i686))
321 endif
324 # Parameters
325 # $(1): target
326 # $(2): host arch
327 # $(3): target arch
328 # $(4): device target (armeabi-v7a, arm64-v8a, x86 or x86_64)
329 # $(5): llvm (llvm32, llvm64, llvmwin32 or llvmwin64)
330 # $(6): offsets dumper abi
331 define AndroidCrossTemplate
333 _android-$(1)_OFFSETS_DUMPER_ARGS=--gen-android --android-ndk="$$(ANDROID_TOOLCHAIN_DIR)/ndk"
335 _android-$(1)_AR=ar
336 _android-$(1)_AS=as
337 _android-$(1)_CC=$$(or $$(android-$(1)_CC),cc)
338 _android-$(1)_CXX=$$(or $$(android-$(1)_CXX),c++)
339 _android-$(1)_CXXCPP=cpp
340 _android-$(1)_LD=ld
341 _android-$(1)_RANLIB=ranlib
342 _android-$(1)_STRIP=strip
344 _android-$(1)_CFLAGS= \
345 $$(if $$(RELEASE),,-DDEBUG_CROSS) \
346 $$(if $$(filter $$(UNAME),Darwin),-mmacosx-version-min=10.9) \
347 -DXAMARIN_PRODUCT_VERSION=0
349 _android-$(1)_CXXFLAGS= \
350 $$(if $$(RELEASE),,-DDEBUG_CROSS) \
351 $$(if $$(filter $$(UNAME),Darwin),-mmacosx-version-min=10.9 -stdlib=libc++) \
352 -DXAMARIN_PRODUCT_VERSION=0
354 _android-$(1)_CONFIGURE_FLAGS= \
355 --disable-boehm \
356 --disable-mcs-build \
357 --disable-nls \
358 --enable-maintainer-mode \
359 --with-tls=pthread
361 $$(eval $$(call CrossRuntimeTemplate,android,$(1),$$(if $$(filter $$(UNAME),Darwin),$(2)-apple-darwin10,$$(if $$(filter $$(UNAME),Linux),$(2)-linux-gnu)),$(3)-linux-android,$(4),$(5),$(6)))
363 endef
366 # Parameters
367 # $(1): target
368 # $(2): host arch
369 # $(3): target arch
370 # $(4): device target (armeabi-v7a, arm64-v8a, x86 or x86_64)
371 # $(5): llvm (llvm32, llvm64, llvmwin32 or llvmwin64)
372 # $(6): offsets dumper abi
373 define AndroidCrossTemplateStub
375 $$(eval $$(call CrossRuntimeTemplateStub,android,$(1),$$(if $$(filter $$(UNAME),Darwin),$(2)-apple-darwin10,$$(if $$(filter $$(UNAME),Linux),$(2)-linux-gnu)),$(3)-linux-android,$(4),$(5),$(6)))
377 endef
379 ifeq ($(UNAME),Windows)
380 $(eval $(call AndroidCrossTemplateStub,cross-arm,i686,armv7,armeabi-v7a,llvm-llvm32,armv7-none-linux-androideabi))
381 $(eval $(call AndroidCrossTemplateStub,cross-arm64,x86_64,aarch64-v8a,arm64-v8a,llvm-llvm64,aarch64-v8a-linux-android))
382 $(eval $(call AndroidCrossTemplateStub,cross-x86,i686,i686,x86,llvm-llvm32,i686-none-linux-android))
383 $(eval $(call AndroidCrossTemplateStub,cross-x86_64,x86_64,x86_64,x86_64,llvm-llvm64,x86_64-none-linux-android))
384 else
385 $(eval $(call AndroidCrossTemplate,cross-arm,i686,armv7,armeabi-v7a,llvm-llvm32,armv7-none-linux-androideabi))
386 $(eval $(call AndroidCrossTemplate,cross-arm64,x86_64,aarch64-v8a,arm64-v8a,llvm-llvm64,aarch64-v8a-linux-android))
387 $(eval $(call AndroidCrossTemplate,cross-x86,i686,i686,x86,llvm-llvm32,i686-none-linux-android))
388 $(eval $(call AndroidCrossTemplate,cross-x86_64,x86_64,x86_64,x86_64,llvm-llvm64,x86_64-none-linux-android))
389 endif
392 # Parameters
393 # $(1): target
394 # $(2): host arch
395 # $(3): target arch
396 # $(4): device target
397 # $(5): llvm
398 # $(6): offsets dumper abi
399 define AndroidCrossMXETemplate
401 _android-$(1)_OFFSETS_DUMPER_ARGS=--gen-android --android-ndk="$$(ANDROID_TOOLCHAIN_DIR)/ndk"
403 _android-$(1)_PATH=$$(MXE_PREFIX)/bin
405 _android-$(1)_AR=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-ar
406 _android-$(1)_AS=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-as
407 _android-$(1)_CC=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-gcc
408 _android-$(1)_CXX=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-g++
409 _android-$(1)_DLLTOOL=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-dlltool
410 _android-$(1)_LD=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-ld
411 _android-$(1)_OBJDUMP=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-objdump
412 _android-$(1)_RANLIB=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-ranlib
413 _android-$(1)_STRIP=$$(MXE_PREFIX)/bin/$(2)-w64-mingw32-strip
415 _android-$(1)_CFLAGS= \
416 $$(if $$(RELEASE),,-DDEBUG_CROSS) \
417 -DXAMARIN_PRODUCT_VERSION=0 \
418 -I$$(MXE_PREFIX)/opt/mingw-zlib/usr/$(2)-w64-mingw32/include
420 _android-$(1)_CXXFLAGS= \
421 $$(if $$(RELEASE),,-DDEBUG_CROSS) \
422 -DXAMARIN_PRODUCT_VERSION=0 \
423 -I$$(MXE_PREFIX)/opt/mingw-zlib/usr/$(2)-w64-mingw32/include
425 _android-$(1)_LDFLAGS=
428 _android-$(1)_CONFIGURE_FLAGS= \
429 --disable-boehm \
430 --disable-mcs-build \
431 --disable-nls \
432 --enable-static-gcc-libs \
433 --enable-maintainer-mode \
434 --with-tls=pthread
436 ifeq ($(UNAME),Darwin)
437 _android-$(1)_CONFIGURE_FLAGS += \
438 --with-static-zlib=$$(MXE_PREFIX)/opt/mingw-zlib/usr/$(2)-w64-mingw32/lib/libz.a
439 endif
441 .stamp-android-$(1)-$$(CONFIGURATION)-configure: | $(if $(IGNORE_PROVISION_MXE),,provision-mxe)
443 $$(eval $$(call CrossRuntimeTemplate,android,$(1),$(2)-w64-mingw32,$(3)-linux-android,$(4),$(5),$(6)))
445 endef
448 # Parameters
449 # $(1): target
450 # $(2): host arch
451 # $(3): target arch
452 # $(4): device target
453 # $(5): llvm
454 # $(6): offsets dumper abi
455 define AndroidCrossMXETemplateStub
457 $$(eval $$(call CrossRuntimeTemplateStub,android,$(1),$(2)-w64-mingw32,$(3)-linux-android,$(4),$(5),$(6)))
459 endef
461 ifneq ($(UNAME),Windows)
462 $(eval $(call AndroidCrossMXETemplate,cross-arm-win,i686,armv7,armeabi-v7a,llvm-llvmwin32,armv7-none-linux-androideabi))
463 $(eval $(call AndroidCrossMXETemplate,cross-arm64-win,x86_64,aarch64-v8a,arm64-v8a,llvm-llvmwin64,aarch64-v8a-linux-android))
464 $(eval $(call AndroidCrossMXETemplate,cross-x86-win,i686,i686,x86,llvm-llvmwin32,i686-none-linux-android))
465 $(eval $(call AndroidCrossMXETemplate,cross-x86_64-win,x86_64,x86_64,x86_64,llvm-llvmwin64,x86_64-none-linux-android))
466 else
467 $(eval $(call AndroidCrossMXETemplateStub,cross-arm-win,i686,armv7,armeabi-v7a,llvm-llvmwin32,armv7-none-linux-androideabi))
468 $(eval $(call AndroidCrossMXETemplateStub,cross-arm64-win,x86_64,aarch64-v8a,arm64-v8a,llvm-llvmwin64,aarch64-v8a-linux-android))
469 $(eval $(call AndroidCrossMXETemplateStub,cross-x86-win,i686,i686,x86,llvm-llvmwin32,i686-none-linux-android))
470 $(eval $(call AndroidCrossMXETemplateStub,cross-x86_64-win,x86_64,x86_64,x86_64,llvm-llvmwin64,x86_64-none-linux-android))
471 endif
473 ifeq ($(UNAME),Windows)
474 _bcl_android_BUILD_FLAGS += \
475 PROFILE_PLATFORM=win32
476 endif
478 $(eval $(call BclTemplate,android,monodroid monodroid_tools,monodroid monodroid_tools))
480 $(android_SOURCES_DIR)/external/linker/README.md: # we use this as a sentinel file to avoid rsyncing everything on each build (slows down iterating)
481 mkdir -p $(android_SOURCES_DIR)/external/linker
482 cd $(TOP) && rsync -r --include='*.cs' --include="README.md" --include="*/" --exclude="*" external/linker $(android_SOURCES_DIR)/external
484 $(android_SOURCES_DIR): $(android_SOURCES_DIR)/external/linker/README.md