diff --git a/build/jam/HeadersRules b/build/jam/HeadersRules index ac51b40903..e7490235d6 100644 --- a/build/jam/HeadersRules +++ b/build/jam/HeadersRules @@ -397,44 +397,5 @@ 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/MiscRules b/build/jam/MiscRules index 7b3d53242e..e711ca8d4e 100644 --- a/build/jam/MiscRules +++ b/build/jam/MiscRules @@ -76,3 +76,54 @@ rule MakeLocateDebug } } +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) ; + } + } +} + +rule HaikuSubInclude tokens +{ + # HaikuSubInclude ; + # + # Current subdir relative SubInclude. + # - subdir tokens specifying the subdirectory to be include + # (relative to the current subdir) + + if $(tokens) { + SubInclude HAIKU_TOP $(SUBDIR_TOKENS) $(tokens) ; + } +} + +# The variable used to collect the deferred SubIncludes. +HAIKU_DEFERRED_SUB_INCLUDES = ; diff --git a/build/jam/OverriddenJamRules b/build/jam/OverriddenJamRules index e81a82800e..dd3ec73aff 100644 --- a/build/jam/OverriddenJamRules +++ b/build/jam/OverriddenJamRules @@ -657,7 +657,13 @@ rule SubInclude config = $(HAIKU_INHERITED_SUBDIR_CONFIG) ; } + # store SUBDIR_TOKENS + local oldSubDirTokens = $(SUBDIR_TOKENS) ; + on $(config) { include [ FDirName $($(1[1])) $(1[2-) $(JAMFILE) ] ; } + + # restore SUBDIR_TOKENS + SUBDIR_TOKENS = $(oldSubDirTokens) ; }