OSDN Git Service

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