1# Copyright (c) 2012 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# This Android makefile is used to build WebView in the Android build system.
6# gyp autogenerates most of the real makefiles, which we include below.
7
8LOCAL_PATH := $(call my-dir)
9CHROMIUM_DIR := $(LOCAL_PATH)
10
11# We default to release for the Android build system. Developers working on
12# WebView code can build with "make GYP_CONFIGURATION=Debug".
13GYP_CONFIGURATION := Release
14
15# If the product is using a prebuilt libwebviewchromium then we need to skip
16# including most of the makefiles to avoid duplicate target definitions. Some
17# targets are still needed, so list their makefiles explicitly.
18ifeq ($(PRODUCT_PREBUILT_WEBVIEWCHROMIUM),yes)
19GYP_MAKEFILE_STEMS := \
20	$(addprefix $(CHROMIUM_DIR)/v8/tools/gyp/, \
21		js2c.host \
22		mksnapshot.host \
23		v8_base.host \
24		v8_libbase.host \
25		v8_libplatform.host \
26		v8_nosnapshot.host \
27		v8_base.target \
28		v8_libbase.target \
29		v8_snapshot.target \
30	) \
31	$(addprefix $(CHROMIUM_DIR)/third_party/icu/, \
32		icudata.host \
33		icui18n.host \
34		icuuc.host \
35		icui18n.target \
36		icuuc.target \
37		system_icu.target \
38	)
39else
40# Not using a prebuilt; include the manually-written makefile that builds all
41# the WebView java code, and use the main autogenerated makefile.
42include $(CHROMIUM_DIR)/android_webview/Android.mk
43GYP_MAKEFILE_STEMS := $(CHROMIUM_DIR)/GypAndroid
44endif
45
46# If the gyp-generated makefile exists for the current host OS and primary
47# target architecture, we need to include it. If it doesn't exist then just do
48# nothing, since we may not have finished bringing up this architecture yet.
49ifneq (,$(wildcard $(CHROMIUM_DIR)/GypAndroid.$(HOST_OS)-$(TARGET_ARCH).mk))
50
51# We set GYP_VAR_PREFIX to the empty string to indicate that we are building for
52# the primary target architecture.
53GYP_VAR_PREFIX :=
54
55# If the host is declared as being 64-bit, set the host multilib variables
56# appropriately to ensure that the host targets are the same "bitness" as the
57# primary target, which is required by V8.
58ifeq ($(HOST_IS_64_BIT),true)
59ifeq ($(TARGET_IS_64_BIT),true)
60GYP_HOST_VAR_PREFIX :=
61GYP_HOST_MULTILIB := 64
62else  # Target is 32-bit.
63GYP_HOST_VAR_PREFIX := $(HOST_2ND_ARCH_VAR_PREFIX)
64GYP_HOST_MULTILIB := 32
65endif
66endif
67
68# Include the appropriate version of each of the makefiles.
69include $(addsuffix .$(HOST_OS)-$(TARGET_ARCH).mk,$(GYP_MAKEFILE_STEMS))
70
71endif  # End primary architecture handling.
72
73# Do the same check for the secondary architecture; if this doesn't exist then
74# the current target platform probably doesn't have a secondary architecture and
75# we can just do nothing.
76ifneq (,$(wildcard $(CHROMIUM_DIR)/GypAndroid.$(HOST_OS)-$(TARGET_2ND_ARCH).mk))
77
78# We set GYP_VAR_PREFIX to $(TARGET_2ND_ARCH_VAR_PREFIX) to indicate that we are
79# building for the secondary target architecture.
80GYP_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
81
82# If the host is declared as being 64-bit, set the host multilib variables
83# appropriately to ensure that the host targets are the same "bitness" as the
84# secondary target, which is required by V8.
85ifeq ($(HOST_IS_64_BIT),true)
86ifeq ($(2ND_TARGET_IS_64_BIT),true)
87GYP_HOST_VAR_PREFIX :=
88GYP_HOST_MULTILIB := 64
89else  # Second target is 32-bit.
90GYP_HOST_VAR_PREFIX := $(HOST_2ND_ARCH_VAR_PREFIX)
91GYP_HOST_MULTILIB := 32
92endif
93endif
94
95# Include the appropriate version of each of the makefiles.
96include $(addsuffix .$(HOST_OS)-$(TARGET_2ND_ARCH).mk,$(GYP_MAKEFILE_STEMS))
97
98endif  # End secondary architecture handling.
99