Bug 784262 - Use generic install/copy rule in rules.mk. r=ted

This commit is contained in:
Mike Hommey 2012-08-29 08:55:57 +02:00
parent 35fc14432b
commit 2c1a2e9335
10 changed files with 160 additions and 307 deletions

View File

@ -20,7 +20,7 @@ VISIBILITY_FLAGS =
STDCXX_COMPAT =
ifneq (WINNT,$(HOST_OS_ARCH))
HOST_PROGRAM = nsinstall$(HOST_BIN_SUFFIX)
HOST_PROGRAM = nsinstall_real$(HOST_BIN_SUFFIX)
HOST_CSRCS = nsinstall.c pathsub.c
endif
@ -49,6 +49,14 @@ include $(topsrcdir)/config/config.mk
# Do not install util programs
NO_INSTALL=1
ifneq (WINNT,$(HOST_OS_ARCH))
export:: nsinstall$(HOST_BIN_SUFFIX)
# Ensure nsinstall is atomically created
nsinstall$(HOST_BIN_SUFFIX): $(HOST_PROGRAM)
cp $^ $@.tmp
mv $@.tmp $@
endif
include $(topsrcdir)/config/rules.mk
HOST_CFLAGS += -DUNICODE -D_UNICODE
@ -65,9 +73,6 @@ HEADERS = \
export:: $(TARGETS) $(HEADERS)
$(INSTALL) $(IFLAGS1) $(HEADERS) $(DIST)/include
-$(RM) $(FINAL_LINK_COMPS) $(FINAL_LINK_LIBS) $(FINAL_LINK_COMP_NAMES)
ifdef HOST_PROGRAM
$(INSTALL) $(HOST_PROGRAM) $(DIST)/bin
endif
# Generate a new buildid every time we "export" in config... that's only
# supposed to be once per-build!

View File

@ -27,7 +27,7 @@ $(PARALLEL_DIRS_export): %_export: %/Makefile
+@$(call SUBMAKE,export,$*)
endif
export:: $(SUBMAKEFILES) $(MAKE_DIRS) $(if $(XPIDLSRCS),$(IDL_DIR))
export:: $(SUBMAKEFILES) $(MAKE_DIRS)
$(LOOP_OVER_DIRS)
$(LOOP_OVER_TOOL_DIRS)

View File

@ -20,13 +20,11 @@ check-arglist = $(dir-ts)/arglist.ts
check-autotargets = $(dir-ts)/autotargets_mk.ts
check-export-targets = $(dir-ts)/export-targets-mk.ts
check-XinY = $(dir-ts)/check_XinY_mk.ts
check-xpidl = $(dir-ts)/xpidl-mk.ts
check-tests =\
$(check-arglist) \
$(check-autotargets) \
$(check-export-targets) \
$(check-XinY) \
$(check-xpidl) \
$(NULL)
@ -37,7 +35,6 @@ all::
clean:
$(RM) $(check-tests)
@$(MAKE) --no-print-directory -f $(srcdir)/check-xpidl.mk clean-xpidl topsrcdir=$(topsrcdir)
###########################################################################
## Logic processed at compile time so be selective about when to test
@ -124,23 +121,4 @@ $(check-export-targets): $(check-export-targets-preqs)
@$(TOUCH) $@
# </CHECK: export-targets.mk>
###########################################################################
##{ <CHECK: xpidl.mk>
check-xpidl-preqs=\
$(call mkdir_deps,$(dir-ts)) \
$(topsrcdir)/config/config.mk \
$(topsrcdir)/config/makefiles/makeutils.mk \
$(topsrcdir)/config/makefiles/xpidl.mk \
$(srcdir)/check-xpidl.mk \
$(NULL)
check-xpidl-args =\
"topsrcdir=$(topsrcdir)" \
"srcdir=$(srcdir)" \
$(NULL)
$(check-xpidl): $(check-xpidl-preqs)
$(MAKE) -f $(srcdir)/check-xpidl.mk check-xpidl $(check-xpidl-args)
@$(TOUCH) $@
#} </check-xpidl.mk>
endif #} findstring MAKECMDGOAL

