This is in reference to email from Daniel Weber on the Jamming mailing list. The Jamfile tree here emulates his and prints SUBDIR_TOKENS for each directory. See the bottom of this file for a copy of the email. The problem as posed is essentially that the SUBDIR_TOKENS are not set correctly when you SubInclude a Jamfile whose SubDir is not a direct child of of the SubIncluding Jamfile, and whose TOP is not the same as the including Jamfile. The result of his fix is that the SUBDIR_TOKENS, etc are set as relative to the including Jamfile's root when jam is called from the including tree, and as relative to its own TOP when jam is called from within the sub tree in which the included Jamfile resides. I'm not sure if this is correct behavior - my initial response is that I would expect the SUBDIR_TOKENS, etc. to be relative to the TOP most recently set by a call to SubDir. This seems like the most straightforward and modular possibility - a given Jam project would have the same behavior regardless of whether it is being compiled on its own or as a sub-part of a larger project. Nevertheless, the behavior Mr. Weber describes is clearly wrong so I'm integrating his fix. ----------------------- Email follows --------------------------- [jamming] Bug in SubDir rule? Date: Wed, 4 Aug 2004 18:35:42 +0200 From: "Weber, Daniel" To: Hi, Iīve encountered a problem using SubDir. Given the following hierarchy: root | |-Jamfile | |--test | |-Jamfile | |--foo | |-Jamfile and the two "lower" Jamfiles looking like this: test/foo/Jamfile: SubDir TEST foo ; test/Jamfile: SubDir TEST SubInclude TEST foo ; If the root Jamfile now contains the following statements: SubDir ROOT ; SubInclude ROOT test ; everything is just fine, but if is looks like this: SubDir ROOT ; SubInclude ROOT test foo ; i.e. skipping the test directory and itīs implicit definition of TEST, jamīs subdir variables are set to wrong values, e.g. SUBDIR_TOKENS contains only "test" instead of being "test foo". The problem seems to be the following line in the SubDir rule: SUBDIR_DOWN = $($(_top)-DOWN) $(_tokens) ; where the _tokens have already been altered before in that special case. When replacing it with SUBDIR_DOWN = $($(_top)-DOWN) $(<[2-]) ; everything seems to be OK. I must admit weīve altered and extended the default Jambase, but this part of it is the same as in jam2.5rc2. Greetings Daniel