OSDN Git Service

Merge "Initial messaging model for project 'smoke'"
[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 # 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
43 # variable to true.
44
45 # To enable JIT in Android's JSC, please set ENABLE_JSC_JIT environment
46 # variable to true.
47
48 # Read JS_ENGINE environment variable
49 JAVASCRIPT_ENGINE = $(JS_ENGINE)
50
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
55 # the build system.
56 ifeq ($(ARCH_ARM_HAVE_VFP),true)
57     DEFAULT_ENGINE = v8
58     ALT_ENGINE = jsc
59 else
60     DEFAULT_ENGINE = jsc
61     ALT_ENGINE = jsc
62 endif
63
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)
69     else
70       JAVASCRIPT_ENGINE = $(DEFAULT_ENGINE)
71     endif
72   endif
73 endif
74
75 BASE_PATH := $(call my-dir)
76 include $(CLEAR_VARS)
77
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)
82
83 # Using := here prevents recursive expansion
84 WEBKIT_SRC_FILES :=
85
86 # We have to use bison 2.3
87 include $(BASE_PATH)/bison_check.mk
88
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.
93 #
94 # Note that JavasCriptCore/ must be included after WebCore/, so that we pick up
95 # the right config.h.
96 LOCAL_C_INCLUDES := \
97         $(JNI_H_INCLUDE) \
98         $(LOCAL_PATH)/WebKit/android/icu \
99         external/ \
100         external/icu4c/common \
101         external/icu4c/i18n \
102         external/libxml2/include \
103         external/libxslt \
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
113
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/platform/text/transcoder \
154         $(LOCAL_PATH)/WebCore/plugins \
155         $(LOCAL_PATH)/WebCore/plugins/android \
156         $(LOCAL_PATH)/WebCore/rendering \
157         $(LOCAL_PATH)/WebCore/rendering/style \
158         $(LOCAL_PATH)/WebCore/storage \
159         $(LOCAL_PATH)/WebCore/svg \
160         $(LOCAL_PATH)/WebCore/svg/animation \
161         $(LOCAL_PATH)/WebCore/svg/graphics \
162         $(LOCAL_PATH)/WebCore/svg/graphics/filters \
163         $(LOCAL_PATH)/WebCore/websockets \
164         $(LOCAL_PATH)/WebCore/workers \
165         $(LOCAL_PATH)/WebCore/xml
166
167 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
168         $(LOCAL_PATH)/WebKit/android \
169         $(LOCAL_PATH)/WebKit/android/WebCoreSupport \
170         $(LOCAL_PATH)/WebKit/android/jni \
171         $(LOCAL_PATH)/WebKit/android/nav \
172         $(LOCAL_PATH)/WebKit/android/plugins
173
174 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
175         $(LOCAL_PATH)/JavaScriptCore \
176         $(LOCAL_PATH)/JavaScriptCore/wtf \
177         $(LOCAL_PATH)/JavaScriptCore/wtf/unicode \
178         $(LOCAL_PATH)/JavaScriptCore/wtf/unicode/icu
179
180 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
181         $(base_intermediates)/WebCore/ \
182         $(base_intermediates)/WebCore/css \
183         $(base_intermediates)/WebCore/html \
184         $(base_intermediates)/WebCore/platform
185
186 ifeq ($(JAVASCRIPT_ENGINE),v8)
187 # Include WTF source file.
188 d := JavaScriptCore
189 LOCAL_PATH := $(BASE_PATH)/$d
190 intermediates := $(base_intermediates)/$d
191 include $(LOCAL_PATH)/Android.v8.wtf.mk
192 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
193 endif  # JAVASCRIPT_ENGINE == v8
194
195 # Include source files for WebCore
196 d := WebCore
197 LOCAL_PATH := $(BASE_PATH)/$d
198 JAVASCRIPTCORE_PATH := $(BASE_PATH)/JavaScriptCore
199 intermediates := $(base_intermediates)/$d
200 include $(LOCAL_PATH)/Android.mk
201 ifeq ($(JAVASCRIPT_ENGINE),jsc)
202 include $(LOCAL_PATH)/Android.jscbindings.mk
203 endif
204 ifeq ($(JAVASCRIPT_ENGINE),v8)
205 include $(LOCAL_PATH)/Android.v8bindings.mk
206 endif
207 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
208 LOCAL_C_INCLUDES += $(BINDING_C_INCLUDES)
209
210 # Include the derived source files for WebCore. Uses the same path as
211 # WebCore
212 include $(LOCAL_PATH)/Android.derived.mk
213 ifeq ($(JAVASCRIPT_ENGINE),jsc)
214 include $(LOCAL_PATH)/Android.derived.jscbindings.mk
215 endif
216 ifeq ($(JAVASCRIPT_ENGINE),v8)
217 include $(LOCAL_PATH)/Android.derived.v8bindings.mk
218 endif
219
220 # Include source files for android WebKit port
221 d := WebKit
222 LOCAL_PATH := $(BASE_PATH)/$d
223 intermediates := $(base_intermediates)/$d
224 include $(LOCAL_PATH)/Android.mk
225 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
226
227 # Redefine LOCAL_PATH here so the build system is not confused
228 LOCAL_PATH := $(BASE_PATH)
229
230 # Define our compiler flags
231 LOCAL_CFLAGS += -Wno-endif-labels -Wno-import -Wno-format
232 LOCAL_CFLAGS += -fno-strict-aliasing
233 LOCAL_CFLAGS += -include "WebCorePrefix.h"
234 LOCAL_CFLAGS += -fvisibility=hidden
235
236 # Enable JSC JIT if JSC is used and ENABLE_JSC_JIT environment
237 # variable is set to true
238 ifeq ($(JAVASCRIPT_ENGINE),jsc)
239 ifeq ($(ENABLE_JSC_JIT),true)
240 LOCAL_CFLAGS += -DENABLE_ANDROID_JSC_JIT=1
241 endif
242 endif
243
244 ifeq ($(TARGET_ARCH),arm)
245 LOCAL_CFLAGS += -Darm
246 # remove this warning: "note: the mangling of 'va_list' has changed in GCC 4.4"
247 LOCAL_CFLAGS += -Wno-psabi
248 endif
249
250 # need a flag to tell the C side when we're on devices with large memory
251 # budgets (i.e. larger than the low-end devices that initially shipped)
252 ifeq ($(ARCH_ARM_HAVE_VFP),true)
253 LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
254 endif
255
256 ifeq ($(ENABLE_SVG),true)
257 LOCAL_CFLAGS += -DENABLE_SVG=1 -DENABLE_SVG_ANIMATION=1
258 endif
259
260 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),false)
261 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=0
262 endif
263
264 ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),true)
265 LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=1
266 endif
267
268 ifeq ($(WEBCORE_INSTRUMENTATION),true)
269 LOCAL_CFLAGS += -DANDROID_INSTRUMENT
270 endif
271
272 # LOCAL_LDLIBS is used in simulator builds only and simulator builds are only
273 # valid on Linux
274 LOCAL_LDLIBS += -lpthread -ldl
275
276 # Build the list of shared libraries
277 LOCAL_SHARED_LIBRARIES := \
278         libandroid_runtime \
279         libnativehelper \
280         libsqlite \
281         libskia \
282         libutils \
283         libui \
284         libcutils \
285         libicuuc \
286         libicudata \
287         libicui18n \
288         libmedia \
289         libsurfaceflinger_client
290
291 ifeq ($(WEBCORE_INSTRUMENTATION),true)
292 LOCAL_SHARED_LIBRARIES += libhardware_legacy
293 endif
294
295 # We have to use the android version of libdl when we are not on the simulator
296 ifneq ($(TARGET_SIMULATOR),true)
297 LOCAL_SHARED_LIBRARIES += libdl libstlport
298 include external/stlport/libstlport.mk
299 endif
300
301 # Build the list of static libraries
302 LOCAL_STATIC_LIBRARIES := libxml2 libxslt
303 ifeq ($(JAVASCRIPT_ENGINE),v8)
304 LOCAL_STATIC_LIBRARIES += libv8
305 endif
306
307 # Redefine LOCAL_SRC_FILES to be all the WebKit source files
308 LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES)
309
310 # Define this for use in other makefiles.
311 WEBKIT_C_INCLUDES := $(LOCAL_C_INCLUDES)
312 WEBKIT_CFLAGS := $(LOCAL_CFLAGS)
313 WEBKIT_GENERATED_SOURCES := $(LOCAL_GENERATED_SOURCES)
314 WEBKIT_LDLIBS := $(LOCAL_LDLIBS)
315 WEBKIT_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES)
316 WEBKIT_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES)
317
318 # Build the library all at once
319 include $(BUILD_STATIC_LIBRARY)
320
321 ifeq ($(JAVASCRIPT_ENGINE),jsc)
322 # Now build libjs as a static library.
323 include $(CLEAR_VARS)
324 LOCAL_MODULE := libjs
325 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
326 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
327 LOCAL_STATIC_LIBRARIES := $(WEBKIT_STATIC_LIBRARIES)
328 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
329 # Include source files for JavaScriptCore
330 d := JavaScriptCore
331 LOCAL_PATH := $(BASE_PATH)/$d
332 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
333 # Cannot use base_intermediates as this is a new module
334 intermediates := $(call local-intermediates-dir)
335 include $(LOCAL_PATH)/Android.mk
336 # Redefine LOCAL_SRC_FILES with the correct prefix
337 LOCAL_SRC_FILES := $(addprefix $d/,$(LOCAL_SRC_FILES))
338 # Use the base path to resolve file names
339 LOCAL_PATH := $(BASE_PATH)
340 # Append jsc intermediate include paths to the WebKit include list.
341 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) \
342         $(intermediates) \
343         $(intermediates)/parser \
344         $(intermediates)/runtime \
345 # Build libjs
346 include $(BUILD_STATIC_LIBRARY)
347 endif  # JAVASCRIPT_ENGINE == jsc
348
349 # Now build the shared library using only the exported jni entry point. This
350 # will strip out any unused code from the entry point.
351 include $(CLEAR_VARS)
352 # if you need to make webcore huge (for debugging), enable this line
353 #LOCAL_PRELINK_MODULE := false
354 LOCAL_MODULE := libwebcore
355 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
356 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
357 LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES)
358 ifeq ($(JAVASCRIPT_ENGINE),jsc)
359 LOCAL_STATIC_LIBRARIES += libjs
360 endif
361 LOCAL_LDFLAGS := -fvisibility=hidden
362 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
363 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES)
364 LOCAL_PATH := $(BASE_PATH)
365 LOCAL_SRC_FILES := \
366         WebKit/android/jni/WebCoreJniOnLoad.cpp
367 # Do this dependency by hand. The reason we have to do this is because the
368 # headers that this file pulls in are generated during the build of webcore.
369 # We make all of our object files depend on those files so that they are built
370 # before we try to compile the file.
371 LOCAL_ADDITIONAL_DEPENDENCIES := $(filter %.h, $(WEBKIT_GENERATED_SOURCES))
372 include $(BUILD_SHARED_LIBRARY)
373
374 # Build the wds client
375 include $(BASE_PATH)/WebKit/android/wds/client/Android.mk
376
377 # Build the performance command line tool.
378 include $(BASE_PATH)/WebKit/android/benchmark/Android.mk
379
380 # Build the webkit merge tool.
381 include $(BASE_PATH)/WebKitTools/android/webkitmerge/Android.mk