From adcfc869b56f7cccee5f49c096ee8060aa02feac Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 12 Jul 2013 10:35:53 -0400 Subject: [PATCH] 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 | 19 ++++++++++++++++++- dom/webidl/WebIDL.mk | 5 ++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/dom/bindings/Makefile.in b/dom/bindings/Makefile.in index 2bc20389323..3189997b8d0 100644 --- a/dom/bindings/Makefile.in +++ b/dom/bindings/Makefile.in @@ -22,7 +22,7 @@ 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 @@ -142,6 +142,23 @@ $(webidl_files): %: $(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 diff --git a/dom/webidl/WebIDL.mk b/dom/webidl/WebIDL.mk index 9b36fe8f8ac..dacd989bc11 100644 --- a/dom/webidl/WebIDL.mk +++ b/dom/webidl/WebIDL.mk @@ -8,6 +8,10 @@ generated_webidl_files = \ CSS2Properties.webidl \ $(NULL) +preprocessed_webidl_files = \ + Navigator.webidl \ + $(NULL) + webidl_files = \ AnalyserNode.webidl \ AnimationEvent.webidl \ @@ -191,7 +195,6 @@ webidl_files = \ MozTimeManager.webidl \ MutationEvent.webidl \ MutationObserver.webidl \ - Navigator.webidl \ NetDashboard.webidl \ Node.webidl \ NodeFilter.webidl \