From 48d60fa69c533fc094eac4adedf9e18cce3f4d3d Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 4 Mar 2007 05:09:59 +0000 Subject: [PATCH] Introduced new build system features: The variable HAIKU_DONT_INCLUDE_SRC to turn off the inclusion of src/Jamfile, and the rule DeferredSubInclude to include a subdirectory in UserBuildConfig. Together they allow a developer working on a subproject to reduce jam's parsing time when only building the subproject. Relevant mostly on BeOS; on Linux jam is pretty fast anyway. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20321 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- Jamfile | 13 ++++++++++- build/jam/HeadersRules | 39 ++++++++++++++++++++++++++++++++ build/jam/UserBuildConfig.sample | 16 +++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/Jamfile b/Jamfile index c475ff3c8b..8cc1f32a4c 100644 --- a/Jamfile +++ b/Jamfile @@ -132,4 +132,15 @@ Depends ScreenSaverKit : Haiku ; -SubInclude HAIKU_TOP src ; +# Optionally we allow not to include the "src" subdirectory. +if $(HAIKU_DONT_INCLUDE_SRC) { + # Don't include "src", but at least include the stuff needed for the + # build. + SubInclude HAIKU_TOP src build ; + SubInclude HAIKU_TOP src tools ; +} else { + SubInclude HAIKU_TOP src ; +} + +# Perform deferred SubIncludes. +ExecuteDeferredSubIncludes ; diff --git a/build/jam/HeadersRules b/build/jam/HeadersRules index e7490235d6..ac51b40903 100644 --- a/build/jam/HeadersRules +++ b/build/jam/HeadersRules @@ -397,5 +397,44 @@ rule FStandardHeaders return $(headers) ; } +rule DeferredSubInclude params +{ + # DeferredSubInclude ; + # + # Takes the same parameter as SubInclude. The the subdirectory referred to + # by will be included when ExecuteDeferredSubIncludes is + # invoked, i.e. at the end of the root Jamfile. + + HAIKU_DEFERRED_SUB_INCLUDES += "/" $(params) ; +} + +rule ExecuteDeferredSubIncludes +{ + # ExecuteDeferredSubIncludes ; + # + # Performs the deferred SubIncludes scheduled by DeferredSubInclude. + + local tokensList = $(HAIKU_DEFERRED_SUB_INCLUDES) ; + while $(tokensList) { + # chop off leading "/" + tokensList = $(tokensList[2-]) ; + + # get the tokens for the next include + local tokens ; + while $(tokensList) && $(tokensList[1]) != "/" { + tokens += $(tokensList[1]) ; + tokensList = $(tokensList[2-]) ; + } + + # perform the include + if $(tokens) { + SubInclude $(tokens) ; + } + } +} + +# The variable used to collect the deferred SubIncludes. +HAIKU_DEFERRED_SUB_INCLUDES = ; + # SUBDIRSYSHDRS shall be reset automatically for each subdir SUBDIRRESET += SYSHDRS ; diff --git a/build/jam/UserBuildConfig.sample b/build/jam/UserBuildConfig.sample index 9c99c2c5d8..9493d998d5 100644 --- a/build/jam/UserBuildConfig.sample +++ b/build/jam/UserBuildConfig.sample @@ -75,3 +75,19 @@ AddTargetVariableToScript test.inc : fs_shell_command : fsShellCommand ; # used, i.e. a variable "rc" referring to the rc command built for the host # platform is defined in the script. AddTargetVariableToScript test.inc : rc ; + + +# Optimizing Jamfile Parsing Times + +# Setting this variable will prevent the root Jamfile to include the Jamfile +# in the src directory. Instead only the directories required for building the +# build tools are included. Only useful in combination with DeferredSubInclude. +HAIKU_DONT_INCLUDE_SRC = 1 ; + +# Schedule the given subdirectory for inclusion at the end of the root +# Jamfile (directly using SubInclude here is not possible). Using this +# feature together with HAIKU_DONT_INCLUDE_SRC allows developers working +# only on a subproject to reduce Jamfile parsing times considerably. +DeferredSubInclude HAIKU_TOP src tests add-ons kernel file_systems + userlandfs ; +