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# CSS property names and value keywords 27 28GEN := $(intermediates)/css/CSSPropertyNames.h 29$(GEN): SCRIPT := $(LOCAL_PATH)/css/makeprop.pl 30ifeq ($(ENABLE_SVG),true) 31$(GEN): $(intermediates)/%.h : $(LOCAL_PATH)/%.in $(LOCAL_PATH)/css/SVGCSSPropertyNames.in $(LOCAL_PATH)/css/AndroidCSSPropertyNames.in 32else 33$(GEN): $(intermediates)/%.h : $(LOCAL_PATH)/%.in $(LOCAL_PATH)/css/AndroidCSSPropertyNames.in 34endif 35 @echo "Generating CSSPropertyNames.h <= CSSPropertyNames.in" 36 @mkdir -p $(dir $@) 37 @cat $< > $(dir $@)/$(notdir $<) 38 @cat $^ > $(@:%.h=%.in) 39 @cp -f $(SCRIPT) $(dir $@) 40 @cd $(dir $@) ; perl ./$(notdir $(SCRIPT)) 41LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) 42 43# We also need the .cpp files, which are generated as side effects of the 44# above rules. Specifying this explicitly makes -j2 work. 45$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/css/%.cpp : $(intermediates)/css/%.h 46 47 48GEN := $(intermediates)/css/CSSValueKeywords.h 49$(GEN): SCRIPT := $(LOCAL_PATH)/css/makevalues.pl 50$(GEN): $(intermediates)/%.h : $(LOCAL_PATH)/%.in $(LOCAL_PATH)/css/SVGCSSValueKeywords.in 51 @echo "Generating CSSValueKeywords.h <= CSSValueKeywords.in" 52 @mkdir -p $(dir $@) 53 @cp -f $(SCRIPT) $(dir $@) 54ifeq ($(ENABLE_SVG),true) 55 @perl -ne 'print lc' $^ > $(@:%.h=%.in) 56else 57 @perl -ne 'print lc' $< > $(@:%.h=%.in) 58endif 59 @cd $(dir $@); perl makevalues.pl 60LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) 61 62# We also need the .cpp files, which are generated as side effects of the 63# above rules. Specifying this explicitly makes -j2 work. 64$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/css/%.cpp : $(intermediates)/css/%.h 65 66 67# DOCTYPE strings 68 69GEN := $(intermediates)/html/DocTypeStrings.cpp 70$(GEN): SCRIPT := $(LOCAL_PATH)/make-hash-tools.pl 71$(GEN): PRIVATE_CUSTOM_TOOL = perl $(SCRIPT) $(dir $@) $< 72$(GEN): $(LOCAL_PATH)/html/DocTypeStrings.gperf 73 $(transform-generated-source) 74LOCAL_GENERATED_SOURCES += $(GEN) 75 76# XMLViewer CSS 77GEN := $(intermediates)/xml/XMLViewerCSS.h 78$(GEN): SCRIPT := $(LOCAL_PATH)/inspector/xxd.pl 79$(GEN): PRIVATE_CUSTOM_TOOL = perl $(SCRIPT) XMLViewer_css $< $@ 80$(GEN): $(LOCAL_PATH)/xml/XMLViewer.css 81 $(transform-generated-source) 82LOCAL_GENERATED_SOURCES += $(GEN) 83 84# XMLViewer JS 85GEN := $(intermediates)/xml/XMLViewerJS.h 86$(GEN): SCRIPT := $(LOCAL_PATH)/inspector/xxd.pl 87$(GEN): PRIVATE_CUSTOM_TOOL = perl $(SCRIPT) XMLViewer_js $< $@ 88$(GEN): $(LOCAL_PATH)/xml/XMLViewer.js 89 $(transform-generated-source) 90LOCAL_GENERATED_SOURCES += $(GEN) 91 92# HTML entity table 93 94GEN := $(intermediates)/html/HTMLEntityTable.cpp 95$(GEN): SCRIPT := $(LOCAL_PATH)/html/parser/create-html-entity-table 96$(GEN): WEBKITPY_RESOURCES_DIRECTORY := $(LOCAL_PATH)/../../Tools/Scripts/webkitpy 97$(GEN): PRIVATE_CUSTOM_TOOL = $(dir $@)$(notdir $(SCRIPT)) -o $@ $< 98$(GEN): $(LOCAL_PATH)/html/parser/HTMLEntityNames.in 99 @echo "Generating HTMLEntityTable.cpp" 100 @mkdir -p $(dir $@) 101 @cp -f $(SCRIPT) $(dir $@) 102 @cp -rf $(WEBKITPY_RESOURCES_DIRECTORY) $(dir $@) 103 $(transform-generated-source) 104LOCAL_GENERATED_SOURCES += $(GEN) 105 106 107# color names 108 109GEN := $(intermediates)/platform/ColorData.cpp 110$(GEN): SCRIPT := $(LOCAL_PATH)/make-hash-tools.pl 111$(GEN): PRIVATE_CUSTOM_TOOL = perl $(SCRIPT) $(dir $@) $< 112$(GEN): $(LOCAL_PATH)/platform/ColorData.gperf 113 $(transform-generated-source) 114LOCAL_GENERATED_SOURCES += $(GEN) 115 116 117# CSS tokenizer 118 119GEN := $(intermediates)/css/tokenizer.cpp 120$(GEN): PRIVATE_CUSTOM_TOOL = $(OLD_FLEX) -t $< | perl $(dir $<)/maketokenizer > $@ 121$(GEN): $(LOCAL_PATH)/css/tokenizer.flex $(LOCAL_PATH)/css/maketokenizer 122 $(transform-generated-source) 123# we have to do this dep by hand: 124$(intermediates)/css/CSSParser.o : $(GEN) 125 126# CSS grammar 127 128GEN := $(intermediates)/CSSGrammar.cpp 129$(GEN) : PRIVATE_YACCFLAGS := -p cssyy 130$(GEN): $(LOCAL_PATH)/css/CSSGrammar.y 131 $(call local-transform-y-to-cpp,.cpp) 132$(GEN): $(LOCAL_BISON) 133 134LOCAL_GENERATED_SOURCES += $(GEN) 135 136# XPath grammar 137 138GEN := $(intermediates)/XPathGrammar.cpp 139$(GEN) : PRIVATE_YACCFLAGS := -p xpathyy 140$(GEN): $(LOCAL_PATH)/xml/XPathGrammar.y 141 $(call local-transform-y-to-cpp,.cpp) 142$(GEN): $(LOCAL_BISON) 143 144LOCAL_GENERATED_SOURCES += $(GEN) 145# user agent style sheets 146 147style_sheets := $(LOCAL_PATH)/css/html.css $(LOCAL_PATH)/css/quirks.css $(LOCAL_PATH)/css/fullscreen.css $(LOCAL_PATH)/css/view-source.css $(LOCAL_PATH)/css/mediaControls.css $(LOCAL_PATH)/css/mediaControlsAndroid.css 148ifeq ($(ENABLE_SVG), true) 149style_sheets := $(style_sheets) $(LOCAL_PATH)/css/svg.css 150endif 151GEN := $(intermediates)/css/UserAgentStyleSheets.h 152make_css_file_arrays := $(LOCAL_PATH)/css/make-css-file-arrays.pl 153$(GEN): PRIVATE_CUSTOM_TOOL = $< $@ $(basename $@).cpp $(filter %.css,$^) 154$(GEN): $(make_css_file_arrays) $(style_sheets) 155 $(transform-generated-source) 156LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) 157 158# character set name table 159 160#gen_inputs := \ 161 $(LOCAL_PATH)/platform/make-charset-table.pl \ 162 $(LOCAL_PATH)/platform/character-sets.txt \ 163 $(LOCAL_PATH)/platform/android/android-encodings.txt 164#GEN := $(intermediates)/platform/CharsetData.cpp 165#$(GEN): PRIVATE_CUSTOM_TOOL = $^ "android::Encoding::ENCODING_" > $@ 166#$(GEN): $(gen_inputs) 167# $(transform-generated-source) 168#LOCAL_GENERATED_SOURCES += $(GEN) 169 170# the above rule will make this build too 171$(intermediates)/css/UserAgentStyleSheets.cpp : $(GEN) 172 173# XML attribute names 174 175GEN:= $(intermediates)/XMLNSNames.cpp 176$(GEN): PRIVATE_PATH := $(LOCAL_PATH) 177$(GEN): PRIVATE_CUSTOM_TOOL = perl -I $(PRIVATE_PATH)/bindings/scripts $< --attrs $(xmlns_attrs) --output $(dir $@) 178$(GEN): xmlns_attrs := $(LOCAL_PATH)/xml/xmlnsattrs.in 179$(GEN): $(LOCAL_PATH)/dom/make_names.pl $(xmlns_attrs) 180 $(transform-generated-source) 181LOCAL_GENERATED_SOURCES += $(GEN) 182 183GEN:= $(intermediates)/XMLNames.cpp 184$(GEN): PRIVATE_PATH := $(LOCAL_PATH) 185$(GEN): PRIVATE_CUSTOM_TOOL = perl -I $(PRIVATE_PATH)/bindings/scripts $< --attrs $(xml_attrs) --output $(dir $@) 186$(GEN): xml_attrs := $(LOCAL_PATH)/xml/xmlattrs.in 187$(GEN): $(LOCAL_PATH)/dom/make_names.pl $(xml_attrs) 188 $(transform-generated-source) 189LOCAL_GENERATED_SOURCES += $(GEN) 190 191# XLink attribute names 192 193GEN:= $(intermediates)/XLinkNames.cpp 194$(GEN): PRIVATE_PATH := $(LOCAL_PATH) 195$(GEN): PRIVATE_CUSTOM_TOOL = perl -I $(PRIVATE_PATH)/bindings/scripts $< --attrs $(xlink_attrs) --output $(dir $@) 196$(GEN): xlink_attrs := $(LOCAL_PATH)/svg/xlinkattrs.in 197$(GEN): $(LOCAL_PATH)/dom/make_names.pl $(xlink_attrs) 198 $(transform-generated-source) 199LOCAL_GENERATED_SOURCES += $(GEN) 200 201ifeq ($(ENABLE_AUTOFILL),true) 202# This is really ugly, but necessary. The following rules are taken from 203# external/chromium/Android.mk. 204# Chromium uses several third party libraries and headers that are already 205# present on Android, but in different include paths. Generate a set of 206# forwarding headers in the location that Chromium expects. We need to do 207# this in both the Chromium and WebCore projects because of the 208# WebKit <-> Chromium bindings which include headers from the Chromuim project. 209 210THIRD_PARTY = $(intermediates)/third_party 211CHROMIUM_SRC_DIR := $(LOCAL_PATH)/../../../chromium 212SCRIPT := $(CHROMIUM_SRC_DIR)/android/generateAndroidForwardingHeader.pl 213 214GEN := $(THIRD_PARTY)/expat/files/lib/expat.h 215$(GEN): $(SCRIPT) 216$(GEN): 217 perl $(SCRIPT) $@ "lib/expat.h" 218LOCAL_GENERATED_SOURCES += $(GEN) 219 220GEN := $(THIRD_PARTY)/skia/include/core/SkBitmap.h 221$(GEN): $(SCRIPT) 222$(GEN): 223 perl $(SCRIPT) $@ "include/core/SkBitmap.h" 224LOCAL_GENERATED_SOURCES += $(GEN) 225 226GEN := $(THIRD_PARTY)/WebKit/WebKit/chromium/public/WebFormControlElement.h 227$(GEN): $(SCRIPT) 228$(GEN): 229 perl $(SCRIPT) $@ "public/WebFormControlElement.h" 230LOCAL_GENERATED_SOURCES += $(GEN) 231 232GEN := $(THIRD_PARTY)/WebKit/WebKit/chromium/public/WebRegularExpression.h 233$(GEN): $(SCRIPT) 234$(GEN): 235 perl $(SCRIPT) $@ "public/WebRegularExpression.h" 236LOCAL_GENERATED_SOURCES += $(GEN) 237 238GEN := $(THIRD_PARTY)/WebKit/WebKit/chromium/public/WebString.h 239$(GEN): $(SCRIPT) 240$(GEN): 241 perl $(SCRIPT) $@ "public/WebString.h" 242LOCAL_GENERATED_SOURCES += $(GEN) 243 244endif 245 246LOCAL_SRC_FILES += $(LOCAL_GENERATED_SOURCES) 247