View File

@ -1,43 +0,0 @@
# -*- makefile -*-
#
# 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 http://mozilla.org/MPL/2.0/.
ifdef VERBOSE
$(warning loading test)
endif
# Limit scope, we only need install_cmd= for testing
INCLUDED_AUTOCONF_MK = 1
include $(topsrcdir)/config/config.mk
USE_AUTOTARGETS_MK = 1
include $(topsrcdir)/config/makefiles/makeutils.mk
basedir = blah
DIST = $(basedir)/dist
DI = $(DIST)/include
IDL_DIR = $(basedir)/idl
INSTALL := cp
XPIDLSRCS = $(srcdir)/check-xpidl.mk
include $(topsrcdir)/config/makefiles/xpidl.mk
$(call requiredfunction,topsrcdir)
$(call requiredfunction,XPIDL_GEN_DIR)
HIDE=@
check-xpidl: xpidl-install-src xpidl-install-headers
$(HIDE)test -d $(DIST) || exit 90
$(HIDE)test -f $(DI)/check-xpidl.mk || exit 91
$(HIDE)test -f $(IDL_DIR)/check-xpidl.mk || exit 92
# Declare targets to avoid including rules.mk
$(DI) $(IDL_DIR):
mkdir -p $@
clean-xpidl:
$(RM) -r $(basedir)

View File

@ -1,60 +0,0 @@
# -*- makefile -*-
# vim:set ts=8 sw=8 sts=8 noet:
#
# 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 http://mozilla.org/MPL/2.0/.
#
# Always declared, general use by:
# js/xpconnect/tests/idl/Makefile.in:libs
# toolkit/crashreporter/test/Makefile.in
XPIDL_GEN_DIR ?= _xpidlgen
GARBAGE_DIRS += $(XPIDL_GEN_DIR)
###########################################################################
## Conditional logic
###########################################################################
ifndef INCLUDED_XPIDL_MK #{
INCLUDED_XPIDL_MK = 1
ifneq (,$(XPIDLSRCS)) #{
ifndef NO_DIST_INSTALL #{
_xpidl-todo_ += xpidl-install-src
_xpidl-todo_ += xpidl-install-headers
endif #}
endif #} XPIDLSRCS
export:: $(_xpidl-todo_)
$(call requiredfunction,mkdir_deps)
endif #} INCLUDED_XPIDL_MK
###########################################################################
## processing targets
###########################################################################
ifdef _xpidl-todo_ #{
$(call requiredfunction,install_cmd)
## Logic batch #1
xpidl-install-src-preqs=\
$(XPIDLSRCS) \
$(call mkdir_deps,$(IDL_DIR)) \
$(NULL)
xpidl-install-src: $(xpidl-install-src-preqs)
$(call install_cmd,$(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val))))
xpidl-install-headers-preqs =\
$(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) \
$(call mkdir_deps,$(DIST)/include) \
$(NULL)
xpidl-install-headers: $(xpidl-install-headers-preqs)
$(call install_cmd,$(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val))))
endif #} _xpidl-todo_

View File

