2 ## Copyright 2009, The Android Open Source Project
4 ## Redistribution and use in source and binary forms, with or without
5 ## modification, are permitted provided that the following conditions
7 ## * Redistributions of source code must retain the above copyright
8 ## notice, this list of conditions and the following disclaimer.
9 ## * Redistributions in binary form must reproduce the above copyright
10 ## notice, this list of conditions and the following disclaimer in the
11 ## documentation and/or other materials provided with the distribution.
13 ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
14 ## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 ## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 ## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 ## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 ## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 ## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 ## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 ## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 LOCAL_PATH := $(call my-dir)
28 # Two ways to control which JS engine is used:
29 # 1. use JS_ENGINE environment variable, value can be either 'jsc' or 'v8'
30 # This is the preferred way.
31 # 2. if JS_ENGINE is not set, or is not 'jsc' or 'v8', this makefile picks
32 # up a default engine to build.
33 # To help setup buildbot, a new environment variable, USE_ALT_JS_ENGINE,
34 # can be set to true, so that two builds can be different but without
35 # specifying which JS engine to use.
37 # To enable JIT in Android's JSC, please set ENABLE_JSC_JIT environment
40 # Read JS_ENGINE environment variable
41 JAVASCRIPT_ENGINE = $(JS_ENGINE)
43 # The default / alternative engine depends on the device class.
44 # On devices with a lot of memory (e.g. Passion/Sholes), the
45 # default is V8. On everything else, the only choice is JSC.
46 # TODO: use ARCH_ARM_HAVE_ARMV7 once that variable is added to
48 ifeq ($(ARCH_ARM_HAVE_VFP),true)
56 ifneq ($(JAVASCRIPT_ENGINE),jsc)
57 ifneq ($(JAVASCRIPT_ENGINE),v8)
58 # No JS engine is specified, pickup the one we want as default.
59 ifeq ($(USE_ALT_JS_ENGINE),true)
60 JAVASCRIPT_ENGINE = $(ALT_ENGINE)
62 JAVASCRIPT_ENGINE = $(DEFAULT_ENGINE)
67 BASE_PATH := $(call my-dir)
70 # Define our module and find the intermediates directory
71 LOCAL_MODULE := libwebcore
72 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
73 base_intermediates := $(call local-intermediates-dir)
75 # Using := here prevents recursive expansion
78 # We have to use bison 2.3
79 include $(BASE_PATH)/bison_check.mk
81 # Build our list of include paths. We include WebKit/android/icu first so that
82 # any files that include <unicode/ucnv.h> will include our ucnv.h first. We
83 # also add external/ as an include directory so that we can specify the real
84 # icu header directory as a more exact reference to avoid including our ucnv.h.
86 # Note that JavasCriptCore/ must be included after WebCore/, so that we pick up
90 $(LOCAL_PATH)/WebKit/android/icu \
92 external/icu4c/common \
94 external/libxml2/include \
97 external/skia/include/core \
98 external/skia/include/effects \
99 external/skia/include/images \
100 external/skia/include/ports \
101 external/skia/include/utils \
102 external/skia/src/ports \
103 external/sqlite/dist \
104 frameworks/base/core/jni/android/graphics
106 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
107 $(LOCAL_PATH)/WebCore \
108 $(LOCAL_PATH)/WebCore/accessibility \
109 $(LOCAL_PATH)/WebCore/bindings/generic \
110 $(LOCAL_PATH)/WebCore/css \
111 $(LOCAL_PATH)/WebCore/dom \
112 $(LOCAL_PATH)/WebCore/editing \
113 $(LOCAL_PATH)/WebCore/history \
114 $(LOCAL_PATH)/WebCore/history/android \
115 $(LOCAL_PATH)/WebCore/html \
116 $(LOCAL_PATH)/WebCore/html/canvas \
117 $(LOCAL_PATH)/WebCore/inspector \
118 $(LOCAL_PATH)/WebCore/loader \
119 $(LOCAL_PATH)/WebCore/loader/appcache \
120 $(LOCAL_PATH)/WebCore/loader/icon \
121 $(LOCAL_PATH)/WebCore/notifications \
122 $(LOCAL_PATH)/WebCore/page \
123 $(LOCAL_PATH)/WebCore/page/android \
124 $(LOCAL_PATH)/WebCore/page/animation \
125 $(LOCAL_PATH)/WebCore/platform \
126 $(LOCAL_PATH)/WebCore/platform/android \
127 $(LOCAL_PATH)/WebCore/platform/animation \
128 $(LOCAL_PATH)/WebCore/platform/graphics \
129 $(LOCAL_PATH)/WebCore/platform/graphics/android \
130 $(LOCAL_PATH)/WebCore/platform/graphics/filters \
131 $(LOCAL_PATH)/WebCore/platform/graphics/network \
132 $(LOCAL_PATH)/WebCore/platform/graphics/skia \
133 $(LOCAL_PATH)/WebCore/platform/graphics/transforms \
134 $(LOCAL_PATH)/WebCore/platform/image-decoders \
135 $(LOCAL_PATH)/WebCore/platform/image-decoders/bmp \
136 $(LOCAL_PATH)/WebCore/platform/image-decoders/gif \
137 $(LOCAL_PATH)/WebCore/platform/image-decoders/ico \
138 $(LOCAL_PATH)/WebCore/platform/image-decoders/jpeg \
139 $(LOCAL_PATH)/WebCore/platform/image-decoders/png \
140 $(LOCAL_PATH)/WebCore/platform/mock \
141 $(LOCAL_PATH)/WebCore/platform/network \
142 $(LOCAL_PATH)/WebCore/platform/network/android \
143 $(LOCAL_PATH)/WebCore/platform/sql \
144 $(LOCAL_PATH)/WebCore/platform/text \
145 $(LOCAL_PATH)/WebCore/plugins \
146 $(LOCAL_PATH)/WebCore/plugins/android \
147 $(LOCAL_PATH)/WebCore/rendering \
148 $(LOCAL_PATH)/WebCore/rendering/style \
149 $(LOCAL_PATH)/WebCore/storage \
150 $(LOCAL_PATH)/WebCore/svg \
151 $(LOCAL_PATH)/WebCore/svg/animation \
152 $(LOCAL_PATH)/WebCore/svg/graphics \
153 $(LOCAL_PATH)/WebCore/svg/graphics/filters \
154 $(LOCAL_PATH)/WebCore/websockets \
155 $(LOCAL_PATH)/WebCore/workers \
156 $(LOCAL_PATH)/WebCore/xml
158 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
159 $(LOCAL_PATH)/WebKit/android \
160 $(LOCAL_PATH)/WebKit/android/WebCoreSupport \
161 $(LOCAL_PATH)/WebKit/android/jni \
162 $(LOCAL_PATH)/WebKit/android/nav \
163 $(LOCAL_PATH)/WebKit/android/plugins
165 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
166 $(LOCAL_PATH)/JavaScriptCore \
167 $(LOCAL_PATH)/JavaScriptCore/wtf \
168 $(LOCAL_PATH)/JavaScriptCore/wtf/unicode \
169 $(LOCAL_PATH)/JavaScriptCore/wtf/unicode/icu
171 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
172 $(base_intermediates)/WebCore/ \
173 $(base_intermediates)/WebCore/css \
174 $(base_intermediates)/WebCore/html \
175 $(base_intermediates)/WebCore/platform
177 ifeq ($(JAVASCRIPT_ENGINE),v8)
178 # Include WTF source file.
180 LOCAL_PATH := $(BASE_PATH)/$d
181 intermediates := $(base_intermediates)/$d
182 include $(LOCAL_PATH)/Android.v8.wtf.mk
183 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
184 endif # JAVASCRIPT_ENGINE == v8
186 # Include source files for WebCore
188 LOCAL_PATH := $(BASE_PATH)/$d
189 JAVASCRIPTCORE_PATH := $(BASE_PATH)/JavaScriptCore
190 intermediates := $(base_intermediates)/$d
191 include $(LOCAL_PATH)/Android.mk
192 ifeq ($(JAVASCRIPT_ENGINE),jsc)
193 include $(LOCAL_PATH)/Android.jscbindings.mk
195 ifeq ($(JAVASCRIPT_ENGINE),v8)
196 include $(LOCAL_PATH)/Android.v8bindings.mk
198 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
199 LOCAL_C_INCLUDES += $(BINDING_C_INCLUDES)
201 # Include the derived source files for WebCore. Uses the same path as
203 include $(LOCAL_PATH)/Android.derived.mk
204 ifeq ($(JAVASCRIPT_ENGINE),jsc)
205 include $(LOCAL_PATH)/Android.derived.jscbindings.mk
207 ifeq ($(JAVASCRIPT_ENGINE),v8)
208 include $(LOCAL_PATH)/Android.derived.v8bindings.mk
211 # Include source files for android WebKit port
213 LOCAL_PATH := $(BASE_PATH)/$d
214 intermediates := $(base_intermediates)/$d
215 include $(LOCAL_PATH)/Android.mk
216 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
218 # Redefine LOCAL_PATH here so the build system is not confused
219 LOCAL_PATH := $(BASE_PATH)
221 # Define our compiler flags
222 LOCAL_CFLAGS += -Wno-endif-labels -Wno-import -Wno-format
223 LOCAL_CFLAGS += -fno-strict-aliasing
224 LOCAL_CFLAGS += -include "WebCorePrefix.h"
225 LOCAL_CFLAGS += -fvisibility=hidden
227 # Enable JSC JIT if JSC is used and ENABLE_JSC_JIT environment
228 # variable is set to true
229 ifeq ($(JAVASCRIPT_ENGINE),jsc)
230 ifeq ($(ENABLE_JSC_JIT),true)
231 LOCAL_CFLAGS += -DENABLE_ANDROID_JSC_JIT=1
235 ifeq ($(TARGET_ARCH),arm)
236 LOCAL_CFLAGS += -Darm
237 # remove this warning: "note: the mangling of 'va_list' has changed in GCC 4.4"
238 LOCAL_CFLAGS += -Wno-psabi
241 # need a flag to tell the C side when we're on devices with large memory
242 # budgets (i.e. larger than the low-end devices that initially shipped)
243 ifeq ($(ARCH_ARM_HAVE_VFP),true)
244 LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
247 ifeq ($(ENABLE_SVG),true)
248 LOCAL_CFLAGS += -DENABLE_SVG=1
251 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),false)
252 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=0
255 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),true)
256 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=1
259 # Temporary disable SVG_ANIMATION.
260 ifeq ($(ENABLE_SVG_ANIMATION),true)
261 LOCAL_CFLAGS += -DENABLE_SVG_ANIMATION=1
264 ifeq ($(WEBCORE_INSTRUMENTATION),true)
265 LOCAL_CFLAGS += -DANDROID_INSTRUMENT
268 # LOCAL_LDLIBS is used in simulator builds only and simulator builds are only
270 LOCAL_LDLIBS += -lpthread -ldl
272 # Build the list of shared libraries
273 LOCAL_SHARED_LIBRARIES := \
285 libsurfaceflinger_client
287 ifeq ($(WEBCORE_INSTRUMENTATION),true)
288 LOCAL_SHARED_LIBRARIES += libhardware_legacy
291 # We have to use the android version of libdl when we are not on the simulator
292 ifneq ($(TARGET_SIMULATOR),true)
293 LOCAL_SHARED_LIBRARIES += libdl libstlport
294 include external/stlport/libstlport.mk
297 # Build the list of static libraries
298 LOCAL_STATIC_LIBRARIES := libxml2 libxslt
299 ifeq ($(JAVASCRIPT_ENGINE),v8)
300 LOCAL_STATIC_LIBRARIES += libv8
303 # Redefine LOCAL_SRC_FILES to be all the WebKit source files
304 LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES)
306 # Define this for use in other makefiles.
307 WEBKIT_C_INCLUDES := $(LOCAL_C_INCLUDES)
308 WEBKIT_CFLAGS := $(LOCAL_CFLAGS)
309 WEBKIT_GENERATED_SOURCES := $(LOCAL_GENERATED_SOURCES)
310 WEBKIT_LDLIBS := $(LOCAL_LDLIBS)
311 WEBKIT_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES)
312 WEBKIT_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES)
314 # Build the library all at once
315 include $(BUILD_STATIC_LIBRARY)
317 ifeq ($(JAVASCRIPT_ENGINE),jsc)
318 # Now build libjs as a static library.
319 include $(CLEAR_VARS)
320 LOCAL_MODULE := libjs
321 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
322 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
323 LOCAL_STATIC_LIBRARIES := $(WEBKIT_STATIC_LIBRARIES)
324 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
325 # Include source files for JavaScriptCore
327 LOCAL_PATH := $(BASE_PATH)/$d
328 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
329 # Cannot use base_intermediates as this is a new module
330 intermediates := $(call local-intermediates-dir)
331 include $(LOCAL_PATH)/Android.mk
332 # Redefine LOCAL_SRC_FILES with the correct prefix
333 LOCAL_SRC_FILES := $(addprefix $d/,$(LOCAL_SRC_FILES))
334 # Use the base path to resolve file names
335 LOCAL_PATH := $(BASE_PATH)
336 # Append jsc intermediate include paths to the WebKit include list.
337 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) \
339 $(intermediates)/parser \
340 $(intermediates)/runtime \
342 include $(BUILD_STATIC_LIBRARY)
343 endif # JAVASCRIPT_ENGINE == jsc
345 # Now build the shared library using only the exported jni entry point. This
346 # will strip out any unused code from the entry point.
347 include $(CLEAR_VARS)
348 # if you need to make webcore huge (for debugging), enable this line
349 #LOCAL_PRELINK_MODULE := false
350 LOCAL_MODULE := libwebcore
351 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
352 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
353 LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES)
354 ifeq ($(JAVASCRIPT_ENGINE),jsc)
355 LOCAL_STATIC_LIBRARIES += libjs
357 LOCAL_LDFLAGS := -fvisibility=hidden
358 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
359 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES)
360 LOCAL_PATH := $(BASE_PATH)
362 WebKit/android/jni/WebCoreJniOnLoad.cpp
363 # Do this dependency by hand. The reason we have to do this is because the
364 # headers that this file pulls in are generated during the build of webcore.
365 # We make all of our object files depend on those files so that they are built
366 # before we try to compile the file.
367 LOCAL_ADDITIONAL_DEPENDENCIES := $(filter %.h, $(WEBKIT_GENERATED_SOURCES))
368 include $(BUILD_SHARED_LIBRARY)
370 # Build the wds client
371 include $(BASE_PATH)/WebKit/android/wds/client/Android.mk
373 # Build the performance command line tool.
374 include $(BASE_PATH)/WebKit/android/benchmark/Android.mk
376 # Build the webkit merge tool.
377 include $(BASE_PATH)/WebKitTools/android/webkitmerge/Android.mk