WebCore folder has three projects: qtmoviewin, WebCore, and webcoregenerated. The compilation sequence is: webcoregenerated-> qtmoviewin.
First, let's take a look at the webcoregenerated project. The nmake build Comand line of this project is as follows:
%SystemDrive%/cygwin/bin/which.exe bashif errorlevel 1 set PATH=%SystemDrive%/cygwin/bin;%PATH%cmd /cif exist "$(ConfigurationBuildDir)/buildfailed" grep XX$(ProjectName)XX "$(ConfigurationBuildDir)/buildfailed"if errorlevel 1 exit 1echo XX$(ProjectName)XX > "$(ConfigurationBuildDir)/buildfailed"set CONFIGURATIONBUILDDIR=$(ConfigurationBuildDir)bash build-generated-files.sh "$(ConfigurationBuildDir)" "$(WebKitLibrariesDir)" "$(WebKitVSPropsRedirectionDir)../../../WebKitLibraries/win" cairobash migrate-scripts.sh "$(ConfigurationBuildDir)/obj/WebCore/scripts"cmd /C copyForwardingHeaders.cmd cairo curlcmd /C copyInspectorFiles.cmdif exist "$(ConfigurationBuildDir)/buildfailed" del "$(ConfigurationBuildDir)/buildfailed"
The following four sentences are important:
bash build-generated-files.sh "$(ConfigurationBuildDir)" "$(WebKitLibrariesDir)" "$(WebKitVSPropsRedirectionDir)../../../WebKitLibraries/win" cairobash migrate-scripts.sh "$(ConfigurationBuildDir)/obj/WebCore/scripts"cmd /C copyForwardingHeaders.cmd cairo curlcmd /C copyInspectorFiles.cmd
First let's look at the build-generated-files.sh:
build-generated-files.sh#!/usr/bin/bash# Copyright (C) 2007 Apple Inc. All rights reserved.## Redistribution and use in source and binary forms, with or without# modification, are permitted provided that the following conditions# are met:## 1. Redistributions of source code must retain the above copyright# notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright# notice, this list of conditions and the following disclaimer in the# documentation and/or other materials provided with the distribution. # 3. Neither the name of Apple puter, Inc. ("Apple") nor the names of# its contributors may be used to endorse or promote products derived# from this software without specific prior written permission.## THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.NUMCPUS=`../../../Tools/Scripts/num-cpus`XSRCROOT="`pwd`/.."XSRCROOT=`realpath "$XSRCROOT"`# Do a little dance to get the path into 8.3 form to make it safe for gnu make# http://bugzilla.opendarwin.org/show_bug.cgi?id=8173XSRCROOT=`cygpath -m -s "$XSRCROOT"`XSRCROOT=`cygpath -u "$XSRCROOT"`export XSRCROOTexport SOURCE_ROOT=$XSRCROOTXDSTROOT="$1"export XDSTROOT# Do a little dance to get the path into 8.3 form to make it safe for gnu make# http://bugzilla.opendarwin.org/show_bug.cgi?id=8173XDSTROOT=`cygpath -m -s "$XDSTROOT"`XDSTROOT=`cygpath -u "$XDSTROOT"`export XDSTROOTSDKROOT="$2"export SDKROOT# Do a little dance to get the path into 8.3 form to make it safe for gnu make# http://bugzilla.opendarwin.org/show_bug.cgi?id=8173SDKROOT=`cygpath -m -s "$SDKROOT"`SDKROOT=`cygpath -u "$SDKROOT"`export SDKROOTVSPROPSROOT="$3"export VSPROPSROOT# Do a little dance to get the path into 8.3 form to make it safe for gnu make# http://bugzilla.opendarwin.org/show_bug.cgi?id=8173VSPROPSROOT=`cygpath -m -s "$VSPROPSROOT"`VSPROPSROOT=`cygpath -u "$VSPROPSROOT"`export VSPROPSROOTexport BUILT_PRODUCTS_DIR="$XDSTROOT/obj/WebCore"mkdir -p "${BUILT_PRODUCTS_DIR}/DerivedSources"cd "${BUILT_PRODUCTS_DIR}/DerivedSources"export WebCore="${XSRCROOT}"export FEATURE_DEFINES=`$SDKROOT/tools/scripts/feature-defines.sh $VSPROPSROOT $4`make -f "$WebCore/DerivedSources.make" -j ${NUMCPUS} || exit 1
This script is more important than the last two sentences. In the penultimate sentence, convert the value in vsprops to the environment variable feature_defines. Call make to compile $ WebCore/derivedsources. make (D:/tools/cygwin/home/xufan/WebKit/source/WebCore/derivedsources. make) this file, the number of tasks compiled by the-J option at the same time (multi-core advantage ). The content of derivedsources. Make is as follows:
DerivedSources.makeVPATH = / $(WebCore) / $(WebCore)/bindings/generic / $(WebCore)/bindings/js / $(WebCore)/bindings/objc / $(WebCore)/css / $(WebCore)/dom / $(WebCore)/fileapi / $(WebCore)/html / $(WebCore)/html/canvas / $(WebCore)/inspector / $(WebCore)/loader/appcache / $(WebCore)/notifications / $(WebCore)/page / $(WebCore)/plugins / $(WebCore)/storage / $(WebCore)/xml / $(WebCore)/webaudio / $(WebCore)/wml / $(WebCore)/workers / $(WebCore)/svg / $(WebCore)/websockets /#DOM_CLASSES = / AbstractView / AbstractWorker / Attr / AudioBuffer / AudioBufferSourceNode / AudioChannelSplitter / AudioChannelMerger / AudioContext / ..... XPathExpression / XPathNSResolver / XPathResult / XSLTProcessor /#.PHONY : allJS_DOM_HEADERS=$(filter-out JSMediaQueryListListener.h JSEventListener.h JSEventTarget.h,$(DOM_CLASSES:%=JS%.h))WEB_DOM_HEADERS :=ifeq ($(findstring BUILDING_WX,$(FEATURE_DEFINES)), BUILDING_WX)WEB_DOM_HEADERS := $(filter-out WebDOMXSLTProcessor.h WebDOMEventTarget.h,$(DOM_CLASSES:%=WebDOM%.h))endif # BUILDING_WXall : / $(JS_DOM_HEADERS) / $(WEB_DOM_HEADERS) / / JSJavaScriptCallFrame.h / / CSSGrammar.cpp / CSSPropertyNames.h / CSSValueKeywords.h / ColorData.cpp / DocTypeStrings.cpp / HTMLElementFactory.cpp / HTMLEntityTable.cpp / HTMLNames.cpp / WMLElementFactory.cpp / WMLNames.cpp / JSSVGElementWrapperFactory.cpp / SVGElementFactory.cpp / SVGNames.cpp / UserAgentStyleSheets.h / XLinkNames.cpp / XMLNSNames.cpp / XMLNames.cpp / MathMLElementFactory.cpp / MathMLNames.cpp / XPathGrammar.cpp / tokenizer.cpp / HeaderDetection.h /## --------ADDITIONAL_IDL_DEFINES :=ifeq ($(OS),MACOS)FRAMEWORK_FLAGS = $(shell echo $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_SEARCH_PATHS) | perl -e 'print "-F " . join(" -F ", split(" ", ));')ifeq ($(shell gcc -E -P -dM $(FRAMEWORK_FLAGS) WebCore/ForwardingHeaders/wtf/Platform.h | grep ENABLE_DASHBOARD_SUPPORT | cut -d' ' -f3), 1) ENABLE_DASHBOARD_SUPPORT = 1else ENABLE_DASHBOARD_SUPPORT = 0endififeq ($(shell gcc -E -P -dM $(FRAMEWORK_FLAGS) WebCore/ForwardingHeaders/wtf/Platform.h | grep ENABLE_ORIENTATION_EVENTS | cut -d' ' -f3), 1) ENABLE_ORIENTATION_EVENTS = 1else ENABLE_ORIENTATION_EVENTS = 0endifelseifndef ENABLE_DASHBOARD_SUPPORT ENABLE_DASHBOARD_SUPPORT = 0endififndef ENABLE_ORIENTATION_EVENTS ENABLE_ORIENTATION_EVENTS = 0endifendif # MACOSifeq ($(ENABLE_ORIENTATION_EVENTS), 1) ADDITIONAL_IDL_DEFINES := $(ADDITIONAL_IDL_DEFINES) ENABLE_ORIENTATION_EVENTSendif# --------# CSS property names and value keywordsWEBCORE_CSS_PROPERTY_NAMES := $(WebCore)/css/CSSPropertyNames.inWEBCORE_CSS_VALUE_KEYWORDS := $(WebCore)/css/CSSValueKeywords.inifeq ($(findstring ENABLE_SVG,$(FEATURE_DEFINES)), ENABLE_SVG) WEBCORE_CSS_PROPERTY_NAMES := $(WEBCORE_CSS_PROPERTY_NAMES) $(WebCore)/css/SVGCSSPropertyNames.in WEBCORE_CSS_VALUE_KEYWORDS := $(WEBCORE_CSS_VALUE_KEYWORDS) $(WebCore)/css/SVGCSSValueKeywords.inendififeq ($(ENABLE_DASHBOARD_SUPPORT), 1) WEBCORE_CSS_PROPERTY_NAMES := $(WEBCORE_CSS_PROPERTY_NAMES) $(WebCore)/css/DashboardSupportCSSPropertyNames.inendif# The grep commands below reject output containing anything other than:# 1. Lines beginning with '#'# 2. Lines containing only whitespace# These two types of lines will be ignored by make{prop,values}.pl.CSSPropertyNames.h : $(WEBCORE_CSS_PROPERTY_NAMES) css/makeprop.plif sort $(WEBCORE_CSS_PROPERTY_NAMES) | uniq -d | grep -E -v '(^#)|(^[[:space:]]*$$)'; then echo 'Duplicate value!'; exit 1; ficat $(WEBCORE_CSS_PROPERTY_NAMES) > CSSPropertyNames.inperl "$(WebCore)/css/makeprop.pl"CSSValueKeywords.h : $(WEBCORE_CSS_VALUE_KEYWORDS) css/makevalues.pl# Lower case all the values, as CSS values are case-insensitiveperl -ne 'print lc' $(WEBCORE_CSS_VALUE_KEYWORDS) > CSSValueKeywords.inif sort CSSValueKeywords.in | uniq -d | grep -E -v '(^#)|(^[[:space:]]*$$)'; then echo 'Duplicate value!'; exit 1; fiperl "$(WebCore)/css/makevalues.pl"# --------# DOCTYPE stringsDocTypeStrings.cpp : html/DocTypeStrings.gperf $(WebCore)/make-hash-tools.plperl $(WebCore)/make-hash-tools.pl . $(WebCore)/html/DocTypeStrings.gperf# --------# HTML entity namesHTMLEntityTable.cpp : html/parser/HTMLEntityNames.in $(WebCore)/html/parser/create-html-entity-tablepython $(WebCore)/html/parser/create-html-entity-table -o HTMLEntityTable.cpp $(WebCore)/html/parser/HTMLEntityNames.in# --------# color namesColorData.cpp : platform/ColorData.gperf $(WebCore)/make-hash-tools.plperl $(WebCore)/make-hash-tools.pl . $(WebCore)/platform/ColorData.gperf# --------# CSS tokenizertokenizer.cpp : css/tokenizer.flex css/maketokenizerflex -t $ $@# --------# CSS grammar# NOTE: Older versions of bison do not inject an inclusion guard, so we add one.CSSGrammar.cpp : css/CSSGrammar.ybison -d -p cssyy $ CSSGrammar.hecho '#define CSSGrammar_h' >> CSSGrammar.hcat CSSGrammar.cpp.h CSSGrammar.hpp >> CSSGrammar.hecho '#endif' >> CSSGrammar.hrm -f CSSGrammar.cpp.h CSSGrammar.hpp# --------# XPath grammar# NOTE: Older versions of bison do not inject an inclusion guard, so we add one.XPathGrammar.cpp : xml/XPathGrammar.y $(PROJECT_FILE)bison -d -p xpathyy $ XPathGrammar.hecho '#define XPathGrammar_h' >> XPathGrammar.hcat XPathGrammar.cpp.h XPathGrammar.hpp >> XPathGrammar.hecho '#endif' >> XPathGrammar.hrm -f XPathGrammar.cpp.h XPathGrammar.hpp# --------# user agent style sheetsUSER_AGENT_STYLE_SHEETS = $(WebCore)/css/html.css $(WebCore)/css/quirks.css $(WebCore)/css/view-source.css $(WebCore)/css/themeWin.css $(WebCore)/css/themeWinQuirks.css ifeq ($(findstring ENABLE_SVG,$(FEATURE_DEFINES)), ENABLE_SVG) USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/svg.css endififeq ($(findstring ENABLE_WML,$(FEATURE_DEFINES)), ENABLE_WML) USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/wml.cssendififeq ($(findstring ENABLE_MATHML,$(FEATURE_DEFINES)), ENABLE_MATHML) USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/mathml.cssendififeq ($(findstring ENABLE_VIDEO,$(FEATURE_DEFINES)), ENABLE_VIDEO) USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/mediaControls.css USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/mediaControlsQuickTime.cssendififeq ($(findstring ENABLE_FULLSCREEN_API,$(FEATURE_DEFINES)), ENABLE_FULLSCREEN_API) USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/fullscreen.cssendifUserAgentStyleSheets.h : css/make-css-file-arrays.pl $(USER_AGENT_STYLE_SHEETS)perl $$(HTML_FLAGS)"elseHTMLElementFactory.cpp HTMLNames.cpp : dom/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.inperl -I $(WebCore)/bindings/scripts $if svg experimental features are enabled)ifdef SVG_FLAGSSVGElementFactory.cpp SVGNames.cpp : dom/make_names.pl svg/svgtags.in svg/svgattrs.inperl -I $(WebCore)/bindings/scripts $$(SVG_FLAGS)" --factory --wrapperFactoryelseSVGElementFactory.cpp SVGNames.cpp : dom/make_names.pl svg/svgtags.in svg/svgattrs.inperl -I $(WebCore)/bindings/scripts $elseWMLElementFactory.cpp :echo > $@WMLNames.cpp :echo > $@endif# -------- # MathML tag and attribute names, and element factoryMathMLElementFactory.cpp MathMLNames.cpp : dom/make_names.pl mathml/mathtags.in mathml/mathattrs.inperl -I $(WebCore)/bindings/scripts $sort $(dir $(1)))) $(WebCore)/bindings/scripts/generate-bindings.pl# JS bindings generatorIDL_INCLUDES = dom fileapi html css page notifications xml svgIDL_COMMON_ARGS = $(IDL_INCLUDES:%=--include %) --write-dependencies --outputDir .JS_BINDINGS_SCRIPTS = $(GENERATE_SCRIPTS) bindings/scripts/CodeGeneratorJS.pmJS%.h : %.idl $(JS_BINDINGS_SCRIPTS)$(call generator_script, $(JS_BINDINGS_SCRIPTS)) $(IDL_COMMON_ARGS) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS $$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator Inspector $$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_CPP" --generator CPP $ $@# --------ifneq ($(ACTION),installhdrs)all : WebCore.exp WebCore.LP64.expWebCore.exp : $(BUILT_PRODUCTS_DIR)/WebCoreExportFileGenerator$^ > $@# Switch NSRect, NSSize and NSPoint with their CG counterparts for the 64-bit exports file.WebCore.LP64.exp : WebCore.expcat $^ | sed -e s/7_NSRect/6CGRect/ -e s/7_NSSize/6CGSize/ -e s/8_NSPoint/7CGPoint/ > $@endif # installhdrs# --------# Objective-C bindingsDOM_BINDINGS_SCRIPTS = $(GENERATE_BINDING_SCRIPTS) bindings/scripts/CodeGeneratorObjC.pmDOM%.h : %.idl $(DOM_BINDINGS_SCRIPTS) bindings/objc/PublicDOMInterfaces.h$(call generator_script, $(DOM_BINDINGS_SCRIPTS)) $(IDL_COMMON_ARGS) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_OBJECTIVE_C" --generator ObjC $/* This is a generated file. Do not edit. */" > $@if [ -f $(SDKROOT)/System/Library/Frameworks/AppKit.framework/PrivateHeaders/NSScrollerImpPair_Private.h ]; then echo "#define USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER 1" >> $@; else echo >> $@; fielseHeaderDetection.h :echo > $@endif
The vpath variable defines where make looks for files. There is a hidden danger in using vpath: vpath searches all source files in each directory. If the same file name appears in different directories, vpath uses the first searched file as the result. vpath is more flexible than vpath. WebKit does not have this problem yet, so vpath is enough. Many of the following rules do not specify the path. The vpath is used to open the path and hand it over to the Make tool.
Dom_classes defines a large number of H and CPP file lists to be generated based on IDL files. There are about 450. The generated files are in D: /tools/cygwin/home/xufan/WebKit/webkitbuild/debug_cairo_cflite/obj/WebCore/derivedsources directory.
Js_dom_headers adds all dom_classes values with the JS prefix and removes the jsmediaquerylistlistener. h jseventlistener. h jseventtarget. H files.
When web_dom_headers includes building_wx in the compilation options, all dom_classes values are prefixed with webdom and the webdompolictprocessor. h webdomeventtarget. H values are excluded. In the Cairo Win32 compiling environment, this variable is empty.
The makefile entry is the all rule. All depends on $ (js_dom_headers), $ (web_dom_headers), and js1_criptcallframe. h, cssgrammar. CPP, csspropertynames. h, cssvaluekeywords. h, colordata. CPP, doctypestrings. CPP, htmlelementfactory. CPP, htmlentitytable. CPP, htmlnames. CPP, wmlelementfactory. CPP, wmlnames. CPP, jssvgelementwrapperfactory. CPP, svgelementfactory. CPP, svgnames. CPP, useragentstylesheets. h, xlinknames. CPP, xmlnsnames. CPP, xmlnames. CPP, math Mlelementfactory. cpp, mathmlnames. cpp, xpathgrammar. cpp, tokenizer. cpp, headerdetection. h. The following describes how makefile processes these files.