1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 STANDALONE_MAKEFILE
:= 1
7 include $(topsrcdir
)/config
/rules.mk
9 # Building XPIDLs effectively consists of two steps:
11 # 1) Staging all .idl files to a common directory.
12 # 2) Doing everything with the .idl files.
14 # Each .idl file is processed into a .h file and typelib information.
15 # The .h file shares the same stem as the input file and is installed
16 # in the common headers include directory.
18 # XPIDL files are logically grouped together by modules. The typelib
19 # information for all XPIDLs in the same module is linked together into
20 # an .xpt file having the name of the module.
22 # As an optimization to reduce overall CPU usage, we process all .idl
23 # belonging to a module with a single command invocation. This prevents
24 # redundant parsing of .idl files and significantly reduces CPU cycles.
26 # For dependency files.
29 dist_idl_dir
:= $(DIST
)/idl
30 dist_include_dir
:= $(DIST
)/include
31 dist_xpcrs_dir
:= $(DIST
)/xpcrs
32 stub_file
:= xptdata.stub
33 process_py
:= $(topsrcdir
)/python
/mozbuild
/mozbuild
/action
/xpidl-process.py
34 target_file
:= $(topobjdir
)/xpcom
/reflect
/xptinfo
/xptdata.
cpp
35 xptdata_h
:= $(dist_include_dir
)/xptdata.h
36 generated_files
:= $(target_file
) $(xptdata_h
)
37 code_gen_py
:= $(topsrcdir
)/xpcom
/reflect
/xptinfo
/xptcodegen.py
38 code_gen_deps
:= $(topsrcdir
)/xpcom
/ds
/tools
/perfecthash.py
40 # TODO we should use py_action, but that would require extra directories to be
44 $(PYTHON3
) $(process_py
) --depsdir
$(idl_deps_dir
) \
45 --bindings-conf
$(topsrcdir
)/dom
/bindings
/Bindings.conf \
46 $(foreach dir,$(all_idl_dirs
),-I
$(dir)) \
47 $(dist_include_dir
) $(dist_xpcrs_dir
) $(@D
) \
48 $(basename $(notdir $@
)) $($(basename $(notdir $@
))_deps
)
49 # When some IDL is added or removed, if the actual IDL file was already, or
50 # still is, in the tree, simple dependencies can't detect that the XPT needs
52 # Add the current value of $($(xpidl_module)_deps) in the depend file, such that
53 # we can later check if the value has changed since last build, which will
54 # indicate whether IDLs were added or removed.
55 # Note that removing previously built files is not covered.
56 @echo
$(basename $(notdir $@
))_deps_built
= $($(basename $(notdir $@
))_deps
) >> $(idl_deps_dir
)/$(basename $(notdir $@
)).pp
58 xpidl_modules
:= @xpidl_modules@
59 xpt_files
:= $(addsuffix .xpt
,$(xpidl_modules
))
63 depends_files
:= $(foreach root
,$(xpidl_modules
),$(idl_deps_dir
)/$(root
).pp
)
65 ifdef COMPILE_ENVIRONMENT
66 xpidl
:: $(generated_files
)
69 # See bug 1420119 for why we need the semicolon.
70 $(target_file
) $(xptdata_h
) : $(stub_file
) ;
72 $(xpt_files
): $(process_py
) $(call mkdir_deps
,$(idl_deps_dir
) $(dist_include_dir
) $(dist_xpcrs_dir
))
74 $(stub_file
) : $(xpt_files
) $(code_gen_py
) $(code_gen_deps
)
76 $(PYTHON3
) $(code_gen_py
) $(generated_files
) $(xpt_files
)
79 -include $(depends_files
)
82 $(1): $(call mkdir_deps
,$(dir $(1)))
83 ifneq ($($(basename $(notdir $(1)))_deps
),$($(basename $(notdir $(1)))_deps_built
))
88 $(foreach xpt
,$(xpt_files
),$(eval
$(call xpt_deps
,$(xpt
))))