author Ms2ger <>
Thu, 22 Aug 2013 08:56:01 +0200
changeset 156680 34447d205d73fc6ade164a8ad7830eacc4041fe2
parent 156673 7ef14b724957931a61a5112d42f425139bc222c1
child 156924 755b0e538b7a82131923e63d11fdbe4fe1d6e5a2
permissions -rw-r--r--
Bug 904831 - Part b: Move unconditional MSVC_ENABLE_PGO definitions into; r=gps

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at

DEPTH            = @DEPTH@
topsrcdir        = @top_srcdir@
srcdir           = @srcdir@
VPATH            = @srcdir@

include $(DEPTH)/config/

LIBRARY_NAME     = dombindings_s

# Need this to find all our DOM source files.
include $(topsrcdir)/dom/

include $(topsrcdir)/dom/webidl/

binding_include_path := mozilla/dom
all_webidl_files = $(webidl_files) $(generated_webidl_files) $(preprocessed_webidl_files)
# Set exported_binding_headers before adding the test IDL to the mix
exported_binding_headers := $(subst .webidl,Binding.h,$(all_webidl_files))
# Set linked_binding_cpp_files before adding the test IDL to the mix
linked_binding_cpp_files := $(subst .webidl,Binding.cpp,$(all_webidl_files))

all_webidl_files += $(test_webidl_files)

binding_header_files := $(subst .webidl,Binding.h,$(all_webidl_files))
binding_cpp_files := $(subst .webidl,Binding.cpp,$(all_webidl_files))

# We want to be able to only regenerate the .cpp and .h files that really need
# to change when a .webidl file changes.  We do this by making the
# binding_dependency_trackers targets have dependencies on the right .webidl
# files via generated .pp files, having a .BindingGen target that depends on the
# binding_dependency_trackers and which has all the generated binding .h/.cpp
# depending on it, and then in the make commands for that target being able to
# check which exact binding_dependency_trackers changed.
binding_dependency_trackers := $(subst .webidl,Binding,$(all_webidl_files))

globalgen_targets := \
  PrototypeList.h \
  RegisterBindings.h \
  RegisterBindings.cpp \
  UnionTypes.h \
  UnionTypes.cpp \
  UnionConversions.h \

# Nasty hack: when the test/ invokes us to do codegen, it
# uses a target of
# "export TestExampleInterface-example TestExampleProxyInterface-example".
# We don't actually need to load our .o.pp files in that case, so just
# pretend like we have no CPPSRCS if that's the target.  It makes the
# test cycle much faster, which is why we're doing it.
# XXXbz We could try to cheat even more and only include our CPPSRCS
# when $(MAKECMDGOALS) contains libs, so that we can skip loading all
# those .o.pp when trying to make a single .cpp file too, but that
# would break |make FooBinding.o(bj)|.  Ah, well.
ifneq (export TestExampleInterface-example TestExampleProxyInterface-example,$(MAKECMDGOALS))
  $(linked_binding_cpp_files) \
  $(filter %.cpp, $(globalgen_targets)) \
  BindingUtils.cpp \
  CallbackInterface.cpp \
  CallbackObject.cpp \
  DOMJSProxyHandler.cpp \
  Date.cpp \

LOCAL_INCLUDES += -I$(topsrcdir)/js/xpconnect/src \
  -I$(topsrcdir)/js/xpconnect/wrappers \
  -I$(topsrcdir)/js/ipc \
  -I$(topsrcdir)/content/canvas/src \
  -I$(topsrcdir)/content/html/content/src \
  -I$(topsrcdir)/media/webrtc/signaling/src/peerconnection \
  -I$(topsrcdir)/dom/base \
  -I$(topsrcdir)/dom/battery \
  -I$(topsrcdir)/dom/indexedDB \
  -I$(topsrcdir)/content/xslt/src/base \
  -I$(topsrcdir)/content/xslt/src/xpath \
  -I$(topsrcdir)/content/xml/content/src \
  -I$(topsrcdir)/content/xul/content/src \
  -I$(topsrcdir)/content/xul/document/src \
  -I$(topsrcdir)/content/media/webspeech/recognition \

  -I$(topsrcdir)/dom/system/gonk \

ifdef MOZ_B2G_RIL
  -I$(topsrcdir)/dom/icc/src \

EXTRA_EXPORT_MDDEPEND_FILES := $(addsuffix .pp,$(binding_dependency_trackers))

EXPORTS_GENERATED_FILES := $(exported_binding_headers)
EXPORTS_GENERATED_DEST := $(DIST)/include/$(binding_include_path)

# Install auto-generated GlobalGen files. The rules for the install must
# be in the same target/subtier as, otherwise the files will not
# get installed into the appropriate location as they are generated.
globalgen_headers_FILES := \
  PrototypeList.h \
  RegisterBindings.h \
  UnionConversions.h \
  UnionTypes.h \
globalgen_headers_DEST = $(DIST)/include/mozilla/dom
globalgen_headers_TARGET := webidl
INSTALL_TARGETS += globalgen_headers

include $(topsrcdir)/config/
include $(topsrcdir)/ipc/chromium/

ifdef GNU_CC
CXXFLAGS += -Wno-uninitialized

