• 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# Read the environment variable to determine if Autofill is compiled.
39# The default is on.
40# is turned on.
41ifneq ($(ENABLE_AUTOFILL),false)
42  ENABLE_AUTOFILL = true
43endif
44
45# Custom y-to-cpp rule
46define webkit-transform-y-to-cpp
47@mkdir -p $(dir $@)
48@echo "WebCore Yacc: $(PRIVATE_MODULE) <= $<"
49$(hide) $(YACC) $(PRIVATE_YACCFLAGS) -o $@ $<
50@touch $(@:$1=$(YACC_HEADER_SUFFIX))
51@echo '#ifndef '$(@F:$1=_h) > $(@:$1=.h)
52@echo '#define '$(@F:$1=_h) >> $(@:$1=.h)
53@cat $(@:$1=$(YACC_HEADER_SUFFIX)) >> $(@:$1=.h)
54@echo '#endif' >> $(@:$1=.h)
55@rm -f $(@:$1=$(YACC_HEADER_SUFFIX))
56endef
57
58BASE_PATH := $(call my-dir)
59include $(CLEAR_VARS)
60
61# Define our module and find the intermediates directory
62LOCAL_MODULE := libwebcore
63LOCAL_MODULE_CLASS := STATIC_LIBRARIES
64base_intermediates := $(call local-intermediates-dir)
65
66# Using := here prevents recursive expansion
67WEBKIT_SRC_FILES :=
68
69
70SOURCE_PATH := $(BASE_PATH)/Source
71WEBCORE_PATH := $(SOURCE_PATH)/WebCore
72JAVASCRIPTCORE_PATH := $(SOURCE_PATH)/JavaScriptCore
73WEBKIT_PATH := $(SOURCE_PATH)/WebKit
74WEBCORE_INTERMEDIATES_PATH := $(base_intermediates)/Source/WebCore
75
76# Build our list of include paths. We include Source/WebKit/android/icu first so that
77# any files that include <unicode/ucnv.h> will include our ucnv.h first. We
78# also add external/ as an include directory so that we can specify the real
79# icu header directory as a more exact reference to avoid including our ucnv.h.
80#
81# Note that JavasCriptCore/ must be included after WebCore/, so that we pick up
82# the right config.h.
83LOCAL_C_INCLUDES := \
84	$(JNI_H_INCLUDE) \
85	$(WEBKIT_PATH)/android/icu \
86	external/ \
87	external/icu4c/common \
88	external/icu4c/i18n \
89	external/jpeg \
90	external/libxml2/include \
91	external/libxslt \
92	external/hyphenation \
93	external/skia/emoji \
94	external/skia/gpu/include \
95	external/skia/include/core \
96	external/skia/include/effects \
97	external/skia/include/gpu \
98	external/skia/include/images \
99	external/skia/include/ports \
100	external/skia/include/utils \
101	external/skia/src/core \
102	external/skia/src/images \
103	external/skia/src/ports \
104	external/sqlite/dist \
105	frameworks/base/core/jni/android/graphics \
106	frameworks/base/include
107
108# Add Source/ for the include of <JavaScriptCore/config.h> from WebCore/config.h
109LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
110	$(SOURCE_PATH)
111
112LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
113	$(WEBCORE_PATH) \
114	$(WEBCORE_PATH)/accessibility \
115	$(WEBCORE_PATH)/bindings/ \
116	$(WEBCORE_PATH)/bindings/generic \
117	$(WEBCORE_PATH)/css \
118	$(WEBCORE_PATH)/dom \
119	$(WEBCORE_PATH)/editing \
120	$(WEBCORE_PATH)/fileapi \
121	$(WEBCORE_PATH)/history \
122	$(WEBCORE_PATH)/history/android \
123	$(WEBCORE_PATH)/html \
124	$(WEBCORE_PATH)/html/canvas \
125	$(WEBCORE_PATH)/html/parser \
126	$(WEBCORE_PATH)/html/shadow \
127	$(WEBCORE_PATH)/inspector \
128	$(WEBCORE_PATH)/loader \
129	$(WEBCORE_PATH)/loader/appcache \
130	$(WEBCORE_PATH)/loader/archive \
131	$(WEBCORE_PATH)/loader/archive/android \
132	$(WEBCORE_PATH)/loader/cache \
133	$(WEBCORE_PATH)/loader/icon \
134	$(WEBCORE_PATH)/notifications \
135	$(WEBCORE_PATH)/page \
136	$(WEBCORE_PATH)/page/android \
137	$(WEBCORE_PATH)/page/animation \
138	$(WEBCORE_PATH)/platform \
139	$(WEBCORE_PATH)/platform/android \
140	$(WEBCORE_PATH)/platform/animation \
141	$(WEBCORE_PATH)/platform/graphics \
142	$(WEBCORE_PATH)/platform/graphics/android \
143	$(WEBCORE_PATH)/platform/graphics/android/context \
144	$(WEBCORE_PATH)/platform/graphics/android/fonts \
145	$(WEBCORE_PATH)/platform/graphics/android/layers \
146	$(WEBCORE_PATH)/platform/graphics/android/rendering \
147	$(WEBCORE_PATH)/platform/graphics/android/utils \
148	$(WEBCORE_PATH)/platform/graphics/filters \
149	$(WEBCORE_PATH)/platform/graphics/gpu \
150	$(WEBCORE_PATH)/platform/graphics/network \
151	$(WEBCORE_PATH)/platform/graphics/skia \
152	$(WEBCORE_PATH)/platform/graphics/transforms \
153	$(WEBCORE_PATH)/platform/image-decoders \
154	$(WEBCORE_PATH)/platform/image-decoders/bmp \
155	$(WEBCORE_PATH)/platform/image-decoders/gif \
156	$(WEBCORE_PATH)/platform/image-decoders/ico \
157	$(WEBCORE_PATH)/platform/image-decoders/jpeg \
158	$(WEBCORE_PATH)/platform/image-decoders/png \
159	$(WEBCORE_PATH)/platform/image-decoders/webp \
160	$(WEBCORE_PATH)/platform/mock \
161	$(WEBCORE_PATH)/platform/network \
162	$(WEBCORE_PATH)/platform/network/android \
163	$(WEBCORE_PATH)/platform/sql \
164	$(WEBCORE_PATH)/platform/text \
165	$(WEBCORE_PATH)/platform/text/transcoder \
166	$(WEBCORE_PATH)/plugins \
167	$(WEBCORE_PATH)/plugins/android \
168	$(WEBCORE_PATH)/rendering \
169	$(WEBCORE_PATH)/rendering/style \
170	$(WEBCORE_PATH)/rendering/svg \
171	$(WEBCORE_PATH)/storage \
172	$(WEBCORE_PATH)/svg \
173	$(WEBCORE_PATH)/svg/animation \
174	$(WEBCORE_PATH)/svg/graphics \
175	$(WEBCORE_PATH)/svg/graphics/filters \
176	$(WEBCORE_PATH)/svg/properties \
177	$(WEBCORE_PATH)/websockets \
178	$(WEBCORE_PATH)/workers \
179	$(WEBCORE_PATH)/xml
180
181LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
182	$(WEBKIT_PATH)/android \
183	$(WEBKIT_PATH)/android/WebCoreSupport \
184	$(WEBKIT_PATH)/android/jni \
185	$(WEBKIT_PATH)/android/nav \
186	$(WEBKIT_PATH)/android/plugins
187
188LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
189	$(JAVASCRIPTCORE_PATH) \
190	$(JAVASCRIPTCORE_PATH)/collector/handles \
191	$(JAVASCRIPTCORE_PATH)/heap \
192	$(JAVASCRIPTCORE_PATH)/wtf \
193	$(JAVASCRIPTCORE_PATH)/wtf/unicode \
194	$(JAVASCRIPTCORE_PATH)/wtf/unicode/icu
195
196LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
197	$(WEBCORE_INTERMEDIATES_PATH) \
198	$(WEBCORE_INTERMEDIATES_PATH)/css \
199	$(WEBCORE_INTERMEDIATES_PATH)/html \
200	$(WEBCORE_INTERMEDIATES_PATH)/platform \
201	$(WEBCORE_INTERMEDIATES_PATH)/xml
202
203# The following includes are needed by the AutoFill feature, or the chrome http
204# stack
205LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
206	$(WEBKIT_PATH)/chromium \
207	$(WEBKIT_PATH)/chromium/public \
208	external/chromium/chrome/browser \
209	external/chromium/chrome/renderer \
210	external/chromium \
211	external/chromium/chrome \
212	external/skia
213
214LOCAL_CFLAGS += -DWEBKIT_IMPLEMENTATION=1
215
216# Include WTF source file.
217d := Source/JavaScriptCore
218LOCAL_PATH := $(BASE_PATH)/$d
219intermediates := $(base_intermediates)/$d
220include $(LOCAL_PATH)/Android.v8.wtf.mk
221WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
222
223# Include source files for WebCore
224d := Source/WebCore
225LOCAL_PATH := $(BASE_PATH)/$d
226intermediates := $(base_intermediates)/$d
227include $(LOCAL_PATH)/Android.mk
228include $(LOCAL_PATH)/Android.v8bindings.mk
229WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
230LOCAL_C_INCLUDES += $(BINDING_C_INCLUDES)
231
232# Include the derived source files for WebCore. Uses the same path as
233# WebCore
234include $(LOCAL_PATH)/Android.derived.mk
235include $(LOCAL_PATH)/Android.derived.v8bindings.mk
236
237# Include source files for android WebKit port
238d := Source/WebKit
239LOCAL_PATH := $(BASE_PATH)/$d
240intermediates := $(base_intermediates)/$d
241include $(LOCAL_PATH)/Android.mk
242WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES))
243
244# Redefine LOCAL_PATH here so the build system is not confused
245LOCAL_PATH := $(BASE_PATH)
246
247# Define our compiler flags
248LOCAL_CFLAGS += -Wno-endif-labels -Wno-import -Wno-format
249LOCAL_CFLAGS += -fno-strict-aliasing
250LOCAL_CFLAGS += -include "WebCorePrefix.h"
251LOCAL_CFLAGS += -fvisibility=hidden
252LOCAL_CFLAGS += -DALWAYS_INLINE=inline
253# Make sure assert.h is included before assert is defined
254LOCAL_CFLAGS += -include "assert.h"
255LOCAL_CFLAGS += -DGOOGLEURL
256LOCAL_CPPFLAGS := -Wno-sign-promo
257LOCAL_CPPFLAGS := -Wno-c++0x-compat
258
259# Adds GL and EGL extensions for the GL backend
260LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
261
262ifeq ($(TARGET_ARCH),arm)
263LOCAL_CFLAGS += -Darm
264# remove this warning: "note: the mangling of 'va_list' has changed in GCC 4.4"
265LOCAL_CFLAGS += -Wno-psabi
266endif
267
268ifeq ($(TARGET_ARCH_VARIANT),x86-atom)
269LOCAL_CFLAGS += -fno-pic
270endif
271
272# need a flag to tell the C side when we're on devices with large memory
273# budgets (i.e. larger than the low-end devices that initially shipped)
274ifeq ($(ARCH_ARM_HAVE_VFP),true)
275LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
276endif
277
278ifeq ($(TARGET_ARCH),x86)
279LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
280endif
281
282ifeq ($(ENABLE_SVG),true)
283LOCAL_CFLAGS += -DENABLE_SVG=1 -DENABLE_SVG_ANIMATION=1
284endif
285
286ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),false)
287LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=0
288endif
289
290ifeq ($(ENABLE_WTF_USE_ACCELERATED_COMPOSITING),true)
291LOCAL_CFLAGS += -DWTF_USE_ACCELERATED_COMPOSITING=1
292endif
293
294# LOCAL_LDLIBS is used in simulator builds only and simulator builds are only
295# valid on Linux
296LOCAL_LDLIBS += -lpthread -ldl
297
298# Build the list of shared libraries
299# We have to use the android version of libdl
300LOCAL_SHARED_LIBRARIES := \
301	libEGL \
302	libGLESv2 \
303	libandroid \
304	libandroidfw \
305	libandroid_runtime \
306	libchromium_net \
307	libcrypto \
308	libcutils \
309	libdl \
310	libgui \
311	libicuuc \
312	libicui18n \
313	liblog \
314	libmedia \
315	libnativehelper \
316	libskia \
317	libsqlite \
318	libssl \
319	libstlport \
320	libutils \
321	libui \
322	libz
323
324# We have to fake out some headers when using stlport.
325LOCAL_C_INCLUDES += \
326	external/chromium/android
327include external/stlport/libstlport.mk
328
329# We need Harfbuzz library to support complex scripts(Arabic, Thai, Hindi...).
330ifeq ($(SUPPORT_COMPLEX_SCRIPTS),true)
331LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
332	external/harfbuzz/src \
333	external/harfbuzz/contrib
334LOCAL_SHARED_LIBRARIES += libharfbuzz
335LOCAL_CFLAGS += -DSUPPORT_COMPLEX_SCRIPTS=1
336endif
337
338# Build the list of static libraries
339LOCAL_STATIC_LIBRARIES := libxml2 libxslt libhyphenation libv8
340
341ifeq ($(ENABLE_AUTOFILL),true)
342LOCAL_SHARED_LIBRARIES += libexpat
343endif
344
345# Redefine LOCAL_SRC_FILES to be all the WebKit source files
346LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES)
347
348# Define this for use in other makefiles.
349WEBKIT_C_INCLUDES := $(LOCAL_C_INCLUDES)
350WEBKIT_CFLAGS := $(LOCAL_CFLAGS)
351WEBKIT_CPPFLAGS := $(LOCAL_CPPFLAGS)
352WEBKIT_GENERATED_SOURCES := $(LOCAL_GENERATED_SOURCES)
353WEBKIT_LDLIBS := $(LOCAL_LDLIBS)
354WEBKIT_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES)
355WEBKIT_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES)
356
357ifneq ($(strip $(WITH_ADDRESS_SANITIZER)),)
358    LOCAL_MODULE_PATH := $(TARGET_OUT_STATIC_LIBRARIES)/asan
359    LOCAL_ADDRESS_SANITIZER := true
360endif
361
362# Build the library all at once
363include $(BUILD_STATIC_LIBRARY)
364
365# Now build the shared library using only the exported jni entry point. This
366# will strip out any unused code from the entry point.
367include $(CLEAR_VARS)
368# Do not attempt prelink this library. Needed to keep master-gpl happy, no
369# effect in master.
370# TODO: remove this when master-gpl is updated.
371LOCAL_PRELINK_MODULE := false
372LOCAL_MODULE := libwebcore
373LOCAL_LDLIBS := $(WEBKIT_LDLIBS)
374LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES)
375LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES)
376LOCAL_LDFLAGS := -fvisibility=hidden
377LOCAL_CFLAGS := $(WEBKIT_CFLAGS)
378LOCAL_CPPFLAGS := $(WEBKIT_CPPFLAGS)
379LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES)
380LOCAL_PATH := $(BASE_PATH)
381LOCAL_SRC_FILES := \
382	Source/WebKit/android/jni/WebCoreJniOnLoad.cpp \
383	Source/WebKit/chromium/src/android/WebDOMTextContentWalker.cpp \
384	Source/WebKit/chromium/src/android/WebHitTestInfo.cpp \
385	Source/WebKit/chromium/src/WebRange.cpp \
386	Source/WebKit/chromium/src/WebString.cpp
387
388ifeq ($(ENABLE_AUTOFILL),true)
389# AutoFill requires some cpp files from Chromium to link with
390# libchromium_net. We cannot compile them into libchromium_net
391# because they have cpp file extensions, not .cc.
392LOCAL_SRC_FILES += \
393	Source/WebKit/android/WebCoreSupport/autofill/MainThreadProxy.cpp \
394	Source/WebKit/chromium/src/WebCString.cpp \
395	Source/WebKit/chromium/src/WebRegularExpression.cpp
396endif
397
398# Do this dependency by hand. The reason we have to do this is because the
399# headers that this file pulls in are generated during the build of webcore.
400# We make all of our object files depend on those files so that they are built
401# before we try to compile the file.
402LOCAL_ADDITIONAL_DEPENDENCIES := $(filter %.h, $(WEBKIT_GENERATED_SOURCES))
403
404ifneq ($(strip $(WITH_ADDRESS_SANITIZER)),)
405    LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/asan
406    LOCAL_ADDRESS_SANITIZER := true
407endif
408
409include $(BUILD_SHARED_LIBRARY)
410
411# Build the wds client
412include $(WEBKIT_PATH)/android/wds/client/Android.mk
413
414# Build the webkit merge tool.
415include $(BASE_PATH)/Tools/android/webkitmerge/Android.mk
416