Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 4 | |
michael@0 | 5 | STANDALONE_MAKEFILE := 1 |
michael@0 | 6 | |
michael@0 | 7 | include $(topsrcdir)/config/rules.mk |
michael@0 | 8 | |
michael@0 | 9 | # Building XPIDLs effectively consists of two steps: |
michael@0 | 10 | # |
michael@0 | 11 | # 1) Staging all .idl files to a common directory. |
michael@0 | 12 | # 2) Doing everything with the .idl files. |
michael@0 | 13 | # |
michael@0 | 14 | # Each .idl file is processed into a .h file and typelib information. |
michael@0 | 15 | # The .h file shares the same stem as the input file and is installed |
michael@0 | 16 | # in the common headers include directory. |
michael@0 | 17 | # |
michael@0 | 18 | # XPIDL files are logically grouped together by modules. The typelib |
michael@0 | 19 | # information for all XPIDLs in the same module is linked together into |
michael@0 | 20 | # an .xpt file having the name of the module. |
michael@0 | 21 | # |
michael@0 | 22 | # As an optimization to reduce overall CPU usage, we process all .idl |
michael@0 | 23 | # belonging to a module with a single command invocation. This prevents |
michael@0 | 24 | # redundant parsing of .idl files and significantly reduces CPU cycles. |
michael@0 | 25 | # |
michael@0 | 26 | # Future improvement: Headers are currently written to a local directory then |
michael@0 | 27 | # installed in the distribution directory. It is preferable to write headers |
michael@0 | 28 | # directly into the distribution directory. However, PGO builds remove the dist |
michael@0 | 29 | # directory via rm -rf (with no regards to manifests). Since the cost of |
michael@0 | 30 | # processing XPIDL files is not trivial, it is preferrable to cache the headers |
michael@0 | 31 | # and reinstall them rather than regenerate them. Ideally the dist pruning is |
michael@0 | 32 | # performed with manifests. At that time we can write headers directly to the |
michael@0 | 33 | # dist directory. |
michael@0 | 34 | |
michael@0 | 35 | # For dependency files. |
michael@0 | 36 | idl_deps_dir := .deps |
michael@0 | 37 | |
michael@0 | 38 | # Where we put our final, linked .xpt files. |
michael@0 | 39 | idl_xpt_dir := xpt |
michael@0 | 40 | |
michael@0 | 41 | dist_idl_dir := $(DIST)/idl |
michael@0 | 42 | dist_include_dir := $(DIST)/include |
michael@0 | 43 | process_py := $(topsrcdir)/python/mozbuild/mozbuild/action/xpidl-process.py |
michael@0 | 44 | |
michael@0 | 45 | # TODO we should use py_action, but that would require extra directories to be |
michael@0 | 46 | # in the virtualenv. |
michael@0 | 47 | idlprocess := $(PYTHON_PATH) $(PLY_INCLUDE) -I$(IDL_PARSER_DIR) -I$(IDL_PARSER_CACHE_DIR) \ |
michael@0 | 48 | $(process_py) --cache-dir $(IDL_PARSER_CACHE_DIR) $(dist_idl_dir) \ |
michael@0 | 49 | $(dist_include_dir) $(idl_xpt_dir) $(idl_deps_dir) |
michael@0 | 50 | |
michael@0 | 51 | ifdef LIBXUL_SDK |
michael@0 | 52 | idlprocess += -I$(LIBXUL_SDK)/idl |
michael@0 | 53 | endif |
michael@0 | 54 | |
michael@0 | 55 | xpidl_modules := @xpidl_modules@ |
michael@0 | 56 | |
michael@0 | 57 | @xpidl_rules@ |
michael@0 | 58 | |
michael@0 | 59 | linked_xpt_files := $(addprefix $(idl_xpt_dir)/,$(addsuffix .xpt,$(xpidl_modules))) |
michael@0 | 60 | depends_files := $(foreach root,$(xpidl_modules),$(idl_deps_dir)/$(root).pp) |
michael@0 | 61 | |
michael@0 | 62 | GARBAGE += $(linked_xpt_files) $(depends_files) |
michael@0 | 63 | |
michael@0 | 64 | xpidl:: $(linked_xpt_files) |
michael@0 | 65 | |
michael@0 | 66 | $(linked_xpt_files): $(process_py) $(call mkdir_deps,$(idl_deps_dir) $(dist_include_dir) $(idl_xpt_dir)) |
michael@0 | 67 | |
michael@0 | 68 | $(call include_deps,$(depends_files)) |
michael@0 | 69 | |
michael@0 | 70 | .PHONY: xpidl |