diff options
-rw-r--r-- | RepositoryExternal.mk | 20 | ||||
-rw-r--r-- | extras/CustomTarget_autocorr.mk | 2 | ||||
-rw-r--r-- | filter/Configuration_filter.mk | 4 | ||||
-rw-r--r-- | filter/CustomTarget_svg.mk | 2 | ||||
-rw-r--r-- | i18npool/CustomTarget_localedata.mk | 2 | ||||
-rw-r--r-- | officecfg/CustomTarget_registry.mk | 2 | ||||
-rw-r--r-- | readlicense_oo/CustomTarget_readme.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/ComponentTarget.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/Configuration.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/ExternalExecutable.mk | 167 | ||||
-rw-r--r-- | solenv/gbuild/Rdb.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/UnoApiTarget.mk | 2 | ||||
-rw-r--r-- | writerfilter/CustomTarget_source.mk | 2 |
13 files changed, 146 insertions, 65 deletions
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index 57884e8cb7eb..ba57b556411c 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -2459,7 +2459,7 @@ gb_ExternalExecutable__register_xmllint := else # ! SYSTEM_LIBXML_FOR_BUILD define gb_ExternalExecutable__register_xmllint -gb_ExternalExecutable__xmllint_TARGET := $(call gb_Executable_get_target_for_build,xmllint) +$(call gb_ExternalExecutable_set_internal,xmllint) endef @@ -2472,7 +2472,7 @@ gb_ExternalExecutable__register_xsltproc := else # ! SYSTEM_LIBXSLT_FOR_BUILD define gb_ExternalExecutable__register_xsltproc -gb_ExternalExecutable__xsltproc_TARGET := $(call gb_Executable_get_target_for_build,xsltproc) +$(call gb_ExternalExecutable_set_internal,xsltproc) endef @@ -2485,7 +2485,7 @@ gb_ExternalExecutable__register_ucpp := else # ! SYSTEM_UCPP define gb_ExternalExecutable__register_ucpp -gb_ExternalExecutable__ucpp_TARGET := $(call gb_Executable_get_target_for_build,ucpp) +$(call gb_ExternalExecutable_set_internal,ucpp) endef @@ -2495,7 +2495,7 @@ endif # SYSTEM_UCPP ifeq ($(SYSTEM_PYTHON),YES) define gb_ExternalExecutable__register_python -gb_ExternalExecutable__python_COMMAND := $(ICECREAM_RUN) $(PYTHON) +$(call gb_ExternalExecutable_set_external,python,$(PYTHON)) endef @@ -2505,7 +2505,7 @@ else ifeq ($(OS),MACOSX) #gbuild/platform/macosx.mk correctly for mac, e.g. PYTHONPATH and PYTHONHOME #dirs for in-tree internal python define gb_ExternalExecutable__register_python -gb_ExternalExecutable__python_COMMAND := $(ICECREAM_RUN) $(PYTHON) +$(call gb_ExternalExecutable_set_external,python,$(PYTHON)) endef @@ -2518,11 +2518,11 @@ else # ! SYSTEM_PYTHON # internal python define gb_ExternalExecutable__register_python -gb_ExternalExecutable__python_TARGET := $(call gb_Executable_get_target_for_build,python) -gb_ExternalExecutable__python_PRECOMMAND := $(gb_PYTHON_PRECOMMAND) -gb_ExternalExecutable__python_DEPS := \ - $(call gb_Executable_get_target_for_build,python) \ - $(call gb_Package_get_target,python3) +$(call gb_ExternalExecutable_set_internal,python) +$(call gb_ExternalExecutable_set_precommand,python,$(gb_PYTHON_PRECOMMAND)) +$(call gb_ExternalExecutable_add_dependencies,python,\ + $(call gb_Package_get_target,python3) \ +) endef diff --git a/extras/CustomTarget_autocorr.mk b/extras/CustomTarget_autocorr.mk index 0c6809bc7a66..5c6cbfa78fc9 100644 --- a/extras/CustomTarget_autocorr.mk +++ b/extras/CustomTarget_autocorr.mk @@ -282,7 +282,7 @@ $(call gb_CustomTarget_get_workdir,extras/source/autotext)/%/mimetype : $(SRCDIR cp $< $@ $(call gb_CustomTarget_get_workdir,extras/source/autotext)/%.xml : $(SRCDIR)/extras/source/autotext/lang/%.xml \ - | $(call gb_ExternalExecutable_get_deps,xsltproc) + | $(call gb_ExternalExecutable_get_dependencies,xsltproc) $(call gb_Output_announce,$*.xml,$(true),XSL,1) $(call gb_ExternalExecutable_get_command,xsltproc) -o $@ $(SRCDIR)/extras/util/compact.xsl $< diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk index d7fbe1e80537..df6681b847c1 100644 --- a/filter/Configuration_filter.mk +++ b/filter/Configuration_filter.mk @@ -22,7 +22,7 @@ # semi-integrated with the stuff from Configuration.mk; not exactly pretty... ifeq ($(SOLAR_JAVA),) -filter_MERGE_TARGET := $(call gb_ExternalExecutable_get_deps,python) \ +filter_MERGE_TARGET := $(call gb_ExternalExecutable_get_dependencies,python) \ $(SRCDIR)/filter/source/config/tools/merge/pyAltFCFGMerge filter_MERGE := $(call gb_ExternalExecutable_get_command,python) \ $(SRCDIR)/filter/source/config/tools/merge/pyAltFCFGMerge @@ -230,7 +230,7 @@ $(call gb_Configuration_get_clean_target,fcfg_langpack) : \ define filter_XcuResTarget__rule $$(call filter_XcuResTarget_get_target,$(1)) : \ $(filter_XSLT_langfilter) $(filter_XcuFilterUiTarget) \ - | $(call gb_ExternalExecutable_get_deps,xsltproc) + | $(call gb_ExternalExecutable_get_dependencies,xsltproc) $$(call gb_Output_announce,$(1),$(true),XCU,1) $$(call gb_Helper_abbreviate_dirs,\ mkdir -p $$(dir $$@) && \ diff --git a/filter/CustomTarget_svg.mk b/filter/CustomTarget_svg.mk index 461907e93907..67be7c02a173 100644 --- a/filter/CustomTarget_svg.mk +++ b/filter/CustomTarget_svg.mk @@ -59,7 +59,7 @@ $(filter_GEN_svg_Tokens_cxx) : $(filter_GEN_svg_Tokens_gperf) > $(filter_GEN_svg_Tokens_cxx)) $(filter_GEN_svg_Script_hxx) : \ - $(call gb_ExternalExecutable_get_deps,python) \ + $(call gb_ExternalExecutable_get_dependencies,python) \ $(filter_SRC_svg_PresentationEngine) $(filter_SRC_svg_Js2Hxx) \ | $(filter_SVGWORK)/.dir $(call gb_Output_announce,$@,build,PY ,1) diff --git a/i18npool/CustomTarget_localedata.mk b/i18npool/CustomTarget_localedata.mk index 342dfa3bc622..c56603ad65c7 100644 --- a/i18npool/CustomTarget_localedata.mk +++ b/i18npool/CustomTarget_localedata.mk @@ -56,7 +56,7 @@ $(i18npool_LDDIR)/localedata_%.cxx : \ $(i18npool_LDDIR)/saxparser.rdb : $(i18npool_LDDIR)/saxparser.input \ $(SOLARENV)/bin/packcomponents.xslt \ - | $(call gb_ExternalExecutable_get_deps,xsltproc) + | $(call gb_ExternalExecutable_get_dependencies,xsltproc) $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),RDB,1) $(call gb_Helper_abbreviate_dirs, \ $(call gb_ExternalExecutable_get_command,xsltproc) --nonet --stringparam prefix $(OUTDIR_FOR_BUILD)/xml/ \ diff --git a/officecfg/CustomTarget_registry.mk b/officecfg/CustomTarget_registry.mk index c947aa67129c..565fa8489151 100644 --- a/officecfg/CustomTarget_registry.mk +++ b/officecfg/CustomTarget_registry.mk @@ -47,7 +47,7 @@ officecfg_xsltparams=$(if $(filter-out $(lastword $1),$1),$(call officecfg_xsltp $(call gb_CustomTarget_get_workdir,officecfg/registry)/%.hxx: \ $(SRCDIR)/officecfg/registry/schema/org/openoffice/%.xcs \ $(SRCDIR)/officecfg/registry/cppheader.xsl\ - | $(call gb_ExternalExecutable_get_deps,xsltproc) + | $(call gb_ExternalExecutable_get_dependencies,xsltproc) $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),XSL,1) $(call gb_Helper_abbreviate_dirs, \ mkdir -p $(dir $@) && \ diff --git a/readlicense_oo/CustomTarget_readme.mk b/readlicense_oo/CustomTarget_readme.mk index 343823d5b2f1..f5af68216893 100644 --- a/readlicense_oo/CustomTarget_readme.mk +++ b/readlicense_oo/CustomTarget_readme.mk @@ -56,7 +56,7 @@ $(readlicense_oo_README_PATTERN) : \ $(SRCDIR)/readlicense_oo/docs/readme.xsl \ $(readlicense_oo_README_XRM) \ | $(readlicense_oo_DIR)/.dir \ - $(call gb_ExternalExecutable_get_deps,xsltproc) + $(call gb_ExternalExecutable_get_dependencies,xsltproc) $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),XSL,1) $(call gb_Helper_abbreviate_dirs, \ $(call gb_ExternalExecutable_get_command,xsltproc) --nonet --novalid -o $@.out \ diff --git a/solenv/gbuild/ComponentTarget.mk b/solenv/gbuild/ComponentTarget.mk index 1b77e0eb76ff..866b07d3038c 100644 --- a/solenv/gbuild/ComponentTarget.mk +++ b/solenv/gbuild/ComponentTarget.mk @@ -53,7 +53,7 @@ $(call gb_ComponentTarget_get_clean_target,%) : $(call gb_ComponentTarget_get_target,%) : \ $(call gb_ComponentTarget_get_source,%) \ - | $(call gb_ExternalExecutable_get_deps,xsltproc) + | $(call gb_ExternalExecutable_get_dependencies,xsltproc) $(call gb_ComponentTarget__command,$@,$<,$*) # the .dir is for make 3.81, which ignores trailing / diff --git a/solenv/gbuild/Configuration.mk b/solenv/gbuild/Configuration.mk index 59e8a9652af6..db65dc582e5b 100644 --- a/solenv/gbuild/Configuration.mk +++ b/solenv/gbuild/Configuration.mk @@ -58,7 +58,7 @@ gb_Configuration__get_source = $(SRCDIR)/$(2) gb_Configuration_PRIMARY_REGISTRY_NAME := registry gb_Configuration_XSLTCOMMAND = $(call gb_ExternalExecutable_get_command,xsltproc) -gb_Configuration_XSLTCOMMAND_DEPS = $(call gb_ExternalExecutable_get_deps,xsltproc) +gb_Configuration_XSLTCOMMAND_DEPS = $(call gb_ExternalExecutable_get_dependencies,xsltproc) # XcsTarget class diff --git a/solenv/gbuild/ExternalExecutable.mk b/solenv/gbuild/ExternalExecutable.mk index bbdc190bfa8e..c62b4c6d407a 100644 --- a/solenv/gbuild/ExternalExecutable.mk +++ b/solenv/gbuild/ExternalExecutable.mk @@ -12,38 +12,42 @@ # ExternalExecutable is a little helper for using executables that might # either come from system or be built internally. # -# The configuration for an external executable is done in -# RepositoryExternal.mk by defining function -# gb_ExternalExecutable__register_EXECUTABLE, which should set up to 4 -# variables. The variables are (presuming the executable is named foo): - -# * gb_ExternalExecutable__foo_COMMAND -# Defines the complete command for the executable. This must include -# shell variables, if required. Defaults to -# $(gb_ExternalExecutable__foo_PRECOMMAND) $(ICECREAM_RUN) $(gb_ExternalExecutable__foo_TARGET) -# (if gb_ExternalExecutable__foo_TARGET is not defined, plain "foo" is substituted). -# -# * gb_ExternalExecutable__foo_DEPS -# The complete dependencies needed for running the executable. Only -# useful for internally built executables to make sure all data, -# config. files etc. are present. Defaults to -# $(gb_ExternalExecutable__foo_TARGET). -# -# * gb_ExternalExecutable__foo_PRECOMMAND -# Any variables that need to be set for running the executable. -# Typical example is use of $(gb_Helper_set_ld_path) for internally -# built executables. -# -# * gb_ExternalExecutable__foo_TARGET -# A full path to the executable. Typical definition for internally built -# executable is $(call gb_Executable_get_target_for_build,foo). -# -# Because of the particular choice of the defaults, there is typically -# nothing that needs to be set for a system executable. +# === Setup === +# +# An ExternalExecutable command consists of 4 parts: +# * precommand: any command line variables that need to be set +# * internal: unspecified command(s), possibly including calls of gdb, +# valgrind or icerun +# * executable: the executable, with or without path +# * arguments: command line arguments that are specific for either +# external or internal call, or that are common for _all_ uses of the +# executable +# +# The configuration is done in RepositoryExternal.mk by defining function +# gb_ExternalExecutable__register_EXECUTABLE, which can call up to 4 +# functions: +# * gb_ExternalExecutable_set_external / gb_ExternalExecutable_set_internal +# * gb_ExternalExecutable_set_precommand +# * gb_ExternalExecutable_add_dependencies +# * gb_ExternalExecutable_add_arguments. +# If neither gb_ExternalExecutable_set_external nor +# gb_ExternalExecutable_set_internal is used, the executable defaults to +# the ExternalExecutable's name. Due to that, nothing needs to be set +# for an external executable in the typical case. # # All external executables must be registered (by listing the executable # name in gb_ExternalExecutable_register_executables call). This is done in # Repository.mk . +# +# === Usage === +# +# The call site(s) should always use both of the following functions: +# * gb_ExternalExecutable_get_command: the complete command for the +# executable +# * gb_ExternalExecutable_get_dependencies: all run-time dependencies +# needed by the command. + +## Infrastructure functions # The list of registered executables. gb_ExternalExecutable_REGISTERED_EXECUTABLES := @@ -78,7 +82,9 @@ endef # # gb_ExternalExecutable_collect_registrations define gb_ExternalExecutable_collect_registrations -$(foreach executable,$(gb_ExternalExecutable_REGISTERED_EXECUTABLES),$(call gb_ExternalExecutable__process_registration,$(executable))) +$(eval $(foreach executable,$(gb_ExternalExecutable_REGISTERED_EXECUTABLES),\ + $(call gb_ExternalExecutable__process_registration,$(executable))) +) endef @@ -89,13 +95,91 @@ $(if $(filter $(1),$(gb_ExternalExecutable_REGISTERED_EXECUTABLES)),,\ endef +## Setup functions + +# Set the executable as external +# +# Optionally set a specific executable call to use. +# Example: +# $(call gb_ExternalExecutable_set_external,python,$(PYTHON)) +# +# gb_ExternalExecutable_set_external executable call? +define gb_ExternalExecutable_set_external +$(if $(2),gb_ExternalExecutable_$(1)_EXECUTABLE := $(2)) + +endef + +define gb_ExternalExecutable__set_internal +gb_ExternalExecutable_$(1)_EXECUTABLE := $(2) +gb_ExternalExecutable_$(1)_DEPENDENCIES := $(2) +gb_ExternalExecutable_$(1)_PRECOMMAND := $(gb_Helper_set_ld_path) + +endef + +# Set the executable as internal +# +# Optionally set a specific executable target to use (if the target +# returned by gb_Executable_get_target_for_build is not suitable). +# +# gb_ExternalExecutable_set_internal executable call? +define gb_ExternalExecutable_set_internal +$(call gb_ExternalExecutable__set_internal,$(1),$(if $(strip $(2)),$(2),$(call gb_Executable_get_target_for_build,$(1)))) + +endef + +# Set pre-command for the executable +# +# This call should set any command line variables needed for the +# executable to run. +# +# gb_ExternalExecutable_set_precommand executable precommand +define gb_ExternalExecutable_set_precommand +gb_ExternalExecutable_$(1)_PRECOMMAND := $(2) + +endef + +# Add dependencies needed for running the executable +# +# Note that the dependencies should in most (if not all) cases be +# _for_build targets, or there might be problems in cross-compilation +# Specifically, not using _for_build target would mean either: +# * the target is built before the command even if it is not necessary +# (not really a problem, but might be a nuisance) +# * the build breaks because the target is not known. This might happen +# if there is a difference in configuration between build and host +# phases. +# +# gb_ExternalExecutable_add_dependencies executable dependencies +define gb_ExternalExecutable_add_dependencies +gb_ExternalExecutable_$(1)_DEPENDENCIES += $(2) + +endef + +# Add arguments needed for running the executable +# +# This should only contain arguments that differ between external and +# internal executable call or that are common for all call sites. +# +# gb_ExternalExecutable_add_arguments executable arguments +define gb_ExternalExecutable_add_arguments +gb_ExternalExecutable_$(1)_ARGUMENTS += $(2) + +endef + +## User functions + +gb_ExternalExecutable__get_internal := $(ICECREAM_RUN) + +define gb_ExternalExecutable__get_executable +$(if $(gb_ExternalExecutable_$(1)_EXECUTABLE),$(gb_ExternalExecutable_$(1)_EXECUTABLE),$(1)) +endef + define gb_ExternalExecutable__get_command $(call gb_ExternalExecutale__check_registration,$(1)) -$(if $(filter undefined,$(origin gb_ExternalExecutable__$(1)_COMMAND)) \ - ,$(gb_ExternalExecutable__$(1)_PRECOMMAND) $(ICECREAM_RUN) \ - $(if $(gb_ExternalExecutable__$(1)_TARGET),$(gb_ExternalExecutable__$(1)_TARGET),$(1)) \ - ,$(gb_ExternalExecutable__$(1)_COMMAND) \ -) +$(gb_ExternalExecutable_$(1)_PRECOMMAND) \ + $(call gb_ExternalExecutable__get_internal,$(1)) \ + $(call gb_ExternalExecutable__get_executable,$(1)) \ + $(gb_ExternalExecutable_$(1)_ARGUMENTS) endef # Return the command for running an external executable. @@ -109,19 +193,16 @@ define gb_ExternalExecutable_get_command $(strip $(call gb_ExternalExecutable__get_command,$(1))) endef -define gb_ExternalExecutable__get_deps +define gb_ExternalExecutable__get_dependencies $(call gb_ExternalExecutale__check_registration,$(1)) -$(if $(filter undefined,$(origin gb_ExternalExecutable__$(1)_DEPS)) \ - ,$(gb_ExternalExecutable__$(1)_TARGET) \ - ,$(gb_ExternalExecutable__$(1)_DEPS) \ -) +$(gb_ExternalExecutable_$(1)_DEPENDENCIES) endef -# Return the deps needed for running an external executable. +# Return the dependencies needed for running an external executable. # -# gb_ExternalExecutable_get_deps executable -define gb_ExternalExecutable_get_deps -$(strip $(call gb_ExternalExecutable__get_deps,$(1))) +# gb_ExternalExecutable_get_dependencies executable +define gb_ExternalExecutable_get_dependencies +$(strip $(call gb_ExternalExecutable__get_dependencies,$(1))) endef # vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/Rdb.mk b/solenv/gbuild/Rdb.mk index 1a6786545e49..e4df44cf03b1 100644 --- a/solenv/gbuild/Rdb.mk +++ b/solenv/gbuild/Rdb.mk @@ -37,7 +37,7 @@ $(call gb_Helper_abbreviate_dirs,\ rm $(1).input) endef -$(call gb_Rdb_get_target,%) :| $(call gb_ExternalExecutable_get_deps,xsltproc) +$(call gb_Rdb_get_target,%) :| $(call gb_ExternalExecutable_get_dependencies,xsltproc) $(call gb_Output_announce,$*,$(true),RDB,1) $(call gb_Rdb__command,$@,$*,$?,$^) diff --git a/solenv/gbuild/UnoApiTarget.mk b/solenv/gbuild/UnoApiTarget.mk index 12e592dce42e..4f2f88d529f6 100644 --- a/solenv/gbuild/UnoApiTarget.mk +++ b/solenv/gbuild/UnoApiTarget.mk @@ -72,7 +72,7 @@ endef # idlc as well so their dummy rule fires if that changes. $(call gb_UnoApiPartTarget_get_target,%.done) : \ $(gb_UnoApiPartTarget_IDLCTARGET) \ - | $(call gb_ExternalExecutable_get_deps,ucpp) + | $(call gb_ExternalExecutable_get_dependencies,ucpp) $(call gb_UnoApiPartTarget__command,$@,$*,$(filter-out $(gb_UnoApiPartTarget_IDLCTARGET),$(if $(filter $(gb_UnoApiPartTarget_IDLCTARGET),$?),$^,$?))) ifeq ($(gb_FULLDEPS),$(true)) diff --git a/writerfilter/CustomTarget_source.mk b/writerfilter/CustomTarget_source.mk index bc0c3bf98bf5..0ffd8d95d20f 100644 --- a/writerfilter/CustomTarget_source.mk +++ b/writerfilter/CustomTarget_source.mk @@ -204,6 +204,6 @@ $(writerfilter_WORK)/OOXMLFactory%.hxx : $(writerfilter_SRC)/ooxml/factory_ns.xs $(call gb_CustomTarget_get_target,writerfilter/source) : $(writerfilter_ALL) -$(writerfilter_ALL) :| $(call gb_ExternalExecutable_get_deps,xsltproc) $(writerfilter_WORK)/.dir +$(writerfilter_ALL) :| $(call gb_ExternalExecutable_get_dependencies,xsltproc) $(writerfilter_WORK)/.dir # vim: set noet sw=4 ts=4: |