From bdfdd054bd25714f9c52c974f22228bee4bfbe67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Kukan?= Date: Fri, 8 Mar 2013 14:14:46 +0100 Subject: [PATCH] more subtle dependencies for cross-compilation Now we build only what we really need for 'build' platform - there is new build-tools make target. The list of tools is in solenv/gbuild/extensions/pre_BuildTools.mk. Also similar is done to some extent for 'host' platform using gb_Module_add_targets_for_build which is ignored for 'host'. Change-Id: I6acd1762b16aca366aac1a0688500f27869cfca2 --- Makefile.in | 2 +- RepositoryExternal.mk | 1 + codemaker/Module_codemaker.mk | 3 +- comphelper/Module_comphelper.mk | 4 +- i18npool/CustomTarget_localedata.mk | 26 +++++++---- i18npool/Module_i18npool.mk | 4 +- icu/Module_icu.mk | 2 +- idl/Module_idl.mk | 6 +-- idlc/Module_idlc.mk | 14 ++++-- l10ntools/Module_l10ntools.mk | 5 +- registry/Module_registry.mk | 15 +++--- rsc/Module_rsc.mk | 4 +- solenv/Module_solenv.mk | 4 +- solenv/gbuild/Executable.mk | 2 +- solenv/gbuild/Module.mk | 7 +++ solenv/gbuild/TargetLocations.mk | 7 +-- .../gbuild/extensions/post_SpeedUpTargets.mk | 10 ++++ solenv/gbuild/extensions/pre_BuildTools.mk | 46 +++++++++++++++++++ soltools/Module_soltools.mk | 4 +- tools/Executable_bestreversemap.mk | 4 -- tools/Module_tools.mk | 10 ++-- unodevtools/Module_unodevtools.mk | 2 +- unoidl/Module_unoidl.mk | 4 +- 23 files changed, 124 insertions(+), 62 deletions(-) create mode 100644 solenv/gbuild/extensions/pre_BuildTools.mk diff --git a/Makefile.in b/Makefile.in index 29d6f0088d52..0ae475a0c42f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -222,7 +222,7 @@ build-nocheck: bootstrap fetch $(if $(filter $(INPATH),$(INPATH_FOR_BUILD)),,cro $(GNUMAKE) -j $(PARALLELISM) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild build cross-toolset: bootstrap fetch - $(GNUMAKE) gb_Side=build -j $(PARALLELISM) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild build + $(GNUMAKE) gb_Side=build -j $(PARALLELISM) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild build-tools # # Install diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index 68d46797c6ea..6a15af5c46c6 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -2721,6 +2721,7 @@ endef # FIXME: the library target should be for build too define gb_Executable__register_saxparser $(call gb_Executable_add_runtime_dependencies,saxparser,\ + $(call gb_ComponentTarget_get_outdir_target,sax/source/expatwrap/expwrap) \ $(call gb_Library_get_target,$(gb_CPPU_ENV)_uno) \ $(call gb_Package_get_target_for_build,cppuhelper_unorc) \ $(call gb_Rdb_get_outdir_target_for_build,ure/services) \ diff --git a/codemaker/Module_codemaker.mk b/codemaker/Module_codemaker.mk index c6e98b8471df..3bb1f0baeded 100644 --- a/codemaker/Module_codemaker.mk +++ b/codemaker/Module_codemaker.mk @@ -26,7 +26,8 @@ $(eval $(call gb_Module_Module,codemaker)) -ifneq (,$(filter DESKTOP,$(BUILD_TYPE))) +# if not cross-compiling or we need this for ODK +ifneq (,$(if $(CROSS_COMPILING),,T)$(filter ODK,$(BUILD_TYPE))) $(eval $(call gb_Module_add_targets,codemaker,\ Package_inc \ diff --git a/comphelper/Module_comphelper.mk b/comphelper/Module_comphelper.mk index 004c02b12be2..57f1e224a5f1 100644 --- a/comphelper/Module_comphelper.mk +++ b/comphelper/Module_comphelper.mk @@ -20,15 +20,13 @@ $(eval $(call gb_Module_Module,comphelper)) $(eval $(call gb_Module_add_targets,comphelper,\ - Package_inc \ Library_comphelper \ + Package_inc \ )) -ifneq ($(OOO_JUNIT_JAR),) $(eval $(call gb_Module_add_subsequentcheck_targets,comphelper,\ JunitTest_comphelper_complex \ )) -endif $(eval $(call gb_Module_add_check_targets,comphelper,\ CppunitTest_comphelper_test \ diff --git a/i18npool/CustomTarget_localedata.mk b/i18npool/CustomTarget_localedata.mk index 824cfde49801..82841261092f 100644 --- a/i18npool/CustomTarget_localedata.mk +++ b/i18npool/CustomTarget_localedata.mk @@ -30,23 +30,29 @@ $(eval $(call gb_CustomTarget_CustomTarget,i18npool/localedata)) i18npool_LDDIR := $(call gb_CustomTarget_get_workdir,i18npool/localedata) -$(call gb_CustomTarget_get_target,i18npool/localedata) : \ - $(patsubst %.xml,$(i18npool_LDDIR)/localedata_%.cxx, \ - $(notdir $(wildcard $(SRCDIR)/i18npool/source/localedata/data/*.xml))) +i18npool_LD_NAMES := $(basename $(notdir $(wildcard $(SRCDIR)/i18npool/source/localedata/data/*.xml))) -$(i18npool_LDDIR)/localedata_%.cxx : \ - $(SRCDIR)/i18npool/source/localedata/data/%.xml \ +$(call gb_CustomTarget_get_target,i18npool/localedata) : \ + $(foreach name,$(i18npool_LD_NAMES),$(i18npool_LDDIR)/localedata_$(name).cxx) + +define i18npool_LD_RULE +$(i18npool_LDDIR)/localedata_$(1).cxx : \ + $(SRCDIR)/i18npool/source/localedata/data/$(1).xml \ $(i18npool_LDDIR)/saxparser.rdb \ $(call gb_Executable_get_runtime_dependencies,saxparser) - $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),SAX,1) - $(call gb_Helper_abbreviate_dirs, \ - $(call gb_Helper_execute,saxparser) $* $< $@.tmp \ + $$(call gb_Output_announce,$$(subst $(WORKDIR)/,,$$@),$(true),SAX,1) + $$(call gb_Helper_abbreviate_dirs, \ + $(call gb_Helper_execute,saxparser) $(1) $$< $$@.tmp \ $(call gb_Helper_make_url,$(i18npool_LDDIR)/saxparser.rdb) \ -env:LO_LIB_DIR=$(call gb_Helper_make_url,$(gb_Helper_OUTDIR_FOR_BUILDLIBDIR) \ -env:URE_MORE_SERVICES=$(call gb_Helper_make_url,$(i18npool_LDDIR)/saxparser.rdb)) \ $(if $(findstring s,$(MAKEFLAGS)),> /dev/null 2>&1) && \ - sed 's/\(^.*get[^;]*$$\)/SAL_DLLPUBLIC_EXPORT \1/' $@.tmp > $@ && \ - rm $@.tmp) + sed 's/\(^.*get[^;]*$$$$\)/SAL_DLLPUBLIC_EXPORT \1/' $$@.tmp > $$@ && \ + rm $$@.tmp) + +endef + +$(foreach name,$(i18npool_LD_NAMES),$(eval $(call i18npool_LD_RULE,$(name)))) $(i18npool_LDDIR)/saxparser.rdb : $(i18npool_LDDIR)/saxparser.input \ $(SOLARENV)/bin/packcomponents.xslt \ diff --git a/i18npool/Module_i18npool.mk b/i18npool/Module_i18npool.mk index a8f211848bf5..9eb5c31f4c4b 100644 --- a/i18npool/Module_i18npool.mk +++ b/i18npool/Module_i18npool.mk @@ -49,15 +49,13 @@ $(eval $(call gb_Module_add_targets,i18npool,\ Package_inc \ )) -ifneq ($(CROSS_COMPILING),YES) -$(eval $(call gb_Module_add_targets,i18npool,\ +$(eval $(call gb_Module_add_targets_for_build,i18npool,\ Executable_gencoll_rule \ Executable_genconv_dict \ Executable_gendict \ Executable_genindex_data \ Executable_saxparser \ )) -endif $(eval $(call gb_Module_add_check_targets,i18npool,\ CppunitTest_i18npool_test_breakiterator \ diff --git a/icu/Module_icu.mk b/icu/Module_icu.mk index 46e02d3de9d5..672308c02707 100644 --- a/icu/Module_icu.mk +++ b/icu/Module_icu.mk @@ -10,7 +10,7 @@ $(eval $(call gb_Module_Module,icu)) ifeq ($(SYSTEM_ICU),NO) -$(eval $(call gb_Module_add_targets,icu,\ +$(eval $(call gb_Module_add_targets_for_build,icu,\ UnpackedTarball_icu \ ExternalPackage_icu \ ExternalProject_icu \ diff --git a/idl/Module_idl.mk b/idl/Module_idl.mk index 82b83b03ddfd..ea476b41c743 100644 --- a/idl/Module_idl.mk +++ b/idl/Module_idl.mk @@ -19,8 +19,8 @@ $(eval $(call gb_Module_Module,idl)) -ifneq (,$(filter DESKTOP,$(BUILD_TYPE))) -$(eval $(call gb_Module_add_targets,idl,Executable_svidl)) -endif +$(eval $(call gb_Module_add_targets_for_build,idl,\ + Executable_svidl \ +)) # vim: set noet sw=4 ts=4: diff --git a/idlc/Module_idlc.mk b/idlc/Module_idlc.mk index 4a79c0b5e4c4..a20d105cd829 100644 --- a/idlc/Module_idlc.mk +++ b/idlc/Module_idlc.mk @@ -9,9 +9,17 @@ $(eval $(call gb_Module_Module,idlc)) -ifneq (,$(filter DESKTOP,$(BUILD_TYPE))) -$(eval $(call gb_Module_add_targets,idlc,Executable_idlc)) -$(eval $(call gb_Module_add_check_targets,idlc,CustomTarget_parser_test)) +# if not cross-compiling or we need this for ODK +ifneq (,$(if $(CROSS_COMPILING),,T)$(filter ODK,$(BUILD_TYPE))) + +$(eval $(call gb_Module_add_targets,idlc,\ + Executable_idlc \ +)) + +$(eval $(call gb_Module_add_check_targets,idlc,\ + CustomTarget_parser_test \ +)) + endif # vim:set noet sw=4 ts=4: diff --git a/l10ntools/Module_l10ntools.mk b/l10ntools/Module_l10ntools.mk index fa47bf5397d2..69d3bddfa51b 100644 --- a/l10ntools/Module_l10ntools.mk +++ b/l10ntools/Module_l10ntools.mk @@ -26,7 +26,7 @@ $(eval $(call gb_Module_Module,l10ntools)) -$(eval $(call gb_Module_add_targets,l10ntools,\ +$(eval $(call gb_Module_add_targets_for_build,l10ntools,\ Executable_helpex \ Executable_idxdict \ Executable_ulfex \ @@ -39,6 +39,9 @@ $(eval $(call gb_Module_add_targets,l10ntools,\ Executable_treex \ Executable_stringex \ StaticLibrary_transex \ +)) + +$(eval $(call gb_Module_add_targets,l10ntools,\ Package_ulfconv \ )) diff --git a/registry/Module_registry.mk b/registry/Module_registry.mk index a488bd8b14e4..6aec72fb23b2 100644 --- a/registry/Module_registry.mk +++ b/registry/Module_registry.mk @@ -27,17 +27,18 @@ $(eval $(call gb_Module_Module,registry)) $(eval $(call gb_Module_add_targets,registry,\ - Library_reg \ - ZipPackage_registry_odk_headers \ + Library_reg \ + ZipPackage_registry_odk_headers \ )) -ifneq (,$(filter DESKTOP,$(BUILD_TYPE))) +# if not cross-compiling or we need this for ODK +ifneq (,$(if $(CROSS_COMPILING),,T)$(filter ODK,$(BUILD_TYPE))) $(eval $(call gb_Module_add_targets,registry,\ - StaticLibrary_registry_helper \ - Executable_regmerge \ - Executable_regview \ - Executable_regcompare \ + Executable_regcompare \ + Executable_regmerge \ + Executable_regview \ + StaticLibrary_registry_helper \ )) endif diff --git a/rsc/Module_rsc.mk b/rsc/Module_rsc.mk index 8464c9327754..51aa12b34778 100644 --- a/rsc/Module_rsc.mk +++ b/rsc/Module_rsc.mk @@ -32,8 +32,8 @@ $(eval $(call gb_Module_add_targets,rsc,\ Package_inc \ )) -$(if $(filter DESKTOP,$(BUILD_TYPE)),$(eval $(call gb_Module_add_targets,rsc,\ +$(eval $(call gb_Module_add_targets_for_build,rsc,\ Executable_rsc \ -))) +)) # vim: set noet sw=4 ts=4: diff --git a/solenv/Module_solenv.mk b/solenv/Module_solenv.mk index e606c10d1a6e..3edb91b24b56 100644 --- a/solenv/Module_solenv.mk +++ b/solenv/Module_solenv.mk @@ -27,11 +27,9 @@ $(eval $(call gb_Module_Module,solenv)) -ifeq ($(CROSS_COMPILING),$(false)) -$(eval $(call gb_Module_add_targets,solenv,\ +$(eval $(call gb_Module_add_targets_for_build,solenv,\ Executable_concat-deps \ )) -endif ifneq ($(OS),WNT) ifneq ($(OS),IOS) diff --git a/solenv/gbuild/Executable.mk b/solenv/gbuild/Executable.mk index 1560e700ca54..a74e2025544a 100644 --- a/solenv/gbuild/Executable.mk +++ b/solenv/gbuild/Executable.mk @@ -37,7 +37,7 @@ $(dir $(call gb_Executable_get_runtime_target,%)).dir : $(dir $(call gb_Executable_get_runtime_target,%))%/.dir : $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) -$(call gb_Executable_get_runtime_target,%) : $(call gb_Executable_get_target,%) +$(call gb_Executable_get_runtime_target,%) : $(call gb_Executable_get_target_for_build,%) touch $@ .PHONY : $(call gb_Executable_get_clean_target,%) diff --git a/solenv/gbuild/Module.mk b/solenv/gbuild/Module.mk index 2ef383ac147a..68c171fa35c0 100644 --- a/solenv/gbuild/Module.mk +++ b/solenv/gbuild/Module.mk @@ -94,6 +94,11 @@ $(call gb_Module_get_target,%) : all : build $(if $(CROSS_COMPILING),,unitcheck $(if $(gb_PARTIAL_BUILD),,slowcheck)) +build-tools : $(gb_BUILD_TOOLS) + $(call gb_Output_announce,loaded tools: $(gb_BUILD_TOOLS),$(true),ALL,6) + $(call gb_Output_announce_title,build-tools done.) + $(call gb_Output_announce_bell) + build : $(call gb_Output_announce,top level modules: $(foreach module,$(filter-out deliverlog $(WORKDIR)/bootstrap,$^),$(notdir $(module))),$(true),ALL,6) $(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),ALL,6) @@ -241,6 +246,8 @@ $(foreach target,$(2),$(call gb_Module_add_target,$(1),$(target))) endef +gb_Module_add_targets_for_build = $(call gb_Module_add_targets,$(1),$(2)) + define gb_Module_add_check_targets $(foreach target,$(2),$(call gb_Module_add_check_target,$(1),$(target))) diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index e5d04f52c6fa..eb31b58a6ca1 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -111,7 +111,7 @@ gb_CxxObject_get_target = $(WORKDIR)/CxxObject/$(1).o gb_GenCxxObject_get_target = $(WORKDIR)/GenCxxObject/$(1).o gb_Executable_get_external_headers_target = $(WORKDIR)/ExternalHeaders/Executable/$(1) gb_Executable_get_headers_target = $(WORKDIR)/Headers/Executable/$(1) -gb_Executable_get_runtime_target = $(WORKDIR)/Executable/$(1).run +gb_Executable_get_runtime_target = $(WORKDIR_FOR_BUILD)/Executable/$(1).run gb_ExtensionTarget_get_target = $(WORKDIR)/ExtensionTarget/$(1).oxt gb_ExtensionTarget_get_rootdir = $(WORKDIR)/ExtensionTarget/$(1)/root gb_ExtensionTarget_get_workdir = $(WORKDIR)/ExtensionTarget/$(1) @@ -376,14 +376,9 @@ endef # ExternalExecutable. # # gb_Executable_get_runtime_dependencies executable -ifeq ($(CROSS_COMPILING),YES) -define gb_Executable_get_runtime_dependencies -endef -else define gb_Executable_get_runtime_dependencies $(call gb_Executable_get_runtime_target,$(1)) endef -endif # Get complete command-line for running the executable # diff --git a/solenv/gbuild/extensions/post_SpeedUpTargets.mk b/solenv/gbuild/extensions/post_SpeedUpTargets.mk index 406a69eab374..3db7218fdbd3 100644 --- a/solenv/gbuild/extensions/post_SpeedUpTargets.mk +++ b/solenv/gbuild/extensions/post_SpeedUpTargets.mk @@ -25,6 +25,16 @@ # in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable # instead of those above. +ifeq ($(CROSS_COMPILING),YES) +gb_Module_add_targets_for_build := +endif + +ifeq ($(gb_Side),build) +gb_Module_add_check_target := +gb_Module_add_slowcheck_target := +gb_Module_add_subsequentcheck_target := +endif + ifneq ($(strip $(MAKECMDGOALS)),) # speed up depending on the target gb_SpeedUpTargets_LEVEL_3 := debugrun help translations diff --git a/solenv/gbuild/extensions/pre_BuildTools.mk b/solenv/gbuild/extensions/pre_BuildTools.mk new file mode 100644 index 000000000000..bd80ca7a47d1 --- /dev/null +++ b/solenv/gbuild/extensions/pre_BuildTools.mk @@ -0,0 +1,46 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# 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/. +# + +# Tools we need to build for cross-compiling +gb_BUILD_TOOLS = \ + $(foreach executable, \ + autodoc \ + bestreversemap \ + cfgex \ + cpp \ + cppumaker \ + gencoll_rule \ + genconv_dict \ + gendict \ + genindex_data \ + helpex \ + idlc \ + idxdict \ + javamaker \ + makedepend \ + propex \ + regcompare \ + regmerge \ + regview \ + rsc \ + saxparser \ + stringex \ + svidl \ + transex3 \ + treex \ + uiex \ + ulfex \ + xrmex \ + ,$(call gb_Executable_get_runtime_dependencies,$(executable))) \ + $(foreach executable, \ + xsltproc \ + ,$(call gb_ExternalExecutable_get_dependencies,$(executable))) \ + Package_xmlhelp_xsl \ + +# vim: set noet sw=4 ts=4: diff --git a/soltools/Module_soltools.mk b/soltools/Module_soltools.mk index 9f304155b2da..77396fdce844 100644 --- a/soltools/Module_soltools.mk +++ b/soltools/Module_soltools.mk @@ -9,12 +9,10 @@ $(eval $(call gb_Module_Module,soltools)) -ifneq ($(CROSS_COMPILING),YES) -$(eval $(call gb_Module_add_targets,soltools,\ +$(eval $(call gb_Module_add_targets_for_build,soltools,\ Executable_cpp \ Executable_makedepend \ )) -endif # CROSS_COMPILING ifeq ($(OS)$(COM),WNTMSC) $(eval $(call gb_Module_add_targets,soltools,\ diff --git a/tools/Executable_bestreversemap.mk b/tools/Executable_bestreversemap.mk index 33a51dd6d74d..fbf1d13d82e2 100644 --- a/tools/Executable_bestreversemap.mk +++ b/tools/Executable_bestreversemap.mk @@ -22,10 +22,6 @@ $(eval $(call gb_Executable_Executable,bestreversemap)) -$(eval $(call gb_Executable_set_include,bestreversemap,\ - $$(INCLUDE) \ -)) - $(eval $(call gb_Executable_use_libraries,bestreversemap,\ sal \ $(gb_UWINAPI) \ diff --git a/tools/Module_tools.mk b/tools/Module_tools.mk index f49c48922fcb..cef5f7f5c37b 100644 --- a/tools/Module_tools.mk +++ b/tools/Module_tools.mk @@ -27,14 +27,12 @@ $(eval $(call gb_Module_add_targets,tools,\ StaticLibrary_ooopathutils \ )) +$(eval $(call gb_Module_add_targets_for_build,tools,\ + Executable_bestreversemap \ +)) + $(eval $(call gb_Module_add_check_targets,tools,\ CppunitTest_tools_test \ )) -ifneq ($(CROSS_COMPILING),YES) -$(eval $(call gb_Module_add_targets,tools,\ - Executable_bestreversemap \ -)) -endif - # vim: set noet sw=4 ts=4: diff --git a/unodevtools/Module_unodevtools.mk b/unodevtools/Module_unodevtools.mk index 16b409a077b1..fa17d84d124c 100644 --- a/unodevtools/Module_unodevtools.mk +++ b/unodevtools/Module_unodevtools.mk @@ -26,7 +26,7 @@ $(eval $(call gb_Module_Module,unodevtools)) -ifneq (,$(filter DESKTOP,$(BUILD_TYPE))) +ifneq (,$(filter ODK,$(BUILD_TYPE))) $(eval $(call gb_Module_add_targets,unodevtools,\ Executable_skeletonmaker \ diff --git a/unoidl/Module_unoidl.mk b/unoidl/Module_unoidl.mk index eab6f12dbde6..5bc2d1624909 100644 --- a/unoidl/Module_unoidl.mk +++ b/unoidl/Module_unoidl.mk @@ -14,10 +14,8 @@ $(eval $(call gb_Module_add_targets,unoidl, \ Package_inc \ )) -ifneq ($(CROSS_COMPILING),YES) -$(eval $(call gb_Module_add_targets,unoidl, \ +$(eval $(call gb_Module_add_targets_for_build,unoidl, \ Executable_reg2unoidl \ )) -endif # vim: set noet sw=4 ts=4: