• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1##
2## Copyright 2009, The Android Open Source Project
3##
4## Redistribution and use in source and binary forms, with or without
5## modification, are permitted provided that the following conditions
6## are met:
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.
12##
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.
24##
25
26# Control SVG compiling in webkit.
27# Default is true unless explictly disabled.
28ifneq ($(ENABLE_SVG),false)
29    ENABLE_SVG = true
30endif
31
32# Control complex scripts support compiling in webkit.
33# Default is true unless explictly disabled.
34ifneq ($(SUPPORT_COMPLEX_SCRIPTS),false)
35    SUPPORT_COMPLEX_SCRIPTS = true
36endif
37
38# Two ways to control which JS engine is used:
39# 1. use JS_ENGINE environment variable, value can be either 'jsc' or 'v8'
40#    This is the preferred way.
41# 2. if JS_ENGINE is not set, or is not 'jsc' or 'v8', this makefile picks
42#    up a default engine to build.
43#    To help setup buildbot, a new environment variable, USE_ALT_JS_ENGINE,
44#    can be set to true, so that two builds can be different but without
45#    specifying which JS engine to use.
46# To enable JIT in Android's JSC, please set ENABLE_JSC_JIT environment
47# variable to true.
48
49# To enable JIT in Android's JSC, please set ENABLE_JSC_JIT environment
50# variable to true.
51
52# Read JS_ENGINE environment variable
53JAVASCRIPT_ENGINE = $(JS_ENGINE)
54
55# We default to the V8 JS engine.
56DEFAULT_ENGINE = v8
57ALT_ENGINE = jsc
58
59ifneq ($(JAVASCRIPT_ENGINE),jsc)
60  ifneq ($(JAVASCRIPT_ENGINE),v8)
61    # No JS engine is specified, pickup the one we want as default.
62    ifeq ($(USE_ALT_JS_ENGINE),true)
63      JAVASCRIPT_ENGINE = $(ALT_ENGINE)
64    else
65      JAVASCRIPT_ENGINE = $(DEFAULT_ENGINE)
66    endif
67  endif
68endif
69
70# V8 also requires an ARMv7 CPU, and since we must use jsc, we cannot
71# use the Chrome http stack either.
72ifneq ($(strip $(ARCH_ARM_HAVE_ARMV7A)),true)
73  JAVASCRIPT_ENGINE := jsc
74  USE_ALT_HTTP := true
75endif
76
77# See if the user has specified a stack they want to use
78HTTP_STACK = $(HTTP)
79# We default to the Chrome HTTP stack.
80DEFAULT_HTTP = chrome
81ALT_HTTP = android
82
83ifneq ($(HTTP_STACK),chrome)
84  ifneq ($(HTTP_STACK),android)
85    # No HTTP stack is specified, pickup the one we want as default.
86    ifeq ($(USE_ALT_HTTP),true)
87      HTTP_STACK = $(ALT_HTTP)
88    else
89      HTTP_STACK = $(DEFAULT_HTTP)
90    endif
91  endif
92endif
93
94# The Chrome stack can not be used with JSC and hence can not be used be used
95# with the simulator.
96ifeq ($(JAVASCRIPT_ENGINE),jsc)
97  ifeq ($(HTTP_STACK),chrome)
98    $(error Can not build with JSC and the Chrome HTTP stack)
99  endif
100endif
101
102# Read the environment variable to determine if Autofill is compiled.
103# The default is on. Chrome HTTP stack must be used when Autofill
104# is turned on.
105ifneq ($(ENABLE_AUTOFILL),false)
106  ENABLE_AUTOFILL = true
107endif
108ifneq ($(HTTP_STACK),chrome)
109  ENABLE_AUTOFILL = false
110endif
111
112BASE_PATH := $(call my-dir)
113include $(CLEAR_VARS)
114
115# Define our module and find the intermediates directory
116LOCAL_MODULE := libwebcore
117LOCAL_MODULE_CLASS := STATIC_LIBRARIES
118base_intermediates := $(call local-intermediates-dir)
119
120# Using := here prevents recursive expansion
121WEBKIT_SRC_FILES :=
122
123# We have to use bison 2.3
124include $(BASE_PATH)/bison_check.mk
125
126SOURCE_PATH := $(BASE_PATH)/Source
127WEBCORE_PATH := $(SOURCE_PATH)/WebCore
128JAVASCRIPTCORE_PATH := $(SOURCE_PATH)/JavaScriptCore
129WEBKIT_PATH := $(SOURCE_PATH)/WebKit
130WEBCORE_INTERMEDIATES_PATH := $(base_intermediates)/Source/WebCore
131
132# Build our list of include paths. We include Source/WebKit/android/icu first so that
133# any files that include <unicode/ucnv.h> will include our ucnv.h first. We
134# also add external/ as an include directory so that we can specify the real
135# icu header directory as a more exact reference to avoid including our ucnv.h.
136#
137# Note that JavasCriptCore/ must be included after WebCore/, so that we pick up
138# the right config.h.
139LOCAL_C_INCLUDES := \
140	$(JNI_H_INCLUDE) \
141	$(WEBKIT_PATH)/android/icu \
142	external/ \
143	external/icu4c/common \
144	external/icu4c/i18n \
145	external/jpeg \
146	external/libxml2/include \
147	external/libxslt \
148	external/hyphenation \
149	external/skia/emoji \
150	external/skia/gpu/include \
151	external/skia/include/core \
152	external/skia/include/effects \
153	external/skia/include/gpu \
154	external/skia/include/images \
155	external/skia/include/ports \
156	external/skia/include/utils \
157	external/skia/src/ports \
158	external/sqlite/dist \
159	frameworks/base/core/jni/android/graphics \
160	frameworks/base/include
161
162# Add Source/ for the include of <JavaScriptCore/config.h> from WebCore/config.h
163LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
164	$(SOURCE_PATH)
165
166LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
167	$(WEBCORE_PATH) \
168	$(WEBCORE_PATH)/accessibility \
169	$(WEBCORE_PATH)/bindings/ \
170	$(WEBCORE_PATH)/bindings/generic \
171	$(WEBCORE_PATH)/css \
172	$(WEBCORE_PATH)/dom \
173	$(WEBCORE_PATH)/editing \
174	$(WEBCORE_PATH)/fileapi \
175	$(WEBCORE_PATH)/history \
176	$(WEBCORE_PATH)/history/android \
177	$(WEBCORE_PATH)/html \
178	$(WEBCORE_PATH)/html/canvas \
179	$(WEBCORE_PATH)/html/parser \
180	$(WEBCORE_PATH)/html/shadow \
181	$(WEBCORE_PATH)/inspector \
182	$(WEBCORE_PATH)/loader \
183	$(WEBCORE_PATH)/loader/appcache \
184	$(WEBCORE_PATH)/loader/archive \
185	$(WEBCORE_PATH)/loader/archive/android \
186	$(WEBCORE_PATH)/loader/cache \
187	$(WEBCORE_PATH)/loader/icon \
188	$(WEBCORE_PATH)/notifications \
189	$(WEBCORE_PATH)/page \
190	$(WEBCORE_PATH)/page/android \
191	$(WEBCORE_PATH)/page/animation \
192	$(WEBCORE_PATH)/platform \
193	$(WEBCORE_PATH)/platform/android \
194	$(WEBCORE_PATH)/platform/animation \
195	$(WEBCORE_PATH)/platform/graphics \
196	$(WEBCORE_PATH)/platform/graphics/android \
197	$(WEBCORE_PATH)/platform/graphics/filters \
198	$(WEBCORE_PATH)/platform/graphics/gpu \
199	$(WEBCORE_PATH)/platform/graphics/network \
200	$(WEBCORE_PATH)/platform/graphics/skia \
201	$(WEBCORE_PATH)/platform/graphics/transforms \
202	$(WEBCORE_PATH)/platform/image-decoders \
203	$(WEBCORE_PATH)/platform/image-decoders/bmp \
204	$(WEBCORE_PATH)/platform/image-decoders/gif \
205	$(WEBCORE_PATH)/platform/image-decoders/ico \
206	$(WEBCORE_PATH)/platform/image-decoders/jpeg \
207	$(WEBCORE_PATH)/platform/image-decoders/png \
208	$(WEBCORE_PATH)/platform/image-decoders/webp \
209	$(WEBCORE_PATH)/platform/mock \
210	$(WEBCORE_PATH)/platform/network \
211	$(WEBCORE_PATH)/platform/network/android \
212	$(WEBCORE_PATH)/platform/sql \
213	$(WEBCORE_PATH)/platform/text \
214	$(WEBCORE_PATH)/platform/text/transcoder \
215	$(WEBCORE_PATH)/plugins \
216	$(WEBCORE_PATH)/plugins/android \
217	$(WEBCORE_PATH)/rendering \
218	$(WEBCORE_PATH)/rendering/style \
219	$(WEBCORE_PATH)/rendering/svg \
220	$(WEBCORE_PATH)/storage \
221	$(WEBCORE_PATH)/svg \
222	$(WEBCORE_PATH)/svg/animation \
223	$(WEBCORE_PATH)/svg/graphics \
224	$(WEBCORE_PATH)/svg/graphics/filters \
225	$(WEBCORE_PATH)/svg/properties \
226	$(WEBCORE_PATH)/websockets \
227	$(WEBCORE_PATH)/workers \
228	$(WEBCORE_PATH)/xml
229
230LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
231	$(WEBKIT_PATH)/android \
232	$(WEBKIT_PATH)/android/WebCoreSupport \
233	$(WEBKIT_PATH)/android/jni \
234	$(WEBKIT_PATH)/android/nav \
235	$(WEBKIT_PATH)/android/plugins
236
237LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
238	$(JAVASCRIPTCORE_PATH) \
239	$(JAVASCRIPTCORE_PATH)/collector/handles \
240	$(JAVASCRIPTCORE_PATH)/heap \
241	$(JAVASCRIPTCORE_PATH)/wtf \
242	$(JAVASCRIPTCORE_PATH)/wtf/unicode \
243	$(JAVASCRIPTCORE_PATH)/wtf/unicode/icu
244
245LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
246	$(WEBCORE_INTERMEDIATES_PATH) \
247	$(WEBCORE_INTERMEDIATES_PATH)/css \
248	$(WEBCORE_INTERMEDIATES_PATH)/html \
249	$(WEBCORE_INTERMEDIATES_PATH)/platform \
250	$(WEBCORE_INTERMEDIATES_PATH)/xml
251
252# The following includes are needed by the AutoFill feature, or the chrome http
253# stack
254LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
255	$(WEBKIT_PATH)/chromium \
256	$(WEBKIT_PATH)/chromium/public \
257	external/chromium/chrome/browser \
258	external/chromium/chrome/renderer \
259	external/chromium \
260	external/chromium/chrome \
261	external/skia
262
263ifeq ($(JAVASCRIPT_ENGINE),v8)
264# Include WTF source file.
265d := Source/JavaScriptCore
266LOCAL_PATH := $(BASE_PATH)/$d
267intermediates := $(base_intermediates)/$d
268include $(LOCAL_PATH)/Android.v8.wtf.mk
269WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
270endif  # JAVASCRIPT_ENGINE == v8
271
272# Include source files for WebCore
273d := Source/WebCore
274LOCAL_PATH := $(BASE_PATH)/$d
275intermediates := $(base_intermediates)/$d
276include $(LOCAL_PATH)/Android.mk
277ifeq ($(JAVASCRIPT_ENGINE),jsc)
278include $(LOCAL_PATH)/Android.jscbindings.mk
279endif
280ifeq ($(JAVASCRIPT_ENGINE),v8)
281include $(LOCAL_PATH)/Android.v8bindings.mk
282endif
283WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
284LOCAL_C_INCLUDES += $(BINDING_C_INCLUDES)
285
286# Include the derived source files for WebCore. Uses the same path as
287# WebCore
288include $(LOCAL_PATH)/Android.derived.mk
289ifeq ($(JAVASCRIPT_ENGINE),jsc)
290include $(LOCAL_PATH)/Android.derived.jscbindings.mk
291endif
292ifeq ($(JAVASCRIPT_ENGINE),v8)
293include $(LOCAL_PATH)/Android.derived.v8bindings.mk
294endif
295
296# Include source files for android WebKit port
297d := Source/WebKit
298LOCAL_PATH := $(BASE_PATH)/$d
299intermediates := $(base_intermediates)/$d
300include $(LOCAL_PATH)/Android.mk
301WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
302
303# Redefine LOCAL_PATH here so the build system is not confused
304LOCAL_PATH := $(BASE_PATH)
305
306# Define our compiler flags
307LOCAL_CFLAGS += -Wno-endif-labels -Wno-import -Wno-format
308LOCAL_CFLAGS += -fno-strict-aliasing
309LOCAL_CFLAGS += -include "WebCorePrefix.h"
310LOCAL_CFLAGS += -fvisibility=hidden
311LOCAL_CFLAGS += -DALWAYS_INLINE=inline
312# Make sure assert.h is included before assert is defined
313LOCAL_CFLAGS += -include "assert.h"
314ifeq ($(HTTP_STACK),chrome)
315LOCAL_CFLAGS += -DGOOGLEURL
316LOCAL_CFLAGS += -DWTF_USE_CHROME_NETWORK_STACK
317endif # HTTP_STACK == chrome
318LOCAL_CPPFLAGS := -Wno-sign-promo
319
320# Adds GL and EGL extensions for the GL backend
321LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
322
323# Enable JSC JIT if JSC is used and ENABLE_JSC_JIT environment
324# variable is set to true
325ifeq ($(JAVASCRIPT_ENGINE),jsc)
326ifeq ($(ENABLE_JSC_JIT),true)
327LOCAL_CFLAGS += -DENABLE_ANDROID_JSC_JIT=1
328endif
329endif
330
331ifeq ($(TARGET_ARCH),arm)
332LOCAL_CFLAGS += -Darm
333# remove this warning: "note: the mangling of 'va_list' has changed in GCC 4.4"
334LOCAL_CFLAGS += -Wno-psabi
335endif
336
337# need a flag to tell the C side when we're on devices with large memory
338# budgets (i.e. larger than the low-end devices that initially shipped)
339ifeq ($(ARCH_ARM_HAVE_VFP),true)
340LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
341endif
342
343ifeq ($(ENABLE_SVG),true)
344LOCAL_CFLAGS += -DENABLE_SVG=1 -DENABLE_SVG_ANIMATION=1
345endif
346
347ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),false)
348LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=0
349endif
350
351ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),true)
352LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=1
353endif
354
355ifeq ($(WEBCORE_INSTRUMENTATION),true)
356LOCAL_CFLAGS += -DANDROID_INSTRUMENT
357endif
358
359# LOCAL_LDLIBS is used in simulator builds only and simulator builds are only
360# valid on Linux
361LOCAL_LDLIBS += -lpthread -ldl
362
363# Build the list of shared libraries
364LOCAL_SHARED_LIBRARIES := \
365	libandroid \
366	libandroid_runtime \
367	libnativehelper \
368	libsqlite \
369	libskia \
370	libutils \
371	libui \
372	libcutils \
373	libicuuc \
374	libicui18n \
375	libmedia \
376	libEGL \
377	libGLESv2 \
378	libgui
379
380ifeq ($(PLATFORM_VERSION),3.1.4.1.5.9.2.6.5)
381LOCAL_SHARED_LIBRARIES += libsurfaceflinger_client
382endif
383
384ifeq ($(WEBCORE_INSTRUMENTATION),true)
385LOCAL_SHARED_LIBRARIES += libhardware_legacy
386endif
387
388# We have to use the android version of libdl
389LOCAL_SHARED_LIBRARIES += libdl libstlport
390# We have to fake out some headers when using stlport.
391LOCAL_C_INCLUDES += \
392	external/chromium/android
393include external/stlport/libstlport.mk
394
395# We need Harfbuzz library to support complex scripts(Arabic, Thai, Hindi...).
396ifeq ($(SUPPORT_COMPLEX_SCRIPTS),true)
397LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
398	external/harfbuzz/src \
399	external/harfbuzz/contrib
400LOCAL_SHARED_LIBRARIES += libharfbuzz
401LOCAL_CFLAGS += -DSUPPORT_COMPLEX_SCRIPTS=1
402endif
403
404# Build the list of static libraries
405LOCAL_STATIC_LIBRARIES := libxml2 libxslt libhyphenation libskiagpu
406ifeq ($(JAVASCRIPT_ENGINE),v8)
407LOCAL_STATIC_LIBRARIES += libv8
408endif
409
410ifeq ($(HTTP_STACK),chrome)
411LOCAL_SHARED_LIBRARIES += libcrypto libssl libz libchromium_net
412endif # HTTP_STACK == chrome
413
414ifeq ($(ENABLE_AUTOFILL),true)
415LOCAL_SHARED_LIBRARIES += libexpat
416endif
417
418# Redefine LOCAL_SRC_FILES to be all the WebKit source files
419LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES)
420
421# Define this for use in other makefiles.
422WEBKIT_C_INCLUDES := $(LOCAL_C_INCLUDES)
423WEBKIT_CFLAGS := $(LOCAL_CFLAGS)
424WEBKIT_CPPFLAGS := $(LOCAL_CPPFLAGS)
425WEBKIT_GENERATED_SOURCES := $(LOCAL_GENERATED_SOURCES)
426WEBKIT_LDLIBS := $(LOCAL_LDLIBS)
427WEBKIT_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES)
428WEBKIT_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES)
429
430# Build the library all at once
431include $(BUILD_STATIC_LIBRARY)
432
433ifeq ($(JAVASCRIPT_ENGINE),jsc)
434# Now build libjs as a static library.
435include $(CLEAR_VARS)
436LOCAL_MODULE := libjs
437LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
438LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
439LOCAL_STATIC_LIBRARIES := $(WEBKIT_STATIC_LIBRARIES)
440LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
441# Include source files for JavaScriptCore
442d := Source/JavaScriptCore
443LOCAL_PATH := $(BASE_PATH)/$d
444LOCAL_MODULE_CLASS := STATIC_LIBRARIES
445# Cannot use base_intermediates as this is a new module
446intermediates := $(call local-intermediates-dir)
447include $(LOCAL_PATH)/Android.mk
448# Redefine LOCAL_SRC_FILES with the correct prefix
449LOCAL_SRC_FILES := $(addprefix $d/,$(LOCAL_SRC_FILES))
450# Use the base path to resolve file names
451LOCAL_PATH := $(BASE_PATH)
452# Append jsc intermediate include paths to the WebKit include list.
453LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) \
454	$(intermediates) \
455	$(intermediates)/parser \
456	$(intermediates)/runtime \
457# Build libjs
458include $(BUILD_STATIC_LIBRARY)
459endif  # JAVASCRIPT_ENGINE == jsc
460
461# Now build the shared library using only the exported jni entry point. This
462# will strip out any unused code from the entry point.
463include $(CLEAR_VARS)
464# Do not attempt prelink this library. Needed to keep master-gpl happy, no
465# effect in master.
466# TODO: remove this when master-gpl is updated.
467LOCAL_PRELINK_MODULE := false
468LOCAL_MODULE := libwebcore
469LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
470LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
471LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES)
472ifeq ($(JAVASCRIPT_ENGINE),jsc)
473LOCAL_STATIC_LIBRARIES += libjs
474endif
475LOCAL_LDFLAGS := -fvisibility=hidden
476LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
477LOCAL_CPPFLAGS := $(WEBKIT_CPPFLAGS)
478LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES)
479LOCAL_PATH := $(BASE_PATH)
480LOCAL_SRC_FILES := \
481	Source/WebKit/android/jni/WebCoreJniOnLoad.cpp
482
483ifeq ($(ENABLE_AUTOFILL),true)
484# AutoFill requires some cpp files from Chromium to link with
485# libchromium_net. We cannot compile them into libchromium_net
486# because they have cpp file extensions, not .cc.
487LOCAL_CFLAGS += -DWEBKIT_IMPLEMENTATION=1
488LOCAL_SRC_FILES += \
489	Source/WebKit/android/WebCoreSupport/autofill/MainThreadProxy.cpp \
490	Source/WebKit/chromium/src/WebCString.cpp \
491	Source/WebKit/chromium/src/WebRegularExpression.cpp \
492	Source/WebKit/chromium/src/WebString.cpp
493endif
494
495# Do this dependency by hand. The reason we have to do this is because the
496# headers that this file pulls in are generated during the build of webcore.
497# We make all of our object files depend on those files so that they are built
498# before we try to compile the file.
499LOCAL_ADDITIONAL_DEPENDENCIES := $(filter %.h, $(WEBKIT_GENERATED_SOURCES))
500include $(BUILD_SHARED_LIBRARY)
501
502# Build the wds client
503include $(WEBKIT_PATH)/android/wds/client/Android.mk
504
505# Build the performance command line tool.
506include $(WEBKIT_PATH)/android/benchmark/Android.mk
507
508# Build the webkit merge tool.
509include $(BASE_PATH)/Tools/android/webkitmerge/Android.mk
510