@ -1159,15 +1159,19 @@ endif
ifndef NO_DIST_INSTALL
ifneq (,$(EXPORTS))
export:: $(EXPORTS)
$(call install_cmd,$(IFLAGS1) $^ $(DIST)/include)
EXPORTS_FILES := $(EXPORTS)
EXPORTS_DEST := $(DIST)/include
EXPORTS_TARGET := export
INSTALL_TARGETS += EXPORTS
endif
endif # NO_DIST_INSTALL
define EXPORT_NAMESPACE_RULE
ifndef NO_DIST_INSTALL
export:: $(EXPORTS_$(namespace))
$(call install_cmd,$(IFLAGS1) $$^ $(DIST)/include/$(namespace))
EXPORTS_$(namespace)_FILES := $$(EXPORTS_$(namespace))
EXPORTS_$(namespace)_DEST := $$(DIST)/include/$(namespace)
EXPORTS_$(namespace)_TARGET := export
INSTALL_TARGETS += EXPORTS_$(namespace)
endif # NO_DIST_INSTALL
endef
@ -1203,14 +1207,12 @@ endif
# Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
ifneq ($(AUTOCFG_JS_EXPORTS),)
$(FINAL_TARGET)/defaults/autoconfig::
$(NSINSTALL) -D $@
ifndef NO_DIST_INSTALL
export:: $(AUTOCFG_JS_EXPORTS) $(FINAL_TARGET)/defaults/autoconfig
$(call install_cmd,$(IFLAGS1) $^)
AUTOCFG_JS_EXPORTS_FILES := $(AUTOCFG_JS_EXPORTS)
AUTOCFG_JS_EXPORTS_DEST := $(FINAL_TARGET)/defaults/autoconfig
AUTOCFG_JS_EXPORTS_TARGET := export
INSTALL_TARGETS += AUTOCFG_JS_EXPORTS
endif
endif
################################################################################
@ -1271,9 +1273,11 @@ $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(
$(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS))
endif # XPIDL_MODULE.xpt != XPIDLSRCS
libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
ifndef NO_DIST_INSTALL
$(call install_cmd,$(IFLAGS1) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(FINAL_TARGET)/components)
XPIDL_MODULE_FILES := $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
XPIDL_MODULE_DEST := $(FINAL_TARGET)/components
INSTALL_TARGETS += XPIDL_MODULE
ifndef NO_INTERFACES_MANIFEST
libs:: $(call mkdir_deps,$(FINAL_TARGET)/components)
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPIDL_MODULE).xpt"
@ -1283,26 +1287,22 @@ endif
GARBAGE_DIRS += $(XPIDL_GEN_DIR)
ifndef NO_DIST_INSTALL
XPIDL_HEADERS_FILES := $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))
XPIDL_HEADERS_DEST := $(DIST)/include
XPIDL_HEADERS_TARGET := export
INSTALL_TARGETS += XPIDL_HEADERS
XPIDLSRCS_FILES := $(XPIDLSRCS)
XPIDLSRCS_DEST := $(IDL_DIR)
XPIDLSRCS_TARGET := export-idl
INSTALL_TARGETS += XPIDLSRCS
export:: export-idl
endif
endif #} XPIDLSRCS
ifndef INCLUDED_XPIDL_MK
include $(topsrcdir)/config/makefiles/xpidl.mk
endif
# General rules for exporting idl files.
$(IDL_DIR):
$(NSINSTALL) -D $@
export-idl:: $(SUBMAKEFILES) $(MAKE_DIRS)
ifneq ($(XPIDLSRCS),)
ifndef NO_DIST_INSTALL
export-idl:: $(XPIDLSRCS) $(IDL_DIR)
$(call install_cmd,$(IFLAGS1) $^)
endif
endif
$(LOOP_OVER_PARALLEL_DIRS)
$(LOOP_OVER_DIRS)
$(LOOP_OVER_TOOL_DIRS)
@ -1320,7 +1320,9 @@ endif
ifdef EXTRA_COMPONENTS
libs:: $(EXTRA_COMPONENTS)
ifndef NO_DIST_INSTALL
$(call install_cmd,$(IFLAGS1) $^ $(FINAL_TARGET)/components)
EXTRA_COMPONENTS_FILES := $(EXTRA_COMPONENTS)
EXTRA_COMPONENTS_DEST := $(FINAL_TARGET)/components
INSTALL_TARGETS += EXTRA_COMPONENTS
endif
endif
@ -1344,11 +1346,11 @@ endif
JS_MODULES_PATH ?= $(FINAL_TARGET)/modules
ifdef EXTRA_JS_MODULES
libs:: $(EXTRA_JS_MODULES)
ifndef NO_DIST_INSTALL
$(call install_cmd,$(IFLAGS1) $^ $(JS_MODULES_PATH))
EXTRA_JS_MODULES_FILES := $(EXTRA_JS_MODULES)
EXTRA_JS_MODULES_DEST := $(JS_MODULES_PATH)
INSTALL_TARGETS += EXTRA_JS_MODULES
endif
endif
ifdef EXTRA_PP_JS_MODULES
@ -1370,9 +1372,10 @@ testmodulesdir = $(DEPTH)/_tests/modules/$(TESTING_JS_MODULE_DIR)
GENERATED_DIRS += $(testmodulesdir)
libs:: $(TESTING_JS_MODULES)
ifndef NO_DIST_INSTALL
$(call install_cmd,$(IFLAGS) $^ $(testmodulesdir))
TESTING_JS_MODULES_FILES := $(TESTING_JS_MODULES)
TESTING_JS_MODULES_DEST := $(testmodulesdir)
INSTALL_TARGETS += TESTING_JS_MODULES
endif
endif
@ -1381,25 +1384,19 @@ endif
# SDK
ifneq (,$(SDK_LIBRARY))
$(SDK_LIB_DIR)::
$(NSINSTALL) -D $@
ifndef NO_DIST_INSTALL
libs:: $(SDK_LIBRARY) $(SDK_LIB_DIR)
$(call install_cmd,$(IFLAGS2) $^)
SDK_LIBRARY_FILES := $(SDK_LIBRARY)
SDK_LIBRARY_DEST := $(SDK_LIB_DIR)
INSTALL_TARGETS += SDK_LIBRARY
endif
endif # SDK_LIBRARY
ifneq (,$(strip $(SDK_BINARY)))
$(SDK_BIN_DIR)::
$(NSINSTALL) -D $@
ifndef NO_DIST_INSTALL
libs:: $(SDK_BINARY) $(SDK_BIN_DIR)
$(call install_cmd,$(IFLAGS2) $^)
SDK_BINARY_FILES := $(SDK_BINARY)
SDK_BINARY_DEST := $(SDK_BIN_DIR)
INSTALL_TARGETS += SDK_BINARY
endif
endif # SDK_BINARY
################################################################################
@ -1535,25 +1532,39 @@ endif
# Install/copy rules
#
# The INSTALL_TARGETS variable contains a list of all install target
# categories. Each category defines a list of files, an install destination,
# and whether the files are executables or not.
# categories. Each category defines a list of files and executables, and an
# install destination,
#
# FOO_FILES := foo bar
# FOO_EXECUTABLES := baz
# FOO_DEST := target_path
# INSTALL_TARGETS += FOO
#
# Additionally, a FOO_TARGET variable may be added to indicate the target for
# which the files and executables are installed. Default is "libs".
# If we're using binary nsinstall and it's not built yet, fallback to python nsinstall.
ifneq (,$(filter $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX),$(install_cmd)))
nsinstall_is_usable = $(if $(wildcard $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)),$(eval nsinstall_is_usable := yes)yes)
define install_cmd_override
$(1): install_cmd = $$(if $$(nsinstall_is_usable),$$(INSTALL),$$(NSINSTALL_PY)) $$(1)
endef
endif
define install_file_template
libs:: $(2)/$(notdir $(1))
$(or $(3),libs):: $(2)/$(notdir $(1))
$(call install_cmd_override,$(2)/$(notdir $(1)))
$(2)/$(notdir $(1)): $(1) $$(call mkdir_deps,$(2))
$(INSTALL) $(3) $$< $${@D}
$$(call install_cmd,$(4) $$< $${@D})
endef
$(foreach category,$(INSTALL_TARGETS),\
$(if $($(category)_DEST),,$(error Missing $(category)_DEST))\
$(foreach file,$($(category)_FILES),\
$(eval $(call install_file_template,$(file),$($(category)_DEST),$(IFLAGS1)))\
$(eval $(call install_file_template,$(file),$($(category)_DEST),$($(category)_TARGET),$(IFLAGS1)))\
)\
$(foreach file,$($(category)_EXECUTABLES),\
$(eval $(call install_file_template,$(file),$($(category)_DEST),$(IFLAGS2)))\
$(eval $(call install_file_template,$(file),$($(category)_DEST),$($(category)_TARGET),$(IFLAGS2)))\
)\
)
@ -1567,19 +1578,22 @@ $(foreach category,$(INSTALL_TARGETS),\
# FOO_PATH := target_path
# FOO_FLAGS := -Dsome_flag
# PP_TARGETS += FOO
#
# Additionally, a FOO_TARGET variable may be added to indicate the target for
# which the files and executables are installed. Default is "libs".
# preprocess_file_template defines preprocessing rules.
# $(call preprocess_file_template, source_file, target_path, extra_flags)
define preprocess_file_template
$(2)/$(notdir $(1)): $(1) $$(call mkdir_deps,$(2)) $$(GLOBAL_DEPS)
$$(RM) $$@
$$(PYTHON) $$(topsrcdir)/config/Preprocessor.py $(3) $$(DEFINES) $$(ACDEFINES) $$(XULPPFLAGS) $$< > $$@
libs:: $(2)/$(notdir $(1))
$$(PYTHON) $$(topsrcdir)/config/Preprocessor.py $(4) $$(DEFINES) $$(ACDEFINES) $$(XULPPFLAGS) $$< > $$@
$(or $(3),libs):: $(2)/$(notdir $(1))
endef
$(foreach category,$(PP_TARGETS),\
$(foreach file,$($(category)),\
$(eval $(call preprocess_file_template,$(file),$($(category)_PATH),$($(category)_FLAGS)))\
$(eval $(call preprocess_file_template,$(file),$($(category)_PATH),$($(category)_TARGET),$($(category)_FLAGS)))\
)\
)

View File

@ -15,7 +15,7 @@ include $(DEPTH)/config/autoconf.mk
VISIBILITY_FLAGS =
ifneq (WINNT,$(HOST_OS_ARCH))
HOST_PROGRAM = nsinstall$(HOST_BIN_SUFFIX)
HOST_PROGRAM = nsinstall_real$(HOST_BIN_SUFFIX)
HOST_CSRCS = nsinstall.c pathsub.c
endif
@ -41,14 +41,19 @@ ifneq (,$(JS_SHARED_LIBRARY)$(MOZ_NATIVE_ZLIB))
DEFINES += -DMOZ_NATIVE_ZLIB=1
endif
ifneq (WINNT,$(HOST_OS_ARCH))
export:: nsinstall$(HOST_BIN_SUFFIX)
# Ensure nsinstall is atomically created
nsinstall$(HOST_BIN_SUFFIX): $(HOST_PROGRAM)
cp $^ $@.tmp
mv $@.tmp $@
endif
include $(topsrcdir)/config/rules.mk
HOST_CFLAGS += -DUNICODE -D_UNICODE
export:: $(TARGETS)
ifdef HOST_PROGRAM
$(INSTALL) $(HOST_PROGRAM) $(DIST)/bin
endif
ifdef WRAP_SYSTEM_INCLUDES
export:: \

View File

@ -27,7 +27,7 @@ $(PARALLEL_DIRS_export): %_export: %/Makefile
+@$(call SUBMAKE,export,$*)
endif
export:: $(SUBMAKEFILES) $(MAKE_DIRS) $(if $(XPIDLSRCS),$(IDL_DIR))
export:: $(SUBMAKEFILES) $(MAKE_DIRS)
$(LOOP_OVER_DIRS)
$(LOOP_OVER_TOOL_DIRS)

View File

@ -1,60 +0,0 @@
# -*- makefile -*-
# vim:set ts=8 sw=8 sts=8 noet:
#
# 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 http://mozilla.org/MPL/2.0/.
#
# Always declared, general use by:
# js/xpconnect/tests/idl/Makefile.in:libs
# toolkit/crashreporter/test/Makefile.in
XPIDL_GEN_DIR ?= _xpidlgen
GARBAGE_DIRS += $(XPIDL_GEN_DIR)
###########################################################################
## Conditional logic
###########################################################################
ifndef INCLUDED_XPIDL_MK #{
INCLUDED_XPIDL_MK = 1
ifneq (,$(XPIDLSRCS)) #{
ifndef NO_DIST_INSTALL #{
_xpidl-todo_ += xpidl-install-src
_xpidl-todo_ += xpidl-install-headers
endif #}
endif #} XPIDLSRCS
export:: $(_xpidl-todo_)
$(call requiredfunction,mkdir_deps)
endif #} INCLUDED_XPIDL_MK
###########################################################################
## processing targets
###########################################################################
ifdef _xpidl-todo_ #{
$(call requiredfunction,install_cmd)
## Logic batch #1
xpidl-install-src-preqs=\
$(XPIDLSRCS) \
$(call mkdir_deps,$(IDL_DIR)) \
$(NULL)
xpidl-install-src: $(xpidl-install-src-preqs)
$(call install_cmd,$(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val))))
xpidl-install-headers-preqs =\
$(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) \
$(call mkdir_deps,$(DIST)/include) \
$(NULL)
xpidl-install-headers: $(xpidl-install-headers-preqs)
$(call install_cmd,$(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val))))
endif #} _xpidl-todo_

