author Brian O'Keefe <>
Fri, 13 Feb 2015 08:11:57 -0500
changeset 243994 27005ff563d0522b4e82ace30481b72daa4e5fbb
parent 241495 5f39146b24ae890740b7c1bb3ccce190672bbf34
child 256617 34a546e5ebe2da6c5b51f393d0fd722ac8add5dd
permissions -rw-r--r--
Bug 924187 - Deal with interfaces.manifest from the backend. r=mshal

# 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


include $(topsrcdir)/config/

# Building XPIDLs effectively consists of two steps:
#   1) Staging all .idl files to a common directory.
#   2) Doing everything with the .idl files.
# Each .idl file is processed into a .h file and typelib information.
# The .h file shares the same stem as the input file and is installed
# in the common headers include directory.
# XPIDL files are logically grouped together by modules. The typelib
# information for all XPIDLs in the same module is linked together into
# an .xpt file having the name of the module.
# As an optimization to reduce overall CPU usage, we process all .idl
# belonging to a module with a single command invocation. This prevents
# redundant parsing of .idl files and significantly reduces CPU cycles.

# For dependency files.
idl_deps_dir := .deps

dist_idl_dir := $(DIST)/idl
dist_include_dir := $(DIST)/include
process_py := $(topsrcdir)/python/mozbuild/mozbuild/action/

libxul_sdk_includes := -I$(LIBXUL_SDK)/idl

# TODO we should use py_action, but that would require extra directories to be
# in the virtualenv.
	@echo "$(@F)"
		$(process_py) --cache-dir $(IDL_PARSER_CACHE_DIR) $(dist_idl_dir) \
		$(dist_include_dir) $(@D) $(idl_deps_dir) $(libxul_sdk_includes) \
		$(basename $(notdir $@)) $($(basename $(notdir $@))_deps)

# Chrome manifests may be written from several Makefiles at various times during
# the build. The 'buildlist' action adds to the file if it already exists, but
# if it does exist, make considers it to be up-to-date (as we have no inputs to
# depend on). We use FORCE to ensure that we always add the interface manifest,
# whether or not the chrome manifest already exists.
%/chrome.manifest: FORCE
	$(call py_action,buildlist,$@ 'manifest components/interfaces.manifest')

chrome_manifests := @chrome_manifests@

xpidl_modules := @xpidl_modules@
xpt_files := @xpt_files@


depends_files := $(foreach root,$(xpidl_modules),$(idl_deps_dir)/$(root).pp)

GARBAGE += $(xpt_files) $(depends_files)

xpidl:: $(xpt_files) $(chrome_manifests)

$(xpt_files): $(process_py) $(call mkdir_deps,$(idl_deps_dir) $(dist_include_dir))

define xpt_deps
$(1): $(call mkdir_deps,$(dir $(1)))
$(1): $(addsuffix .idl,$(addprefix $(dist_idl_dir)/,$($(basename $(notdir $(1)))_deps)))

$(foreach xpt,$(xpt_files),$(eval $(call xpt_deps,$(xpt))))

$(call include_deps,$(depends_files))

.PHONY: xpidl