OSDN Git Service

ddccd1b28f67b1e70f8b31a9b17aeda43c52bfee
[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 # 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.
36
37 # Read JS_ENGINE environment variable
38 JAVASCRIPT_ENGINE = $(JS_ENGINE)
39
40 ifneq ($(JAVASCRIPT_ENGINE),jsc)
41   ifneq ($(JAVASCRIPT_ENGINE),v8)
42     # No JS engine is specified, pickup the one we want as default.
43     ifeq ($(USE_ALT_JS_ENGINE),true)
44       JAVASCRIPT_ENGINE = v8
45     else
46       JAVASCRIPT_ENGINE = jsc
47     endif
48   endif
49 endif
50
51 BASE_PATH := $(call my-dir)
52 include $(CLEAR_VARS)
53
54 # Define our module and find the intermediates directory
55 LOCAL_MODULE := libwebcore
56 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
57 base_intermediates := $(call local-intermediates-dir)
58
59 # Using := here prevents recursive expansion
60 WEBKIT_SRC_FILES :=
61
62 # We have to use bison 2.3
63 include $(BASE_PATH)/bison_check.mk
64
65 ifeq ($(JAVASCRIPT_ENGINE),v8)
66 # Include WTF source file.
67 d := JavaScriptCore
68 LOCAL_PATH := $(BASE_PATH)/$d
69 intermediates := $(base_intermediates)/$d
70 include $(LOCAL_PATH)/Android.v8.wtf.mk
71 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
72 endif  # JAVASCRIPT_ENGINE == v8
73
74 # Include source files for WebCore
75 d := WebCore
76 LOCAL_PATH := $(BASE_PATH)/$d
77 JAVASCRIPTCORE_PATH := $(BASE_PATH)/JavaScriptCore
78 intermediates := $(base_intermediates)/$d
79 include $(LOCAL_PATH)/Android.mk
80 ifeq ($(JAVASCRIPT_ENGINE),jsc)
81 include $(LOCAL_PATH)/Android.jscbindings.mk
82 endif
83 ifeq ($(JAVASCRIPT_ENGINE),v8)
84 include $(LOCAL_PATH)/Android.v8bindings.mk
85 # TODO: We should use the WebCore JNI code instead.
86 JNI_PATH := V8Binding/jni
87 BINDING_C_INCLUDES += $(BASE_PATH)/$(JNI_PATH)
88 JNI_SRC_FILES := \
89         jni_class.cpp \
90         jni_instance.cpp \
91         jni_npobject.cpp \
92         jni_runtime.cpp \
93         jni_utility.cpp
94 WEBKIT_SRC_FILES += $(addprefix $(JNI_PATH)/,$(JNI_SRC_FILES))
95 endif
96 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
97 LOCAL_C_INCLUDES := $(BINDING_C_INCLUDES)
98
99 # Include the derived source files for WebCore. Uses the same path as
100 # WebCore
101 include $(LOCAL_PATH)/Android.derived.mk
102 ifeq ($(JAVASCRIPT_ENGINE),jsc)
103 include $(LOCAL_PATH)/Android.derived.jscbindings.mk
104 endif
105 ifeq ($(JAVASCRIPT_ENGINE),v8)
106 include $(LOCAL_PATH)/Android.derived.v8bindings.mk
107 endif
108
109 # Include source files for android WebKit port
110 d := WebKit
111 LOCAL_PATH := $(BASE_PATH)/$d
112 intermediates := $(base_intermediates)/$d
113 include $(LOCAL_PATH)/Android.mk
114 WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
115
116 # Redefine LOCAL_PATH here so the build system is not confused
117 LOCAL_PATH := $(BASE_PATH)
118
119 # Define our compiler flags
120 LOCAL_CFLAGS += -Wno-endif-labels -Wno-import -Wno-format
121 LOCAL_CFLAGS += -fno-strict-aliasing
122 LOCAL_CFLAGS += -include "WebCorePrefix.h"
123 LOCAL_CFLAGS += -fvisibility=hidden
124
125 ifeq ($(TARGET_ARCH),arm)
126 LOCAL_CFLAGS += -Darm
127 endif
128
129 ifeq ($(ENABLE_SVG),true)
130 LOCAL_CFLAGS += -DENABLE_SVG=1
131 endif
132
133 # Temporary disable SVG_ANIMATION.
134 ifeq ($(ENABLE_SVG_ANIMATION),true)
135 LOCAL_CFLAGS += -DENABLE_SVG_ANIMATION=1
136 endif
137
138 ifeq ($(WEBCORE_INSTRUMENTATION),true)
139 LOCAL_CFLAGS += -DANDROID_INSTRUMENT
140 endif
141
142 # LOCAL_LDLIBS is used in simulator builds only and simulator builds are only
143 # valid on Linux
144 LOCAL_LDLIBS += -lpthread -ldl
145
146 # Build our list of include paths. We include WebKit/android/icu first so that
147 # any files that include <unicode/ucnv.h> will include our ucnv.h first. We
148 # also add external/ as an include directory so that we can specify the real
149 # icu header directory as a more exact reference to avoid including our ucnv.h.
150 #
151 # Note that JavasCriptCore/ must be included after WebCore/, so that we pick up
152 # the right config.h.
153 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
154         $(JNI_H_INCLUDE) \
155         $(LOCAL_PATH)/WebKit/android/icu \
156         external/ \
157         external/icu4c/common \
158         external/icu4c/i18n \
159         external/libxml2/include \
160         external/skia/emoji \
161         external/skia/include/core \
162         external/skia/include/effects \
163         external/skia/include/images \
164         external/skia/include/ports \
165         external/skia/include/utils \
166         external/skia/src/ports \
167         external/sqlite/dist \
168         frameworks/base/core/jni/android/graphics
169
170 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
171         $(LOCAL_PATH)/WebCore \
172         $(LOCAL_PATH)/WebCore/accessibility \
173         $(LOCAL_PATH)/WebCore/css \
174         $(LOCAL_PATH)/WebCore/dom \
175         $(LOCAL_PATH)/WebCore/editing \
176         $(LOCAL_PATH)/WebCore/history \
177         $(LOCAL_PATH)/WebCore/html \
178         $(LOCAL_PATH)/WebCore/html/canvas \
179         $(LOCAL_PATH)/WebCore/inspector \
180         $(LOCAL_PATH)/WebCore/loader \
181         $(LOCAL_PATH)/WebCore/loader/appcache \
182         $(LOCAL_PATH)/WebCore/loader/icon \
183         $(LOCAL_PATH)/WebCore/notifications \
184         $(LOCAL_PATH)/WebCore/page \
185         $(LOCAL_PATH)/WebCore/page/android \
186         $(LOCAL_PATH)/WebCore/page/animation \
187         $(LOCAL_PATH)/WebCore/platform \
188         $(LOCAL_PATH)/WebCore/platform/android \
189         $(LOCAL_PATH)/WebCore/platform/animation \
190         $(LOCAL_PATH)/WebCore/platform/graphics \
191         $(LOCAL_PATH)/WebCore/platform/graphics/android \
192         $(LOCAL_PATH)/WebCore/platform/graphics/network \
193         $(LOCAL_PATH)/WebCore/platform/graphics/skia \
194         $(LOCAL_PATH)/WebCore/platform/graphics/transforms \
195         $(LOCAL_PATH)/WebCore/platform/image-decoders \
196         $(LOCAL_PATH)/WebCore/platform/mock \
197         $(LOCAL_PATH)/WebCore/platform/network \
198         $(LOCAL_PATH)/WebCore/platform/network/android \
199         $(LOCAL_PATH)/WebCore/platform/sql \
200         $(LOCAL_PATH)/WebCore/platform/text \
201         $(LOCAL_PATH)/WebCore/plugins \
202         $(LOCAL_PATH)/WebCore/plugins/android \
203         $(LOCAL_PATH)/WebCore/rendering \
204         $(LOCAL_PATH)/WebCore/rendering/style \
205         $(LOCAL_PATH)/WebCore/storage \
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 ifneq ($(TARGET_SIMULATOR),true)
217 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
218         $(LOCAL_PATH)/WebKit/android/stl
219 endif
220
221 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
222         $(LOCAL_PATH)/JavaScriptCore \
223         $(LOCAL_PATH)/JavaScriptCore/wtf \
224         $(LOCAL_PATH)/JavaScriptCore/wtf/unicode \
225         $(LOCAL_PATH)/JavaScriptCore/wtf/unicode/icu
226
227 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
228         $(base_intermediates)/WebCore/ \
229         $(base_intermediates)/WebCore/css \
230         $(base_intermediates)/WebCore/html \
231         $(base_intermediates)/WebCore/platform
232
233 ifeq ($(ENABLE_SVG), true)
234 LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
235         $(LOCAL_PATH)/WebCore/platform/graphics/filters \
236         $(LOCAL_PATH)/WebCore/svg \
237         $(LOCAL_PATH)/WebCore/svg/animation \
238         $(LOCAL_PATH)/WebCore/svg/graphics \
239         $(LOCAL_PATH)/WebCore/svg/graphics/filters \
240         $(base_intermediates)/WebCore/svg
241 endif
242
243 # Build the list of shared libraries
244 LOCAL_SHARED_LIBRARIES := \
245         libandroid_runtime \
246         libnativehelper \
247         libsqlite \
248         libskia \
249         libutils \
250         libui \
251         libcutils \
252         libicuuc \
253         libicudata \
254         libicui18n \
255         libmedia
256
257 ifeq ($(WEBCORE_INSTRUMENTATION),true)
258 LOCAL_SHARED_LIBRARIES += libhardware_legacy
259 endif
260
261 # We have to use the android version of libdl when we are not on the simulator
262 ifneq ($(TARGET_SIMULATOR),true)
263 LOCAL_SHARED_LIBRARIES += libdl
264 endif
265
266 # Build the list of static libraries
267 LOCAL_STATIC_LIBRARIES := libxml2
268 ifeq ($(JAVASCRIPT_ENGINE),v8)
269 LOCAL_STATIC_LIBRARIES += libv8
270 endif
271
272 # Redefine LOCAL_SRC_FILES to be all the WebKit source files
273 LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES)
274
275 # Define this for use in other makefiles.
276 WEBKIT_C_INCLUDES := $(LOCAL_C_INCLUDES)
277 WEBKIT_CFLAGS := $(LOCAL_CFLAGS)
278 WEBKIT_GENERATED_SOURCES := $(LOCAL_GENERATED_SOURCES)
279 WEBKIT_LDLIBS := $(LOCAL_LDLIBS)
280 WEBKIT_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES)
281 WEBKIT_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES)
282
283 # Build the library all at once
284 include $(BUILD_STATIC_LIBRARY)
285
286 ifeq ($(JAVASCRIPT_ENGINE),jsc)
287 # Now build libjs as a static library.
288 include $(CLEAR_VARS)
289 LOCAL_MODULE := libjs
290 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
291 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
292 LOCAL_STATIC_LIBRARIES := $(WEBKIT_STATIC_LIBRARIES)
293 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
294 # Include source files for JavaScriptCore
295 d := JavaScriptCore
296 LOCAL_PATH := $(BASE_PATH)/$d
297 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
298 # Cannot use base_intermediates as this is a new module
299 intermediates := $(call local-intermediates-dir)
300 include $(LOCAL_PATH)/Android.mk
301 # Redefine LOCAL_SRC_FILES with the correct prefix
302 LOCAL_SRC_FILES := $(addprefix $d/,$(LOCAL_SRC_FILES))
303 # Use the base path to resolve file names
304 LOCAL_PATH := $(BASE_PATH)
305 # Append jsc intermediate include paths to the WebKit include list.
306 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) \
307         $(intermediates) \
308         $(intermediates)/parser \
309         $(intermediates)/runtime \
310 # Build libjs
311 include $(BUILD_STATIC_LIBRARY)
312 endif  # JAVASCRIPT_ENGINE == jsc
313
314 # Now build the shared library using only the exported jni entry point. This
315 # will strip out any unused code from the entry point.
316 include $(CLEAR_VARS)
317 # if you need to make webcore huge (for debugging), enable this line
318 #LOCAL_PRELINK_MODULE := false
319 LOCAL_MODULE := libwebcore
320 LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
321 LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
322 LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES)
323 ifeq ($(JAVASCRIPT_ENGINE),jsc)
324 LOCAL_STATIC_LIBRARIES += libjs
325 endif
326 LOCAL_LDFLAGS := -fvisibility=hidden
327 LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
328 LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES)
329 LOCAL_PATH := $(BASE_PATH)
330 LOCAL_SRC_FILES := \
331         WebKit/android/jni/WebCoreJniOnLoad.cpp
332 # Do this dependency by hand. The reason we have to do this is because the
333 # headers that this file pulls in are generated during the build of webcore.
334 # We make all of our object files depend on those files so that they are built
335 # before we try to compile the file.
336 LOCAL_ADDITIONAL_DEPENDENCIES := $(filter %.h, $(WEBKIT_GENERATED_SOURCES))
337 include $(BUILD_SHARED_LIBRARY)
338
339 # Build the wds client
340 include $(BASE_PATH)/WebKit/android/wds/client/Android.mk
341
342 # Build the performance command line tool.
343 include $(BASE_PATH)/WebKit/android/benchmark/Android.mk
344
345 # Build the webkit merge tool.
346 include $(BASE_PATH)/WebKitTools/android/webkitmerge/Android.mk