View File

@ -1159,15 +1159,19 @@ endif
ifndef NO_DIST_INSTALL
ifneq (,$(EXPORTS))
export:: $(EXPORTS)
$(call install_cmd,$(IFLAGS1) $^ $(DIST)/include)
EXPORTS_FILES := $(EXPORTS)
EXPORTS_DEST := $(DIST)/include
EXPORTS_TARGET := export
INSTALL_TARGETS += EXPORTS
endif
endif # NO_DIST_INSTALL
define EXPORT_NAMESPACE_RULE
ifndef NO_DIST_INSTALL
export:: $(EXPORTS_$(namespace))
$(call install_cmd,$(IFLAGS1) $$^ $(DIST)/include/$(namespace))
EXPORTS_$(namespace)_FILES := $$(EXPORTS_$(namespace))
EXPORTS_$(namespace)_DEST := $$(DIST)/include/$(namespace)
EXPORTS_$(namespace)_TARGET := export
INSTALL_TARGETS += EXPORTS_$(namespace)
endif # NO_DIST_INSTALL
endef
@ -1203,14 +1207,12 @@ endif
# Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
ifneq ($(AUTOCFG_JS_EXPORTS),)
$(FINAL_TARGET)/defaults/autoconfig::
$(NSINSTALL) -D $@
ifndef NO_DIST_INSTALL
export:: $(AUTOCFG_JS_EXPORTS) $(FINAL_TARGET)/defaults/autoconfig
$(call install_cmd,$(IFLAGS1) $^)
AUTOCFG_JS_EXPORTS_FILES := $(AUTOCFG_JS_EXPORTS)
AUTOCFG_JS_EXPORTS_DEST := $(FINAL_TARGET)/defaults/autoconfig
AUTOCFG_JS_EXPORTS_TARGET := export
INSTALL_TARGETS += AUTOCFG_JS_EXPORTS
endif
endif
################################################################################
@ -1271,9 +1273,11 @@ $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(
$(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS))
endif # XPIDL_MODULE.xpt != XPIDLSRCS
libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
ifndef NO_DIST_INSTALL
$(call install_cmd,$(IFLAGS1) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(FINAL_TARGET)/components)
XPIDL_MODULE_FILES := $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
XPIDL_MODULE_DEST := $(FINAL_TARGET)/components
INSTALL_TARGETS += XPIDL_MODULE
ifndef NO_INTERFACES_MANIFEST
libs:: $(call mkdir_deps,$(FINAL_TARGET)/components)
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPIDL_MODULE).xpt"
@ -1283,26 +1287,22 @@ endif
GARBAGE_DIRS += $(XPIDL_GEN_DIR)
ifndef NO_DIST_INSTALL
XPIDL_HEADERS_FILES := $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))
XPIDL_HEADERS_DEST := $(DIST)/include
XPIDL_HEADERS_TARGET := export
INSTALL_TARGETS += XPIDL_HEADERS
XPIDLSRCS_FILES := $(XPIDLSRCS)
XPIDLSRCS_DEST := $(IDL_DIR)
XPIDLSRCS_TARGET := export-idl
INSTALL_TARGETS += XPIDLSRCS
export:: export-idl
endif
endif #} XPIDLSRCS
ifndef INCLUDED_XPIDL_MK
include $(topsrcdir)/config/makefiles/xpidl.mk
endif
# General rules for exporting idl files.
$(IDL_DIR):
$(NSINSTALL) -D $@
export-idl:: $(SUBMAKEFILES) $(MAKE_DIRS)
ifneq ($(XPIDLSRCS),)
ifndef NO_DIST_INSTALL
export-idl:: $(XPIDLSRCS) $(IDL_DIR)
$(call install_cmd,$(IFLAGS1) $^)
endif
endif
$(LOOP_OVER_PARALLEL_DIRS)
$(LOOP_OVER_DIRS)
$(LOOP_OVER_TOOL_DIRS)
@ -1320,7 +1320,9 @@ endif
ifdef EXTRA_COMPONENTS
libs:: $(EXTRA_COMPONENTS)
ifndef NO_DIST_INSTALL
$(call install_cmd,$(IFLAGS1) $^ $(FINAL_TARGET)/components)
EXTRA_COMPONENTS_FILES := $(EXTRA_COMPONENTS)
EXTRA_COMPONENTS_DEST := $(FINAL_TARGET)/components
INSTALL_TARGETS += EXTRA_COMPONENTS
endif
endif
@ -1344,11 +1346,11 @@ endif
JS_MODULES_PATH ?= $(FINAL_TARGET)/modules
ifdef EXTRA_JS_MODULES
libs:: $(EXTRA_JS_MODULES)
ifndef NO_DIST_INSTALL
$(call install_cmd,$(IFLAGS1) $^ $(JS_MODULES_PATH))
EXTRA_JS_MODULES_FILES := $(EXTRA_JS_MODULES)
EXTRA_JS_MODULES_DEST := $(JS_MODULES_PATH)
INSTALL_TARGETS += EXTRA_JS_MODULES
endif
endif
ifdef EXTRA_PP_JS_MODULES
@ -1370,9 +1372,10 @@ testmodulesdir = $(DEPTH)/_tests/modules/$(TESTING_JS_MODULE_DIR)
GENERATED_DIRS += $(testmodulesdir)
libs:: $(TESTING_JS_MODULES)
ifndef NO_DIST_INSTALL
$(call install_cmd,$(IFLAGS) $^ $(testmodulesdir))
TESTING_JS_MODULES_FILES := $(TESTING_JS_MODULES)
TESTING_JS_MODULES_DEST := $(testmodulesdir)
INSTALL_TARGETS += TESTING_JS_MODULES
endif
endif
@ -1381,25 +1384,19 @@ endif
# SDK
ifneq (,$(SDK_LIBRARY))
$(SDK_LIB_DIR)::
$(NSINSTALL) -D $@
ifndef NO_DIST_INSTALL
libs:: $(SDK_LIBRARY) $(SDK_LIB_DIR)
$(call install_cmd,$(IFLAGS2) $^)
SDK_LIBRARY_FILES := $(SDK_LIBRARY)
SDK_LIBRARY_DEST := $(SDK_LIB_DIR)
INSTALL_TARGETS += SDK_LIBRARY
endif
endif # SDK_LIBRARY
ifneq (,$(strip $(SDK_BINARY)))
$(SDK_BIN_DIR)::
$(NSINSTALL) -D $@
ifndef NO_DIST_INSTALL
libs:: $(SDK_BINARY) $(SDK_BIN_DIR)
$(call install_cmd,$(IFLAGS2) $^)
SDK_BINARY_FILES := $(SDK_BINARY)
SDK_BINARY_DEST := $(SDK_BIN_DIR)
INSTALL_TARGETS += SDK_BINARY
endif
endif # SDK_BINARY
################################################################################
@ -1535,25 +1532,39 @@ endif
# Install/copy rules
#
# The INSTALL_TARGETS variable contains a list of all install target
# categories. Each category defines a list of files, an install destination,
# and whether the files are executables or not.
# categories. Each category defines a list of files and executables, and an
# install destination,
#
# FOO_FILES := foo bar
# FOO_EXECUTABLES := baz
# FOO_DEST := target_path
# INSTALL_TARGETS += FOO
#
# Additionally, a FOO_TARGET variable may be added to indicate the target for
# which the files and executables are installed. Default is "libs".
# If we're using binary nsinstall and it's not built yet, fallback to python nsinstall.
ifneq (,$(filter $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX),$(install_cmd)))
nsinstall_is_usable = $(if $(wildcard $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)),$(eval nsinstall_is_usable := yes)yes)
define install_cmd_override
$(1): install_cmd = $$(if $$(nsinstall_is_usable),$$(INSTALL),$$(NSINSTALL_PY)) $$(1)
endef
endif
define install_file_template
libs:: $(2)/$(notdir $(1))
$(or $(3),libs):: $(2)/$(notdir $(1))
$(call install_cmd_override,$(2)/$(notdir $(1)))
$(2)/$(notdir $(1)): $(1) $$(call mkdir_deps,$(2))
$(INSTALL) $(3) $$< $${@D}
$$(call install_cmd,$(4) $$< $${@D})
endef
$(foreach category,$(INSTALL_TARGETS),\
$(if $($(category)_DEST),,$(error Missing $(category)_DEST))\
$(foreach file,$($(category)_FILES),\
$(eval $(call install_file_template,$(file),$($(category)_DEST),$(IFLAGS1)))\
$(eval $(call install_file_template,$(file),$($(category)_DEST),$($(category)_TARGET),$(IFLAGS1)))\
)\
$(foreach file,$($(category)_EXECUTABLES),\
$(eval $(call install_file_template,$(file),$($(category)_DEST),$(IFLAGS2)))\
$(eval $(call install_file_template,$(file),$($(category)_DEST),$($(category)_TARGET),$(IFLAGS2)))\
)\
)
@ -1567,19 +1578,22 @@ $(foreach category,$(INSTALL_TARGETS),\
# FOO_PATH := target_path
# FOO_FLAGS := -Dsome_flag
# PP_TARGETS += FOO
#
# Additionally, a FOO_TARGET variable may be added to indicate the target for
# which the files and executables are installed. Default is "libs".
# preprocess_file_template defines preprocessing rules.
# $(call preprocess_file_template, source_file, target_path, extra_flags)
define preprocess_file_template
$(2)/$(notdir $(1)): $(1) $$(call mkdir_deps,$(2)) $$(GLOBAL_DEPS)
$$(RM) $$@
$$(PYTHON) $$(topsrcdir)/config/Preprocessor.py $(3) $$(DEFINES) $$(ACDEFINES) $$(XULPPFLAGS) $$< > $$@
libs:: $(2)/$(notdir $(1))
$$(PYTHON) $$(topsrcdir)/config/Preprocessor.py $(4) $$(DEFINES) $$(ACDEFINES) $$(XULPPFLAGS) $$< > $$@
$(or $(3),libs):: $(2)/$(notdir $(1))
endef
$(foreach category,$(PP_TARGETS),\
$(foreach file,$($(category)),\
$(eval $(call preprocess_file_template,$(file),$($(category)_PATH),$($(category)_FLAGS)))\
$(eval $(call preprocess_file_template,$(file),$($(category)_PATH),$($(category)_TARGET),$($(category)_FLAGS)))\
)\
)