OSDN Git Service

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