|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import modules ; |
|
import assert ; |
|
import doc : do-scan set-option set-output set-output-file print-help-usage print-help-top ; |
|
import sequence ; |
|
import set ; |
|
import project ; |
|
import print ; |
|
import os ; |
|
import version ; |
|
import path ; |
|
|
|
|
|
|
|
.not-modules = |
|
boost-build bootstrap site-config test user-config |
|
-tools allyourbase boost-base features python stlport testing unit-tests ; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rule process ( |
|
command |
|
: values * |
|
) |
|
{ |
|
assert.result --help : MATCH ^(--help).* : $(command) ; |
|
local did-help = ; |
|
switch $(command) |
|
{ |
|
case --help-internal : |
|
local path-to-modules = [ modules.peek : BOOST_BUILD_PATH ] ; |
|
path-to-modules ?= . ; |
|
local possible-modules = [ GLOB $(path-to-modules) : *\\.jam ] ; |
|
local not-modules = [ GLOB $(path-to-modules) : *$(.not-modules)\\.jam ] ; |
|
local modules-to-list = |
|
[ sequence.insertion-sort |
|
[ set.difference $(possible-modules:D=:S=) : $(not-modules:D=:S=) ] ] ; |
|
local modules-to-scan ; |
|
for local m in $(modules-to-list) |
|
{ |
|
local module-files = [ GLOB $(path-to-modules) : $(m)\\.jam ] ; |
|
modules-to-scan += $(module-files[1]) ; |
|
} |
|
do-scan $(modules-to-scan) : print-help-all ; |
|
did-help = true ; |
|
|
|
case --help-enable-* : |
|
local option = [ MATCH --help-enable-(.*) : $(command) ] ; option = $(option:L) ; |
|
set-option $(option) : enabled ; |
|
did-help = true ; |
|
|
|
case --help-disable-* : |
|
local option = [ MATCH --help-disable-(.*) : $(command) ] ; option = $(option:L) ; |
|
set-option $(option) ; |
|
did-help = true ; |
|
|
|
case --help-output : |
|
set-output $(values[1]) ; |
|
did-help = true ; |
|
|
|
case --help-output-file : |
|
set-output-file $(values[1]) ; |
|
did-help = true ; |
|
|
|
case --help-doc-options : |
|
local doc-module-spec = [ split-symbol doc ] ; |
|
do-scan $(doc-module-spec[1]) : print-help-options ; |
|
did-help = true ; |
|
|
|
case --help-options : |
|
print-help-usage ; |
|
did-help = true ; |
|
|
|
case --help : |
|
local spec = $(values[1]) ; |
|
if $(spec) |
|
{ |
|
local spec-parts = [ split-symbol $(spec) ] ; |
|
if $(spec-parts) |
|
{ |
|
if $(spec-parts[2]) |
|
{ |
|
do-scan $(spec-parts[1]) : print-help-classes $(spec-parts[2]) ; |
|
do-scan $(spec-parts[1]) : print-help-rules $(spec-parts[2]) ; |
|
do-scan $(spec-parts[1]) : print-help-variables $(spec-parts[2]) ; |
|
} |
|
else |
|
{ |
|
do-scan $(spec-parts[1]) : print-help-module ; |
|
} |
|
} |
|
else |
|
{ |
|
EXIT "Unrecognized help option '"$(command)" "$(spec)"'." ; |
|
} |
|
} |
|
else |
|
{ |
|
version.print ; |
|
ECHO ; |
|
|
|
|
|
local names = [ modules.peek project : JAMROOT ] |
|
[ modules.peek project : JAMFILE ] ; |
|
local project-file = [ path.glob . : $(names) ] ; |
|
if ! $(project-file) |
|
{ |
|
project-file = [ path.glob-in-parents . : $(names) ] ; |
|
} |
|
|
|
for local p in $(project-file) |
|
{ |
|
do-scan $(p) : print-help-project $(p) ; |
|
} |
|
|
|
|
|
local user-path = [ os.home-directories ] [ os.environ BOOST_BUILD_PATH ] ; |
|
local user-config = [ GLOB $(user-path) : user-config.jam ] ; |
|
if $(user-config) |
|
{ |
|
do-scan $(user-config[1]) : print-help-config user $(user-config[1]) ; |
|
} |
|
|
|
|
|
local site-config = [ GLOB $(user-path) : site-config.jam ] ; |
|
if $(site-config) |
|
{ |
|
do-scan $(site-config[1]) : print-help-config site $(site-config[1]) ; |
|
} |
|
|
|
|
|
print-help-top ; |
|
} |
|
did-help = true ; |
|
} |
|
if $(did-help) |
|
{ |
|
UPDATE all ; |
|
NOCARE all ; |
|
} |
|
return $(did-help) ; |
|
} |
|
|
|
|
|
|
|
local rule split-symbol ( |
|
symbol |
|
) |
|
{ |
|
local path-to-modules = [ modules.peek : BOOST_BUILD_PATH ] ; |
|
path-to-modules ?= . ; |
|
local module-name = $(symbol) ; |
|
local symbol-name = ; |
|
local result = ; |
|
while ! $(result) |
|
{ |
|
local module-path = [ GLOB $(path-to-modules) : $(module-name)\\.jam ] ; |
|
if $(module-path) |
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
result = $(module-path[1]) $(symbol-name) ; |
|
} |
|
else |
|
{ |
|
if ! $(module-name:S) |
|
{ |
|
result = - ; |
|
} |
|
else |
|
{ |
|
local next-symbol-part = [ MATCH ^.(.*) : $(module-name:S) ] ; |
|
if $(symbol-name) |
|
{ |
|
symbol-name = $(next-symbol-part).$(symbol-name) ; |
|
} |
|
else |
|
{ |
|
symbol-name = $(next-symbol-part) ; |
|
} |
|
module-name = $(module-name:B) ; |
|
} |
|
} |
|
} |
|
if $(result) != - |
|
{ |
|
return $(result) ; |
|
} |
|
} |
|
|