Bug 838146 part 3. Set up preprocessing of Navigator.webidl, since we want to make some stuff on Navigator build-time-conditional. r=khuey
☠☠ backed out by 33fb417caccf ☠ ☠
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 12 Jul 2013 10:35:53 -0400
changeset 138355 d3b135e58350b949872337e647b85bbc3290f88f
parent 138354 1bc7f216750320b2cfa936e9de6166f6dcc62d10
child 138356 e0c3d84965cfb596113d4ce5df46eb78debd19e6
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerskhuey
bugs838146
milestone25.0a1
Bug 838146 part 3. Set up preprocessing of Navigator.webidl, since we want to make some stuff on Navigator build-time-conditional. r=khuey
dom/bindings/Makefile.in
dom/webidl/WebIDL.mk
--- a/dom/bindings/Makefile.in
+++ b/dom/bindings/Makefile.in
@@ -17,17 +17,17 @@ include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 
 # Need this to find all our DOM source files.
 include $(topsrcdir)/dom/dom-config.mk
 
 include $(topsrcdir)/dom/webidl/WebIDL.mk
 
 binding_include_path := mozilla/dom
-all_webidl_files = $(webidl_files) $(generated_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))
 # 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))
@@ -137,16 +137,33 @@ CSS2Properties.webidl: $(topsrcdir)/layo
 	  $(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) $@
+	PYTHONDONTWRITEBYTECODE=1 $(PYTHON) \
+          $(topsrcdir)/config/Preprocessor.py $(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
 $(binding_dependency_trackers):
 	# Just bring it 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
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -3,16 +3,20 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 webidl_base = $(topsrcdir)/dom/webidl
 
 generated_webidl_files = \
   CSS2Properties.webidl \
   $(NULL)
 
+preprocessed_webidl_files = \
+  Navigator.webidl \
+  $(NULL)
+
 webidl_files = \
   AnalyserNode.webidl \
   AnimationEvent.webidl \
   ArchiveReader.webidl \
   ArchiveRequest.webidl \
   Attr.webidl \
   AudioBuffer.webidl \
   AudioBufferSourceNode.webidl \
@@ -186,17 +190,16 @@ webidl_files = \
   MouseEvent.webidl \
   MouseScrollEvent.webidl \
   MozActivity.webidl \
   MozMmsMessage.webidl \
   MozNamedAttrMap.webidl \
   MozTimeManager.webidl \
   MutationEvent.webidl \
   MutationObserver.webidl \
-  Navigator.webidl \
   NetDashboard.webidl \
   Node.webidl \
   NodeFilter.webidl \
   NodeIterator.webidl \
   NodeList.webidl \
   Notification.webidl \
   NotifyAudioAvailableEvent.webidl \
   NotifyPaintEvent.webidl \