# If you change bindinggen_dependencies here, change it in
# dom/bindings/test/ too.
bindinggen_dependencies := \ \
  Bindings.conf \ \ \
  ParserResults.pkl \
  parser/ \

CSS2Properties.webidl: $(topsrcdir)/layout/style/nsCSSPropList.h \
                       $(topsrcdir)/layout/style/nsCSSPropAliasList.h \
                       $(webidl_base)/ \
                       $(webidl_base)/CSS2PropertiesProps.h \
                       $(srcdir)/ \
	$(CPP) $(DEFINES) $(ACDEFINES) -I$(topsrcdir)/layout/style $(webidl_base)/CSS2PropertiesProps.h | \
	  $(srcdir)/ $(webidl_base)/ > CSS2Properties.webidl

$(webidl_files): %: $(webidl_base)/%
	$(INSTALL) $(IFLAGS1) $(webidl_base)/$* .

$(test_webidl_files): %: $(srcdir)/test/%
	$(INSTALL) $(IFLAGS1) $(srcdir)/test/$* .

# We can't easily use PP_TARGETS here because it insists on outputting targets
# that look like "$(CURDIR)/foo" whereas we want our target to just be "foo".
# Make sure to include $(GLOBAL_DEPS) so we pick up changes to what symbols are
# defined.  Also make sure to remove $@ before writing to it, because otherwise
# if a file goes from non-preprocessed to preprocessed we can end up writing to
# a symlink, which will clobber files in the srcdir, which is bad.
$(preprocessed_webidl_files): %: $(webidl_base)/% $(GLOBAL_DEPS)
	$(RM) $@
          $(topsrcdir)/config/ $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $(webidl_base)/$* -o $@

# Make is dumb and can get confused between "foo" and "$(CURDIR)/foo".  Make
# sure that the latter depends on the former, since the latter gets used in .pp
# files.
all_webidl_files_absolute = $(addprefix $(CURDIR)/,$(all_webidl_files))
$(all_webidl_files_absolute): $(CURDIR)/%: %

$(binding_header_files): .BindingGen

$(binding_cpp_files): .BindingGen

# $(binding_dependency_trackers) pick up additional dependencies via .pp files
# The rule: just brings the tracker up to date, if it's out of date, so that
# we'll know that we have to redo binding generation and flag this prerequisite
# there as being newer than the bindinggen target.
	@$(TOUCH) $@

$(globalgen_targets): ParserResults.pkl

%-example: .BindingGen
	PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $(topsrcdir)/config/ \
	  $(PLY_INCLUDE) -I$(srcdir)/parser \
	  $(srcdir)/ \
	  $(srcdir)/Bindings.conf $*

CACHE_DIR = _cache

globalgen_dependencies := \ \
  Bindings.conf \ \ \
  parser/ \
  ../webidl/ \
  $(all_webidl_files) \
  $(CACHE_DIR)/.done \

	@$(TOUCH) $@

# Running updates ParserResults.pkl as a side-effect
ParserResults.pkl: $(globalgen_dependencies)
	$(info Generating global WebIDL files)
	PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $(topsrcdir)/config/ \
	  $(PLY_INCLUDE) -I$(srcdir)/parser \
	  $(srcdir)/ $(srcdir)/Bindings.conf . \
	  --cachedir=$(CACHE_DIR) \

$(globalgen_headers_FILES): ParserResults.pkl

# Make sure .deps actually exists, since we'll try to write to it from
# but we're typically running in the export phase, which is
# before anyone has bothered creating .deps.
# Then, pass our long lists through files to try to avoid blowing out the
# command line.
# Next, will examine the changed dependency list to figure out
# what it really needs to regenerate.
# Finally, touch the .BindingGen file so that we don't have to keep redoing
# all that until something else actually changes.
.BindingGen: $(bindinggen_dependencies) $(binding_dependency_trackers)
	$(info Generating WebIDL bindings)
	$(MKDIR) -p .deps
	echo $(all_webidl_files) > .all-webidl-file-list
	echo $? > .changed-dependency-list
	PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $(topsrcdir)/config/ \
	  $(PLY_INCLUDE) -I$(srcdir)/parser \
	  $(srcdir)/ \
	  $(srcdir)/Bindings.conf \
	  $(CURDIR) \
	  .all-webidl-file-list \
	@$(TOUCH) $@

GARBAGE += \ \
  parser.out \
  $(wildcard *-example.h) \
  $(wildcard *-example.cpp) \
  .BindingGen \
  .all-webidl-file-list \
  .changed-dependency-list \
  $(binding_dependency_trackers) \

# Make sure all binding header files are created during the export stage, so we
# don't have issues with .cpp files being compiled before we've generated the
# headers they depend on.  This is really only needed for the test files, since
# the non-test headers are all exported above anyway.  Note that this means that
# we do all of our codegen during export.
webidl:: $(binding_header_files)

.PHONY: webidl

	-$(RM) \
        $(binding_header_files) \
        $(binding_cpp_files) \
        $(all_webidl_files) \
        $(globalgen_targets) \
        ParserResults.pkl \

# This is only needed to support |make| from this leaf directory/Makefile.
NONRECURSIVE_TARGETS_export_webidl_TARGETS := webidl