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 # Control SVG compiling in webkit.
29 # Default is true unless explictly disabled.
30 ifneq ($(ENABLE_SVG),false)
34 # Two ways to control which JS engine is used:
35 # 1. use JS_ENGINE environment variable, value can be either 'jsc' or 'v8'
36 # This is the preferred way.
37 # 2. if JS_ENGINE is not set, or is not 'jsc' or 'v8', this makefile picks
38 # up a default engine to build.
39 # To help setup buildbot, a new environment variable, USE_ALT_JS_ENGINE,
40 # can be set to true, so that two builds can be different but without
41 # specifying which JS engine to use.
42 # To enable JIT in Android's JSC, please set ENABLE_JSC_JIT environment
45 # To enable JIT in Android's JSC, please set ENABLE_JSC_JIT environment
48 # Read JS_ENGINE environment variable
49 JAVASCRIPT_ENGINE = $(JS_ENGINE)
51 # The default / alternative engine depends on the device class.
52 # On devices with a lot of memory (e.g. Passion/Sholes), the
53 # default is V8. On everything else, the only choice is JSC.
54 # TODO: use ARCH_ARM_HAVE_ARMV7 once that variable is added to
56 ifeq ($(ARCH_ARM_HAVE_VFP),true)
64 ifneq ($(JAVASCRIPT_ENGINE),jsc)
65 ifneq ($(JAVASCRIPT_ENGINE),v8)
66 # No JS engine is specified, pickup the one we want as default.
67 ifeq ($(USE_ALT_JS_ENGINE),true)
68 JAVASCRIPT_ENGINE = $(ALT_ENGINE)
70 JAVASCRIPT_ENGINE = $(DEFAULT_ENGINE)
75 BASE_PATH := $(call my-dir)
78 # Define our module and find the intermediates directory
79 LOCAL_MODULE := libwebcore
80 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
81 base_intermediates := $(call local-intermediates-dir)
83 # Using := here prevents recursive expansion
86 # We have to use bison 2.3
87 include $(BASE_PATH)/bison_check.mk
89 # Build our list of include paths. We include WebKit/android/icu first so that
90 # any files that include <unicode/ucnv.h> will include our ucnv.h first. We
91 # also add external/ as an include directory so that we can specify the real
92 # icu header directory as a more exact reference to avoid including our ucnv.h.
94 # Note that JavasCriptCore/ must be included after WebCore/, so that we pick up
98 $(LOCAL_PATH)/WebKit/android/icu \
100 external/icu4c/common \
101 external/icu4c/i18n \
102 external/libxml2/include \
104 external/skia/emoji \
105 external/skia/include/core \
106 external/skia/include/effects \
107 external/skia/include/images \
108 external/skia/include/ports \
109 external/skia/include/utils \
110 external/skia/src/ports \
111 external/sqlite/dist \
112 frameworks/base/core/jni/android/graphics
114 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
115 $(LOCAL_PATH)/WebCore \
116 $(LOCAL_PATH)/WebCore/accessibility \
117 $(LOCAL_PATH)/WebCore/bindings/generic \
118 $(LOCAL_PATH)/WebCore/css \
119 $(LOCAL_PATH)/WebCore/dom \
120 $(LOCAL_PATH)/WebCore/editing \
121 $(LOCAL_PATH)/WebCore/history \
122 $(LOCAL_PATH)/WebCore/history/android \
123 $(LOCAL_PATH)/WebCore/html \
124 $(LOCAL_PATH)/WebCore/html/canvas \
125 $(LOCAL_PATH)/WebCore/inspector \
126 $(LOCAL_PATH)/WebCore/loader \
127 $(LOCAL_PATH)/WebCore/loader/appcache \
128 $(LOCAL_PATH)/WebCore/loader/icon \
129 $(LOCAL_PATH)/WebCore/notifications \
130 $(LOCAL_PATH)/WebCore/page \
131 $(LOCAL_PATH)/WebCore/page/android \
132 $(LOCAL_PATH)/WebCore/page/animation \
133 $(LOCAL_PATH)/WebCore/platform \
134 $(LOCAL_PATH)/WebCore/platform/android \
135 $(LOCAL_PATH)/WebCore/platform/animation \
136 $(LOCAL_PATH)/WebCore/platform/graphics \
137 $(LOCAL_PATH)/WebCore/platform/graphics/android \
138 $(LOCAL_PATH)/WebCore/platform/graphics/filters \
139 $(LOCAL_PATH)/WebCore/platform/graphics/network \
140 $(LOCAL_PATH)/WebCore/platform/graphics/skia \
141 $(LOCAL_PATH)/WebCore/platform/graphics/transforms \
142 $(LOCAL_PATH)/WebCore/platform/image-decoders \
143 $(LOCAL_PATH)/WebCore/platform/image-decoders/bmp \
144 $(LOCAL_PATH)/WebCore/platform/image-decoders/gif \
145 $(LOCAL_PATH)/WebCore/platform/image-decoders/ico \
146 $(LOCAL_PATH)/WebCore/platform/image-decoders/jpeg \
147 $(LOCAL_PATH)/WebCore/platform/image-decoders/png \
148 $(LOCAL_PATH)/WebCore/platform/mock \
149 $(LOCAL_PATH)/WebCore/platform/network \
150 $(LOCAL_PATH)/WebCore/platform/network/android \
151 $(LOCAL_PATH)/WebCore/platform/sql \
152 $(LOCAL_PATH)/WebCore/platform/text \
153 $(LOCAL_PATH)/WebCore/plugins \
154 $(LOCAL_PATH)/WebCore/plugins/android \
155 $(LOCAL_PATH)/WebCore/rendering \
156 $(LOCAL_PATH)/WebCore/rendering/style \
157 $(LOCAL_PATH)/WebCore/storage \
158 $(LOCAL_PATH)/WebCore/svg \
159 $(LOCAL_PATH)/WebCore/svg/animation \
160 $(LOCAL_PATH)/WebCore/svg/graphics \
161 $(LOCAL_PATH)/WebCore/svg/graphics/filters \
162 $(LOCAL_PATH)/WebCore/websockets \
163 $(LOCAL_PATH)/WebCore/workers \
164 $(LOCAL_PATH)/WebCore/xml
166 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
167 $(LOCAL_PATH)/WebKit/android \
168 $(LOCAL_PATH)/WebKit/android/WebCoreSupport \
169 $(LOCAL_PATH)/WebKit/android/jni \
170 $(LOCAL_PATH)/WebKit/android/nav \
171 $(LOCAL_PATH)/WebKit/android/plugins
173 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
174 $(LOCAL_PATH)/JavaScriptCore \
175 $(LOCAL_PATH)/JavaScriptCore/wtf \
176 $(LOCAL_PATH)/JavaScriptCore/wtf/unicode \
177 $(LOCAL_PATH)/JavaScriptCore/wtf/unicode/icu
179 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
180 $(base_intermediates)/WebCore/ \
181 $(base_intermediates)/WebCore/css \
182 $(base_intermediates)/WebCore/html \
183 $(base_intermediates)/WebCore/platform
185 ifeq ($(JAVASCRIPT_ENGINE),v8)
186 # Include WTF source file.
188 LOCAL_PATH := $(BASE_PATH)/$d
189 intermediates := $(base_intermediates)/$d
190 include $(LOCAL_PATH)/Android.v8.wtf.mk
191 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
192 endif # JAVASCRIPT_ENGINE == v8
194 # Include source files for WebCore
196 LOCAL_PATH := $(BASE_PATH)/$d
197 JAVASCRIPTCORE_PATH := $(BASE_PATH)/JavaScriptCore
198 intermediates := $(base_intermediates)/$d
199 include $(LOCAL_PATH)/Android.mk
200 ifeq ($(JAVASCRIPT_ENGINE),jsc)
201 include $(LOCAL_PATH)/Android.jscbindings.mk
203 ifeq ($(JAVASCRIPT_ENGINE),v8)
204 include $(LOCAL_PATH)/Android.v8bindings.mk
206 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
207 LOCAL_C_INCLUDES += $(BINDING_C_INCLUDES)
209 # Include the derived source files for WebCore. Uses the same path as
211 include $(LOCAL_PATH)/Android.derived.mk
212 ifeq ($(JAVASCRIPT_ENGINE),jsc)
213 include $(LOCAL_PATH)/Android.derived.jscbindings.mk
215 ifeq ($(JAVASCRIPT_ENGINE),v8)
216 include $(LOCAL_PATH)/Android.derived.v8bindings.mk
219 # Include source files for android WebKit port
221 LOCAL_PATH := $(BASE_PATH)/$d
222 intermediates := $(base_intermediates)/$d
223 include $(LOCAL_PATH)/Android.mk
224 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
226 # Redefine LOCAL_PATH here so the build system is not confused
227 LOCAL_PATH := $(BASE_PATH)
229 # Define our compiler flags
230 LOCAL_CFLAGS += -Wno-endif-labels -Wno-import -Wno-format
231 LOCAL_CFLAGS += -fno-strict-aliasing
232 LOCAL_CFLAGS += -include "WebCorePrefix.h"
233 LOCAL_CFLAGS += -fvisibility=hidden
235 # Enable JSC JIT if JSC is used and ENABLE_JSC_JIT environment
236 # variable is set to true
237 ifeq ($(JAVASCRIPT_ENGINE),jsc)
238 ifeq ($(ENABLE_JSC_JIT),true)
239 LOCAL_CFLAGS += -DENABLE_ANDROID_JSC_JIT=1
243 ifeq ($(TARGET_ARCH),arm)
244 LOCAL_CFLAGS += -Darm
245 # remove this warning: "note: the mangling of 'va_list' has changed in GCC 4.4"
246 LOCAL_CFLAGS += -Wno-psabi
249 # need a flag to tell the C side when we're on devices with large memory
250 # budgets (i.e. larger than the low-end devices that initially shipped)
251 ifeq ($(ARCH_ARM_HAVE_VFP),true)
252 LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
255 ifeq ($(ENABLE_SVG),true)
256 LOCAL_CFLAGS += -DENABLE_SVG=1 -DENABLE_SVG_ANIMATION=1
259 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),false)
260 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=0
263 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),true)
264 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=1
267 ifeq ($(WEBCORE_INSTRUMENTATION),true)
268 LOCAL_CFLAGS += -DANDROID_INSTRUMENT
271 # LOCAL_LDLIBS is used in simulator builds only and simulator builds are only
273 LOCAL_LDLIBS += -lpthread -ldl
275 # Build the list of shared libraries
276 LOCAL_SHARED_LIBRARIES := \
288 libsurfaceflinger_client
290 ifeq ($(WEBCORE_INSTRUMENTATION),true)
291 LOCAL_SHARED_LIBRARIES += libhardware_legacy
294 # We have to use the android version of libdl when we are not on the simulator
295 ifneq ($(TARGET_SIMULATOR),true)
296 LOCAL_SHARED_LIBRARIES += libdl libstlport
297 include external/stlport/libstlport.mk
300 # Build the list of static libraries
301 LOCAL_STATIC_LIBRARIES := libxml2 libxslt
302 ifeq ($(JAVASCRIPT_ENGINE),v8)
303 LOCAL_STATIC_LIBRARIES += libv8
306 # Redefine LOCAL_SRC_FILES to be all the WebKit source files
307 LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES)
309 # Define this for use in other makefiles.
310 WEBKIT_C_INCLUDES := $(LOCAL_C_INCLUDES)
311 WEBKIT_CFLAGS := $(LOCAL_CFLAGS)
312 WEBKIT_GENERATED_SOURCES := $(LOCAL_GENERATED_SOURCES)
313 WEBKIT_LDLIBS := $(LOCAL_LDLIBS)
314 WEBKIT_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES)
315 WEBKIT_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES)
317 # Build the library all at once
318 include $(BUILD_STATIC_LIBRARY)
320 ifeq ($(JAVASCRIPT_ENGINE),jsc)
321 # Now build libjs as a static library.
322 include $(CLEAR_VARS)
323 LOCAL_MODULE := libjs
324 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
325 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
326 LOCAL_STATIC_LIBRARIES := $(WEBKIT_STATIC_LIBRARIES)
327 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
328 # Include source files for JavaScriptCore
330 LOCAL_PATH := $(BASE_PATH)/$d
331 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
332 # Cannot use base_intermediates as this is a new module
333 intermediates := $(call local-intermediates-dir)
334 include $(LOCAL_PATH)/Android.mk
335 # Redefine LOCAL_SRC_FILES with the correct prefix
336 LOCAL_SRC_FILES := $(addprefix $d/,$(LOCAL_SRC_FILES))
337 # Use the base path to resolve file names
338 LOCAL_PATH := $(BASE_PATH)
339 # Append jsc intermediate include paths to the WebKit include list.
340 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) \
342 $(intermediates)/parser \
343 $(intermediates)/runtime \
345 include $(BUILD_STATIC_LIBRARY)
346 endif # JAVASCRIPT_ENGINE == jsc
348 # Now build the shared library using only the exported jni entry point. This
349 # will strip out any unused code from the entry point.
350 include $(CLEAR_VARS)
351 # if you need to make webcore huge (for debugging), enable this line
352 #LOCAL_PRELINK_MODULE := false
353 LOCAL_MODULE := libwebcore
354 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
355 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
356 LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES)
357 ifeq ($(JAVASCRIPT_ENGINE),jsc)
358 LOCAL_STATIC_LIBRARIES += libjs
360 LOCAL_LDFLAGS := -fvisibility=hidden
361 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
362 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES)
363 LOCAL_PATH := $(BASE_PATH)
365 WebKit/android/jni/WebCoreJniOnLoad.cpp
366 # Do this dependency by hand. The reason we have to do this is because the
367 # headers that this file pulls in are generated during the build of webcore.
368 # We make all of our object files depend on those files so that they are built
369 # before we try to compile the file.
370 LOCAL_ADDITIONAL_DEPENDENCIES := $(filter %.h, $(WEBKIT_GENERATED_SOURCES))
371 include $(BUILD_SHARED_LIBRARY)
373 # Build the wds client
374 include $(BASE_PATH)/WebKit/android/wds/client/Android.mk
376 # Build the performance command line tool.
377 include $(BASE_PATH)/WebKit/android/benchmark/Android.mk
379 # Build the webkit merge tool.
380 include $(BASE_PATH)/WebKitTools/android/webkitmerge/Android.mk