DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (31ec81b5d7bb)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
# 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 http://mozilla.org/MPL/2.0/.

webidl_base = $(topsrcdir)/dom/webidl
# Generated by moz.build
include webidlsrcs.mk

binding_include_path := mozilla/dom
webidl_files += $(generated_events_webidl_files)
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))
exported_generated_events_headers := $(subst .webidl,.h,$(generated_events_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))
linked_generated_events_cpp_files := $(subst .webidl,.cpp,$(generated_events_webidl_files))

all_webidl_files += $(test_webidl_files) $(preprocessed_test_webidl_files)

generated_header_files := $(subst .webidl,Binding.h,$(all_webidl_files)) $(exported_generated_events_headers)
generated_cpp_files := $(subst .webidl,Binding.cpp,$(all_webidl_files)) $(linked_generated_events_cpp_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 := \
  GeneratedAtomList.h \
  PrototypeList.h \
  RegisterBindings.h \
  RegisterBindings.cpp \
  UnionTypes.h \
  UnionTypes.cpp \
  UnionConversions.h \
  $(NULL)

# Nasty hack: when the test/Makefile.in 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))
CPPSRCS = \
  $(unified_binding_cpp_files) \
  $(linked_generated_events_cpp_files) \
  $(filter %.cpp, $(globalgen_targets)) \
  $(NULL)
endif

ABS_DIST := $(abspath $(DIST))

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

EXPORTS_GENERATED_FILES := $(exported_binding_headers) $(exported_generated_events_headers)
EXPORTS_GENERATED_DEST := $(ABS_DIST)/include/$(binding_include_path)
EXPORTS_GENERATED_TARGET := export
INSTALL_TARGETS += EXPORTS_GENERATED

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

include $(topsrcdir)/config/rules.mk

ifdef GNU_CC
CXXFLAGS += -Wno-uninitialized
endif

# If you change bindinggen_dependencies here, change it in
# dom/bindings/test/Makefile.in too.
bindinggen_dependencies := \
  BindingGen.py \
  Bindings.conf \
  Configuration.py \
  Codegen.py \
  ParserResults.pkl \
  parser/WebIDL.py \
  $(GLOBAL_DEPS) \
  $(NULL)

CSS2Properties.webidl: $(topsrcdir)/layout/style/nsCSSPropList.h \
                       $(topsrcdir)/layout/style/nsCSSPropAliasList.h \
                       $(webidl_base)/CSS2Properties.webidl.in \
                       $(webidl_base)/CSS2PropertiesProps.h \
                       $(srcdir)/GenerateCSS2PropertiesWebIDL.py \
                       $(GLOBAL_DEPS)
	$(CPP) $(DEFINES) $(ACDEFINES) -I$(topsrcdir)/layout/style $(webidl_base)/CSS2PropertiesProps.h | \
	  PYTHONDONTWRITEBYTECODE=1 $(PYTHON) \
	  $(srcdir)/GenerateCSS2PropertiesWebIDL.py $(webidl_base)/CSS2Properties.webidl.in > 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) $@
	$(call py_action,preprocessor, \
          $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $(webidl_base)/$* -o $@)

# See the comment about PP_TARGETS for $(preprocessed_webidl_files)
$(preprocessed_test_webidl_files): %: $(srcdir)/test/% $(GLOBAL_DEPS)
	$(RM) $@
	$(call py_action,preprocessor, \
          $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $(srcdir)/test/$* -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)/%: %

$(generated_header_files): .BindingGen

$(generated_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.
$(binding_dependency_trackers):
	@$(TOUCH) $@

$(globalgen_targets): ParserResults.pkl

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

CACHE_DIR = _cache

globalgen_dependencies := \
  GlobalGen.py \
  Bindings.conf \
  Configuration.py \
  Codegen.py \
  parser/WebIDL.py \
  webidlsrcs.mk \
  $(all_webidl_files) \
  $(CACHE_DIR)/.done \
  $(GLOBAL_DEPS) \
  $(NULL)

$(CACHE_DIR)/.done:
	$(MKDIR) -p $(CACHE_DIR)
	@$(TOUCH) $@

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

$(globalgen_headers_FILES): ParserResults.pkl

# Make sure .deps actually exists, since we'll try to write to it from
# BindingGen.py 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, BindingGen.py 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 $(generated_events_webidl_files) > .generated-events-webidl-files
	echo $? > .changed-dependency-list
	PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $(topsrcdir)/config/pythonpath.py \
	  $(PLY_INCLUDE) -I$(srcdir)/parser \
	  $(srcdir)/BindingGen.py \
	  $(srcdir)/Bindings.conf \
	  $(CURDIR) \
	  .all-webidl-file-list \
	  .generated-events-webidl-files \
	  .changed-dependency-list
	@$(TOUCH) $@

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

# 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.
export:: $(generated_header_files)

distclean::
	-$(RM) \
        $(generated_header_files) \
        $(generated_cpp_files) \
        $(all_webidl_files) \
        $(globalgen_targets) \
        ParserResults.pkl \
        $(NULL)