args module (#437)

This completes rewriting the command line argument parsing to replace it with the Lyra library. The main() changes now allow for parsing project jamfiles before printing help text. And hence allow for all jam side args to be displayed with -h.
This commit is contained in:
René Ferdinand Rivera Morell
2025-04-03 14:53:57 -05:00
committed by GitHub
parent b967c358cf
commit dbbf11049c
102 changed files with 2595 additions and 2220 deletions
+43 -43
View File
@@ -1,46 +1,46 @@
parameters:
- name: b2_opts
type: string
default: ''
- name: b2_opts
type: string
default: ""
steps:
- bash: |
set -e
uname -a
./.ci/linux-cxx-install.sh
python3 --version
displayName: Install
- bash: |
set -e
cd src/engine
set PATH=${PATH};${CXX_PATH}
./build.sh ${TOOLSET}
./b2 -v
cd ../..
echo "using ${TOOLSET%%-[0-9]*} : : ${CXX} ;" > ${HOME}/user-config.jam
displayName: Build
- bash: |
set -e
echo "Available system locales:"
locale -a
echo "Switch to C.UTF-8 locale."
export LC_ALL=C.UTF-8
cd test
./test_all.py ${TOOLSET}
cd ..
displayName: Test
- bash: |
set -e
./src/engine/b2 b2 warnings-as-errors=on variant=debug,release ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
displayName: "No Warnings"
- bash: |
set -e
./bootstrap.sh ${TOOLSET}
./b2 --prefix=$HOME/temp/.b2 install ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
rm ./b2
export PATH=$HOME/temp/.b2/bin:$PATH
cd $HOME
touch build.jam
b2 -v
b2 -n --debug-configuration ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
displayName: Bootstrap
- bash: |
set -e
uname -a
./.ci/linux-cxx-install.sh
python3 --version
displayName: Install
- bash: |
set -e
cd src/engine
set PATH=${PATH};${CXX_PATH}
./build.sh ${TOOLSET}
./b2 -v
cd ../..
echo "using ${TOOLSET%%-[0-9]*} : : ${CXX} ;" > ${HOME}/user-config.jam
displayName: Build
- bash: |
set -e
echo "Available system locales:"
locale -a
echo "Switch to C.UTF-8 locale."
export LC_ALL=C.UTF-8
cd test
./test_all.py ${TOOLSET}
cd ..
displayName: Test
- bash: |
set -e
./src/engine/b2 b2 warnings-as-errors=on variant=debug,release ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
displayName: "No Warnings"
- bash: |
set -e
./bootstrap.sh ${TOOLSET}
./b2 --prefix=$HOME/temp/.b2 install ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
rm ./b2
export PATH=$HOME/temp/.b2/bin:$PATH
cd $HOME
touch build.jam
b2 -v
b2 -n --debug-configuration ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }}
displayName: Bootstrap
+23 -19
View File
@@ -7,11 +7,14 @@ UseTab: Always
Language: Cpp
AccessModifierOffset: 0
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignArrayOfStructures: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: None
AlignEscapedNewlines: DontAlign
AlignOperands: DontAlign
AlignTrailingComments: false
AlignTrailingComments: { Kind: Never }
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
@@ -29,22 +32,22 @@ BinPackParameters: false
BitFieldColonSpacing: Both
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterExternBlock: true
AfterFunction: true
AfterNamespace: false
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
BeforeWhile: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyNamespace: true
SplitEmptyRecord: false
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterExternBlock: true
AfterFunction: true
AfterNamespace: false
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
BeforeWhile: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyNamespace: true
SplitEmptyRecord: false
BreakBeforeBinaryOperators: All
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
@@ -70,6 +73,7 @@ NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 0
PenaltyBreakFirstLessLess: 0
PenaltyReturnTypeOnItsOwnLine: 999999
PenaltyIndentedWhitespace: 999999
PointerAlignment: Middle
PPIndentWidth: 0
ReflowComments: true
+4
View File
@@ -15,6 +15,10 @@ trim_trailing_whitespace = true
indent_size = 2
indent_style = space
[*.clang-format]
indent_size = 1
indent_style = space
[*.jam]
indent_style = space
+20 -13
View File
@@ -8,7 +8,7 @@
"name": "(gdb) Pipe Launch",
"type": "cppdbg",
"request": "launch",
"program": "/root/b2/.build/gcc-12/debug/cxxstd-11-iso/threading-multi/b2",
"program": "/root/b2/.build/gcc-14/debug/cxxstd-11-iso/threading-multi/b2",
"args": [],
"stopAtEntry": true,
"cwd": "/root/b2/test/grep",
@@ -68,11 +68,16 @@
"request": "launch",
"program": "${workspaceFolder}\\.build\\msvc-14.3\\debug\\cxxstd-11-iso\\threading-multi\\b2.exe",
"args": [
"-v"
"-ftest.jam"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}\\src\\engine",
"environment": []
"cwd": "${workspaceFolder}\\test",
"environment": [
{
"name": "BOOST_BUILD_PATH",
"value": "${workspaceFolder}"
}
]
},
{
"name": "(msvc) Launch, Unit Tests",
@@ -92,10 +97,12 @@
"name": "(gcc) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/.build/gcc-13/debug/cxxstd-11-iso/threading-multi/b2",
"args": ["-d1", "--command-database=json", "b2"],
"program": "${workspaceFolder}/.build/gcc-14/debug/cxxstd-11-iso/threading-multi/b2",
"args": [
"-h"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"cwd": "${workspaceFolder}/example/hello",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
@@ -111,10 +118,10 @@
"name": "(gcc) Launch: ASAN",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/.build/gcc-13/debug/address-sanitizer-on/cxxstd-11-iso/b2",
"program": "${workspaceFolder}/.build/gcc-14/debug/address-sanitizer-on/cxxstd-11-iso/threading-multi/b2",
"args": [
"-na",
"toolset=gcc"
"-n",
"-a"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
@@ -133,7 +140,7 @@
"name": "(gcc) Launch, Unit Tests",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/.build/gcc-13/debug/cxxstd-11-iso/threading-multi/b2",
"program": "${workspaceFolder}/.build/gcc-14/debug/cxxstd-11-iso/threading-multi/b2",
"args": [
"--debug",
"--build-system=test/test",
@@ -158,7 +165,7 @@
"name": "(gcc) Launch, Unit Tests: ASAN",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/.build/gcc-13/debug/address-sanitizer-on/cxxstd-11-iso/b2",
"program": "${workspaceFolder}/.build/gcc-14/debug/address-sanitizer-on/cxxstd-11-iso/b2",
"args": [
"--debug",
"--build-system=test/test",
@@ -187,7 +194,7 @@
"name": "(rr) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/.build/gcc-13/debug/cxxstd-11-iso/b2",
"program": "${workspaceFolder}/.build/gcc-14/debug/cxxstd-11-iso/b2",
"args": [
"--grep"
],
+7
View File
@@ -9,6 +9,9 @@
* *New*: Add generic `cc` toolset for simply, direct, configuration of unknown
C compiler toolsets (for example `tcc`).
-- _René Ferdinand Rivera Morell_
* *New*: Add `args` module for common handling of both native and Jam side
command line arguments.
-- _René Ferdinand Rivera Morell_
* Fix command database output file path when an output dir is not given.
-- _René Ferdinand Rivera Morell_
* Fix asciidoctor ignoring relevant features when building which caused invalid
@@ -28,6 +31,10 @@
-- _Andrey Semashev_
* Fix Building on Haiku OS which doesn't have `wait4`.
-- _Fas Xmut_
* Rewrite the command like argument parsing to use the Lyra library. The result
is that arguments from Jam and native are integrated and available with the
built-in `-h` help.
-- _René Ferdinand Rivera Morell_
== Version 5.2.1
+1
View File
@@ -780,6 +780,7 @@ include::../../src/engine/mod_set.h[tag=reference]
include::../../src/engine/mod_string.h[tag=reference]
include::../../src/engine/mod_version.h[tag=reference]
include::../../src/engine/mod_db.h[tag=reference]
include::../../src/engine/mod_args.h[tag=reference]
include::path.adoc[]
+56 -35
View File
@@ -8,6 +8,7 @@
# This file is part of Boost Build version 2. You can think of it as forming the
# main() routine. It is invoked by the bootstrapping code in bootstrap.jam.
import args ;
import build-request ;
import builtin ;
import "class" : new ;
@@ -43,7 +44,7 @@ import virtual-target ;
# Flag indicating we should display additional debugging information related to
# locating and loading Boost Build configuration files.
.debug-config = [ MATCH ^(--debug-configuration)$ : $(.argv) ] ;
.debug-config = [ args.get-arg debug-configuration ] ;
# Virtual targets obtained when building main targets references on the command
# line. When running 'bjam --clean main_target' we want to clean only files
@@ -52,7 +53,9 @@ import virtual-target ;
.results-of-main-targets = ;
# Was an XML dump requested?
.out-xml = [ MATCH ^--out-xml=(.*)$ : $(.argv) ] ;
args.add-arg out-xml : --out-xml
: "Output build information to an XML file." ;
.out-xml = [ args.get-arg out-xml ] ;
# Default toolset & version to be used in case no other toolset has been used
# explicitly by either the loaded configuration files, the loaded project build
@@ -281,7 +284,7 @@ local rule load-config ( module-name : filename : path + : must-find ? )
#
local rule handle-config-option ( name : env ? )
{
local result = [ MATCH ^--$(name)=(.*)$ : $(.argv) ] ;
local result = [ args.get-arg $(name) ] ;
if ! $(result)-is-defined && $(env)
{
result = [ os.environ $(env) ] ;
@@ -311,12 +314,16 @@ local rule handle-config-option ( name : env ? )
# If this configuration file is loaded, regular site and user configuration
# files will not be. If a relative path is specified, file is searched for in
# the current folder.
args.add-arg test-config : --test-config
: "Override all configuration files, without error if not found." ;
#
# -- all-config --
# Loaded only if specified on the command-line using the --config command
# line option. If a file name is specified, it must exist and replaces all
# other configuration files. If an empty file name is passed, no configuration
# files will be loaded.
args.add-arg all-config : --config
: "Override all configuration files." ;
#
# -- site-config --
# Named site-config.jam by default or may be named explicitly using the
@@ -327,6 +334,11 @@ local rule handle-config-option ( name : env ? )
# order. Not loaded in case the test-config configuration file is loaded,
# the file is explicitly set to the empty string or the --ignore-site-config
# command-line option is specified.
args.add-arg site-config : --site-config
: "Override the default site-config.jam." ;
args.add-arg ignore-site-config : --ignore-site-config
: "Do not load a site-config.jam."
: flag ;
#
# -- user-config --
# Named user-config.jam by default or may be named explicitly using the
@@ -337,6 +349,8 @@ local rule handle-config-option ( name : env ? )
# case either the test-config configuration file is loaded or an empty file name
# is explicitly specified. If the file name has been given explicitly then the
# file must exist.
args.add-arg user-config : --user-config
: "Override the default user-config.jam." ;
#
# -- project-config --
# Named project-config.jam. Looked up in the current working folder and
@@ -345,6 +359,8 @@ local rule handle-config-option ( name : env ? )
# is specified explicitly, it is found relative to the current working
# directory and must exist. If an empty file name is passed, project-config
# will not be loaded.
args.add-arg project-config : --project-config
: "Override the default project-config.jam." ;
#
# Test configurations have been added primarily for use by Boost Build's
# internal unit testing system but may be used freely in other places as well.
@@ -352,8 +368,7 @@ local rule handle-config-option ( name : env ? )
local rule load-configuration-files
{
# Flag indicating that site configuration should not be loaded.
local ignore-site-config =
[ MATCH ^(--ignore-site-config)$ : $(.argv) ] ;
local ignore-site-config = [ args.get-arg ignore-site-config ] ;
local ignore-user-config ;
local ignore-project-config ;
@@ -377,7 +392,7 @@ local rule load-configuration-files
}
initialize-config-module all-config ;
local all-config = [ handle-config-option config ] ;
local all-config = [ handle-config-option all-config ] ;
if $(all-config)
{
load-config all-config : $(all-config:D=) : $(all-config:D) : required ;
@@ -405,7 +420,7 @@ local rule load-configuration-files
site-path = [ modules.peek : SystemRoot ] $(user-path) ;
}
if $(.debug-config) && $(ignore-site-config) = --ignore-site-config
if $(.debug-config) && [ args.get-arg ignore-site-config ]
{
ECHO "notice: Site configuration files will be ignored due to the" ;
ECHO "notice: --ignore-site-config command-line option." ;
@@ -501,12 +516,14 @@ local rule load-configuration-files
# toolset=xx,yy,...zz in the command line. May return additional properties to
# be processed as if they had been specified by the user.
#
args.add-arg toolsets : --toolset
: "Autoconfigure toolsets (--toolset=xx,yy,...zz or toolset=xx,yy,...zz)." ;
local rule process-explicit-toolset-requests
{
local extra-properties ;
local option-toolsets = [ regex.split-list [ MATCH ^--toolset=(.*)$ : $(.argv) ] : "," ] ;
local feature-toolsets = [ regex.split-list [ MATCH ^toolset=(.*)$ : $(.argv) ] : "," ] ;
local option-toolsets = [ regex.split-list [ args.get-arg toolsets ] : "," ] ;
local feature-toolsets = [ regex.split-list [ MATCH ^toolset=(.*)$ : $(.argv) ] : "," ] ;
for local t in $(option-toolsets) $(feature-toolsets)
{
@@ -596,10 +613,14 @@ local rule should-clean-project ( project )
################################################################################
{
if --version in $(.argv)
args.add-arg version : --version
: "Display version, and other information. (same as -v)"
: flag ;
if [ args.get-arg version ]
{
version.print ;
EXIT ;
EXIT : 0 ;
}
version.verify-engine-version ;
@@ -685,8 +706,14 @@ local rule should-clean-project ( project )
# clean existing instead of create new targets. Note that these are not the
# final flag values as they may get changed later on due to some special
# targets being specified on the command line.
local clean ; if "--clean" in $(.argv) { clean = true ; }
local cleanall ; if "--clean-all" in $(.argv) { cleanall = true ; }
args.add-arg clean : --clean
: "Remove known build results instead of building them."
: flag ;
local clean = [ args.get-arg clean ] ;
args.add-arg clean-all : --clean-all
: "Remove known build results instead of building them."
: flag ;
local cleanall = [ args.get-arg clean-all ] ;
# List of explicitly requested files to build. Any target references read
@@ -745,7 +772,10 @@ local rule should-clean-project ( project )
targets += [ project.target [ project.module-name "." ] ] ;
}
if [ option.get dump-generators : : true ]
args.add-arg dump-generators : --dump-generators
: "Display the active build generators."
;
if [ args.get-arg dump-generators ]
{
generators.dump ;
}
@@ -811,7 +841,10 @@ local rule should-clean-project ( project )
}
}
local durations = [ MATCH "(--durations(=([0-9]+))?)" : $(.argv) ] ;
args.add-arg durations : --durations
: "Record the timing of some number (default 10) of actions."
;
local durations = [ args.get-arg durations ] ;
if $(durations) {
durations = $(durations[3]) ;
durations ?= 10 ;
@@ -1022,26 +1055,6 @@ local rule should-clean-project ( project )
;
}
local j = [ option.get jobs ] ;
if $(j)
{
modules.poke : PARALLELISM : $(j) ;
}
local k = [ option.get keep-going : true : true ] ;
if $(k) in "on" "yes" "true"
{
modules.poke : KEEP_GOING : 1 ;
}
else if $(k) in "off" "no" "false"
{
modules.poke : KEEP_GOING : 0 ;
}
else
{
EXIT "error: Invalid value for the --keep-going option" ;
}
# The 'all' pseudo target is not strictly needed expect in the case when we
# use it below but people often assume they always have this target
# available and do not declare it themselves before use which may cause
@@ -1049,6 +1062,14 @@ local rule should-clean-project ( project )
# 'all' target.
NOTFILE all ;
# Skip building (i.e. updating) if the user is asking for help. We need all
# the declarations to get ad-hoc help arguments declared. But we don't
# want to update while also asking for help.
if [ args.get-arg help ]
{
return ;
}
# And now that all the actual raw Jam targets and all the dependencies
# between them have been prepared all that is left is to tell Jam to update
# those targets.
+2 -1
View File
@@ -8,6 +8,7 @@ import regex ;
import path ;
import project ;
import os ;
import args ;
rule get ( name )
{
@@ -68,7 +69,7 @@ rule load ( cache-file )
errors.error duplicate load of cache file ;
}
cache-file = [ path.native $(cache-file) ] ;
if [ path.exists $(cache-file) ] && ! ( --reconfigure in [ modules.peek : ARGV ] )
if [ path.exists $(cache-file) ] && ! [ args.get-arg reconfigure ]
{
FILE_CONTENTS on <old-cache-file>$(cache-file) = "" ;
config-cache.write <old-cache-file>$(cache-file) ;
+8 -5
View File
@@ -11,6 +11,7 @@
# process.
# - Reporting what is built, and how it is configured.
import args ;
import "class" : new ;
import common ;
import indirect ;
@@ -27,6 +28,13 @@ import utility ;
import virtual-target ;
args.add-arg reconfigure : --reconfigure
: "Recreated shared toolset configuration files."
: flag ;
.reconfigure = [ args.get-arg reconfigure ] ;
rule log-summary ( )
{
}
@@ -161,11 +169,6 @@ rule print-configure-checks-summary ( )
}
}
if --reconfigure in [ modules.peek : ARGV ]
{
.reconfigure = true ;
}
# Handle the --reconfigure option
rule maybe-force-rebuild ( targets * )
{
+4 -4
View File
@@ -51,12 +51,12 @@ import regex ;
import type ;
import utility ;
import virtual-target ;
import args ;
if "--debug-generators" in [ modules.peek : ARGV ]
{
.debug = true ;
}
args.add-arg debug-generators : --debug-generators
: "Produces debug output from the generator search process." ;
.debug = [ args.get-arg debug-generators ] ;
# Updated cached viable source target type information as needed after a new
+22 -12
View File
@@ -34,6 +34,7 @@
# rule. Standalone projects are not recorded and can only be referenced using
# their project id.
import args ;
import "class" : new ;
import modules ;
import os ;
@@ -45,8 +46,23 @@ import sequence ;
import command-db ;
.debug-loading = [ MATCH ^(--debug-loading)$ : [ modules.peek : ARGV ] ] ;
.debug-project-search = [ MATCH ^(--debug-project-search)$ : [ modules.peek : ARGV ] ] ;
args.add-arg project-search : --project-search
: "Defines search paths for resolving global, i.e. rooted, project references." ;
args.add-arg debug-loading : --debug-loading
: "Display the progress of loading projects."
: flag ;
args.add-arg debug-project-search : --debug-project-search
: "Display the progress of searching for projects."
: flag ;
args.add-arg build-dir : --build-dir
: "Specify the directory to output build artifacts." ;
.debug-loading = [ args.get-arg debug-loading ] ;
.debug-project-search = [ args.get-arg debug-project-search ] ;
.global-build-dir = [ args.get-arg build-dir ] ;
# Loads the Jamfile at the given location. After loading, project global file
@@ -213,7 +229,7 @@ rule find ( name : current-location )
B2_PROJECT_PATH = [ modules.peek : B2_PROJECT_PATH ]
[ regex.split-list
[ MATCH ^--project-search=(.*)$ : [ modules.peek : ARGV ] ]
[ args.get-arg project-search ]
: [ os.path-separator ] ] ;
{
while $(B2_PROJECT_PATH)
@@ -445,7 +461,9 @@ PACKAGE_MANAGER_BUILD_INFO(CONAN) = "conanbuildinfo.jam" ;
# 3. Environment variable "PACKAGE_MANAGER_BUILD_INFO".
# 4. Conan, others.
#
local .use-package-manager = [ MATCH "^--use-package-manager=(.*)$" : [ modules.peek : ARGV ] ] ;
args.add-arg use-package-manager : --use-package-manage
: "Load target definitions from the given package manager." ;
local .use-package-manager = [ args.get-arg use-package-manager ] ;
PACKAGE_MANAGER_BUILD_INFO ?= $(PACKAGE_MANAGER_BUILD_INFO($(.use-package-manager:U))) ;
PACKAGE_MANAGER_BUILD_INFO ?= [ modules.peek : PACKAGE_MANAGER_BUILD_INFO ] ;
PACKAGE_MANAGER_BUILD_INFO ?= $(PACKAGE_MANAGER_BUILD_INFO(CONAN)) ;
@@ -635,14 +653,6 @@ rule load-aux ( module-name : file )
}
.global-build-dir = [ MATCH ^--build-dir=(.*)$ : [ modules.peek : ARGV ] ] ;
if $(.global-build-dir)
{
# If the option is specified several times, take the last value.
.global-build-dir = [ path.make $(.global-build-dir[-1]) ] ;
}
# Initialize the module for a project.
#
rule initialize (
+7 -15
View File
@@ -13,6 +13,7 @@ import property ;
import sequence ;
import set ;
import option ;
import args ;
# Class for storing a set of properties.
#
@@ -113,11 +114,9 @@ class property-set
local result ;
local features = [ $(features-ps).get <relevant> ] ;
features = <$(features)> ;
local ignore-relevance = [ modules.peek
property-set : .ignore-relevance ] ;
for local p in $(self.raw)
{
if $(ignore-relevance) || $(p:G) in $(features)
if $(p:G) in $(features)
{
local att = [ feature.attributes $(p:G) ] ;
if ! ( incidental in $(att) )
@@ -395,10 +394,9 @@ class property-set
local relevant-features = [ get <relevant> ] ;
relevant-features = [ feature.expand-relevant $(relevant-features) ] ;
relevant-features = <$(relevant-features)> ;
ignore-relevance = [ modules.peek property-set : .ignore-relevance ] ;
for local p in $(self.raw)
{
if $(ignore-relevance) || $(p:G) in $(relevant-features)
if $(p:G) in $(relevant-features)
{
local att = [ feature.attributes $(p:G) ] ;
if ! ( incidental in $(att) )
@@ -451,14 +449,6 @@ class property-set
}
}
# This is a temporary measure to help users work around
# any problems. Remove it once we've verified that
# everything works.
if --ignore-relevance in [ modules.peek : ARGV ]
{
.ignore-relevance = true ;
}
# Creates a new 'property-set' instance for the given raw properties or returns
# an already existing ones.
#
@@ -578,8 +568,10 @@ rule empty ( )
return $(.empty) ;
}
if [ option.get hash : : yes ] = yes
args.add-arg hash : --hash
: "Compress target paths using an MD5 hash."
: flag ;
if [ args.get-arg hash ]
{
rule hash-maybe ( path ? )
{
+4 -1
View File
@@ -14,6 +14,7 @@ import string ;
import sequence ;
import set ;
import utility ;
import args ;
# Refines 'properties' by overriding any non-free and non-conditional properties
@@ -280,7 +281,9 @@ local rule identity ( string )
}
if --abbreviate-paths in [ modules.peek : ARGV ]
args.add-arg abbreviate-paths : --abbreviate-paths
: "Compresses target paths by abbreviating each component." ;
if [ args.get-arg abbreviate-paths ]
{
.abbrev = abbreviate-dashed ;
}
+4 -4
View File
@@ -76,6 +76,7 @@ import property-set ;
import sequence ;
import set ;
import toolset ;
import args ;
# Base class for all abstract targets.
@@ -147,10 +148,9 @@ class abstract-target
}
if --debug-building in [ modules.peek : ARGV ]
{
modules.poke : .debug-building : true ;
}
args.add-arg debug-building : --debug-building
: "Prints what targets are being built and with what properties." ;
modules.poke : .debug-building : [ args.get-arg debug-building ] ;
rule indent ( )
+4 -4
View File
@@ -7,6 +7,7 @@
# Support for toolset definition.
import args ;
import errors ;
import feature ;
import generators ;
@@ -28,10 +29,9 @@ import utility ;
# This is used only for testing, to make sure we do not get random extra
# elements in paths.
if --ignore-toolset-requirements in [ modules.peek : ARGV ]
{
.ignore-requirements = 1 ;
}
args.add-arg ignore-toolset-requirements : --ignore-toolset-requirements
: "?" ;
.ignore-requirements = [ args.get-arg ignore-toolset-requirements ] ;
# Initializes an additional toolset-like module. First load the 'toolset-module'
+2 -4
View File
@@ -48,6 +48,7 @@
# find the correct pre-built library.
#
import args ;
import common ;
import modules ;
import numbers ;
@@ -58,10 +59,7 @@ import toolset ;
.boost.auto_config = [ property-set.create <layout>system ] ;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
# Configuration of the boost library to use.
#
+5 -1
View File
@@ -3,6 +3,7 @@
# (See accompanying file LICENSE.txt or copy at
# https://www.bfgroup.xyz/b2/LICENSE.txt)
import args ;
import path ;
import project ;
import modules ;
@@ -190,13 +191,16 @@ local rule define-library ( name caller-module ? : root )
}
}
args.add-arg modular-search-dir : --modular-search-dir
: "" ;
local rule process-args ( )
{
if ! $(.did-process-args)
{
.did-process-args = yes ;
local argv = [ modules.peek : ARGV ] ;
local dirs = [ MATCH ^--modular-search-dir=(.*)$ : $(argv) ] ;
local dirs = [ args.get-arg modular-search-dir ] ;
for local dir in $(dirs)
{
add-location $(dir) : [ path.pwd ] ;
+2 -4
View File
@@ -53,6 +53,7 @@
#
################################################################################
import args ;
import generators ;
import os ;
import path ;
@@ -189,7 +190,4 @@ rule is-initialized ( )
.executable = ;
.initialized = ;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
+3 -1
View File
@@ -21,6 +21,7 @@ Distributed under the Boost Software License, Version 1.0.
#include "value.h"
#include "variable.h"
#include "mod_args.h"
#include "mod_command_db.h"
#include "mod_db.h"
#include "mod_jam_builtin.h"
@@ -825,7 +826,8 @@ void bind_jam(FRAME * f)
.bind(sysinfo_module())
.bind(version_module())
.bind(db_module())
.bind(command_db_module());
.bind(command_db_module())
.bind(b2::args::args_module());
}
}} // namespace b2::jam
+2 -1
View File
@@ -174,10 +174,11 @@ set B2_SOURCES=%B2_SOURCES% events.cpp
set B2_SOURCES=%B2_SOURCES% execcmd.cpp execnt.cpp execunix.cpp filent.cpp filesys.cpp fileunix.cpp frames.cpp function.cpp
set B2_SOURCES=%B2_SOURCES% glob.cpp hash.cpp hcache.cpp hdrmacro.cpp headers.cpp jam.cpp
set B2_SOURCES=%B2_SOURCES% jamgram.cpp lists.cpp make.cpp make1.cpp md5.cpp mem.cpp modules.cpp
set B2_SOURCES=%B2_SOURCES% native.cpp option.cpp output.cpp parse.cpp pathnt.cpp
set B2_SOURCES=%B2_SOURCES% native.cpp output.cpp parse.cpp pathnt.cpp
set B2_SOURCES=%B2_SOURCES% pathsys.cpp pathunix.cpp regexp.cpp rules.cpp scan.cpp search.cpp jam_strings.cpp
set B2_SOURCES=%B2_SOURCES% startup.cpp tasks.cpp
set B2_SOURCES=%B2_SOURCES% timestamp.cpp value.cpp variable.cpp w32_getreg.cpp
set B2_SOURCES=%B2_SOURCES% mod_args.cpp
set B2_SOURCES=%B2_SOURCES% mod_command_db.cpp
set B2_SOURCES=%B2_SOURCES% mod_db.cpp
set B2_SOURCES=%B2_SOURCES% mod_jam_builtin.cpp
+1 -1
View File
@@ -455,7 +455,6 @@ md5.cpp \
mem.cpp \
modules.cpp \
native.cpp \
option.cpp \
output.cpp \
parse.cpp \
pathnt.cpp \
@@ -471,6 +470,7 @@ timestamp.cpp \
value.cpp \
variable.cpp \
w32_getreg.cpp \
mod_args.cpp \
mod_command_db.cpp \
mod_db.cpp \
mod_jam_builtin.cpp \
+6 -7
View File
@@ -1092,7 +1092,7 @@ LIST * builtin_hdrmacro( FRAME * frame, int flags )
TARGET * const t = bindtarget( list_item( iter ) );
/* Scan file for header filename macro definitions. */
if ( DEBUG_HEADER )
if ( is_debug_header() )
out_printf( "scanning '%s' for header file macro definitions\n",
object_str( list_item( iter ) ) );
@@ -1480,7 +1480,6 @@ LIST * builtin_update( FRAME * frame, int flags )
return result;
}
extern int anyhow;
int last_update_now_status;
/* Takes a list of target names and immediately updates them.
@@ -1503,8 +1502,8 @@ LIST * builtin_update_now( FRAME * frame, int flags )
int status;
int original_stdout = 0;
int original_stderr = 0;
int original_noexec = 0;
int original_quitquick = 0;
bool original_noexec = false;
bool original_quitquick = false;
if ( !list_empty( log ) )
{
@@ -1519,16 +1518,16 @@ LIST * builtin_update_now( FRAME * frame, int flags )
if ( !list_empty( force ) )
{
original_noexec = globs.noexec;
globs.noexec = 0;
globs.noexec = false;
}
if ( !list_empty( continue_ ) )
{
original_quitquick = globs.quitquick;
globs.quitquick = 0;
globs.quitquick = false;
}
status = make( targets, anyhow );
status = make( targets, globs.anyhow );
if ( !list_empty( force ) )
{
+4 -4
View File
@@ -66,7 +66,7 @@ LIST * evaluate_rule( RULE * rule, OBJECT * rulename, FRAME * frame )
profile_frame prof[ 1 ];
module_t * prev_module = frame->module;
if ( DEBUG_COMPILE )
if ( is_debug_compile() )
{
/* Try hard to indicate in which module the rule is going to execute. */
char buf[ 256 ] = "";
@@ -98,7 +98,7 @@ LIST * evaluate_rule( RULE * rule, OBJECT * rulename, FRAME * frame )
{
frame->rulename = object_str( rulename );
/* And enter record profile info. */
if ( DEBUG_PROFILE )
if ( is_debug_profile() )
profile_enter( function_rulename( rule->procedure ), prof );
}
@@ -153,10 +153,10 @@ LIST * evaluate_rule( RULE * rule, OBJECT * rulename, FRAME * frame )
result.reset( function_run( function.get(), frame ) );
}
if ( DEBUG_PROFILE && rule->procedure )
if ( is_debug_profile() && rule->procedure )
profile_exit( prof );
if ( DEBUG_COMPILE )
if ( is_debug_compile() )
debug_compile( -1, 0, frame );
return result.release();
-21
View File
@@ -48,15 +48,8 @@ void constants_init( void )
constant_TMPFILE = object_new( "TMPFILE" );
constant_STDOUT = object_new( "STDOUT" );
constant_STDERR = object_new( "STDERR" );
constant_JAMDATE = object_new( "JAMDATE" );
constant_JAM_TIMESTAMP_RESOLUTION = object_new( "JAM_TIMESTAMP_RESOLUTION" );
constant_JAM_VERSION = object_new( "JAM_VERSION" );
constant_JAMUNAME = object_new( "JAMUNAME" );
constant_ENVIRON = object_new( ".ENVIRON" );
constant_ARGV = object_new( "ARGV" );
constant_all = object_new( "all" );
constant_PARALLELISM = object_new( "PARALLELISM" );
constant_KEEP_GOING = object_new( "KEEP_GOING" );
constant_other = object_new( "[OTHER]" );
constant_total = object_new( "[TOTAL]" );
constant_FILE_DIRSCAN = object_new( "FILE_DIRSCAN" );
@@ -107,15 +100,8 @@ void constants_done( void )
object_free( constant_TMPFILE );
object_free( constant_STDOUT );
object_free( constant_STDERR );
object_free( constant_JAMDATE );
object_free( constant_JAM_TIMESTAMP_RESOLUTION );
object_free( constant_JAM_VERSION );
object_free( constant_JAMUNAME );
object_free( constant_ENVIRON );
object_free( constant_ARGV );
object_free( constant_all );
object_free( constant_PARALLELISM );
object_free( constant_KEEP_GOING );
object_free( constant_other );
object_free( constant_total );
object_free( constant_FILE_DIRSCAN );
@@ -164,14 +150,8 @@ OBJECT * constant_TMPNAME;
OBJECT * constant_TMPFILE;
OBJECT * constant_STDOUT;
OBJECT * constant_STDERR;
OBJECT * constant_JAMDATE;
OBJECT * constant_JAM_VERSION;
OBJECT * constant_JAMUNAME;
OBJECT * constant_ENVIRON;
OBJECT * constant_ARGV;
OBJECT * constant_all;
OBJECT * constant_PARALLELISM;
OBJECT * constant_KEEP_GOING;
OBJECT * constant_other;
OBJECT * constant_total;
OBJECT * constant_FILE_DIRSCAN;
@@ -184,7 +164,6 @@ OBJECT * constant_BINDMODULE;
OBJECT * constant_IMPORT_MODULE;
OBJECT * constant_BUILTIN_GLOB_BACK;
OBJECT * constant_timestamp;
OBJECT * constant_JAM_TIMESTAMP_RESOLUTION;
OBJECT * constant_python;
OBJECT * constant_python_interface;
OBJECT * constant_FILE_ARCHIVESCAN;
-7
View File
@@ -45,15 +45,8 @@ extern OBJECT * constant_TMPNAME; /* "TMPNAME" */
extern OBJECT * constant_TMPFILE; /* "TMPFILE" */
extern OBJECT * constant_STDOUT; /* "STDOUT" */
extern OBJECT * constant_STDERR; /* "STDERR" */
extern OBJECT * constant_JAMDATE; /* "JAMDATE" */
extern OBJECT * constant_JAM_TIMESTAMP_RESOLUTION; /* "JAM_TIMESTAMP_RESOLUTION" */
extern OBJECT * constant_JAM_VERSION; /* "JAM_VERSION" */
extern OBJECT * constant_JAMUNAME; /* "JAMUNAME" */
extern OBJECT * constant_ENVIRON; /* ".ENVIRON" */
extern OBJECT * constant_ARGV; /* "ARGV" */
extern OBJECT * constant_all; /* "all" */
extern OBJECT * constant_PARALLELISM; /* "PARALLELISM" */
extern OBJECT * constant_KEEP_GOING; /* "KEEP_GOING" */
extern OBJECT * constant_other; /* "[OTHER]" */
extern OBJECT * constant_total; /* "[TOTAL]" */
extern OBJECT * constant_FILE_DIRSCAN; /* "FILE_DIRSCAN" */
+5 -5
View File
@@ -20,14 +20,14 @@ static profile_info profile_total = { 0 };
profile_frame * profile_init( OBJECT * rulename, profile_frame * frame )
{
if ( DEBUG_PROFILE ) profile_enter( rulename, frame );
if ( is_debug_profile() ) profile_enter( rulename, frame );
return frame;
}
void profile_enter( OBJECT * rulename, profile_frame * frame )
{
if ( DEBUG_PROFILE )
if ( is_debug_profile() )
{
double start = profile_clock();
profile_info * p;
@@ -75,7 +75,7 @@ void profile_enter( OBJECT * rulename, profile_frame * frame )
void profile_memory( size_t mem )
{
if ( DEBUG_PROFILE )
if ( is_debug_profile() )
if ( profile_stack && profile_stack->info )
profile_stack->info->memory += ((double)mem) / 1024;
}
@@ -83,7 +83,7 @@ void profile_memory( size_t mem )
void profile_exit( profile_frame * frame )
{
if ( DEBUG_PROFILE )
if ( is_debug_profile() )
{
/* Cumulative time for this call. */
double t = profile_clock() - frame->entry_time - frame->overhead;
@@ -147,7 +147,7 @@ double profile_clock()
OBJECT * profile_make_local( char const * scope )
{
if ( DEBUG_PROFILE )
if ( is_debug_profile() )
{
return object_new( scope );
}
+1 -1
View File
@@ -58,7 +58,7 @@ double profile_clock();
OBJECT * profile_make_local( char const * );
#define PROFILE_ENTER_LOCAL( scope ) \
static OBJECT * constant_LOCAL_##scope = 0; \
if (DEBUG_PROFILE && !constant_LOCAL_##scope) constant_LOCAL_##scope = profile_make_local( #scope ); \
if (is_debug_profile() && !constant_LOCAL_##scope) constant_LOCAL_##scope = profile_make_local( #scope ); \
PROFILE_ENTER( LOCAL_##scope )
#define PROFILE_EXIT_LOCAL( scope ) PROFILE_EXIT( LOCAL_##scope )
+28 -28
View File
@@ -826,11 +826,11 @@ static void debug_mi_error( const char * message )
static void debug_error_( const char * message )
{
if ( debug_interface == DEBUG_INTERFACE_CONSOLE )
if ( globs.debug_interface == DEBUG_INTERFACE_CONSOLE )
{
printf( "%s\n", message );
}
else if ( debug_interface == DEBUG_INTERFACE_MI )
else if ( globs.debug_interface == DEBUG_INTERFACE_MI )
{
debug_mi_error( message );
}
@@ -885,11 +885,11 @@ static void debug_error( const char * format, ... )
static void debug_parent_child_exited( int pid, int exit_code )
{
if ( debug_interface == DEBUG_INTERFACE_CONSOLE )
if ( globs.debug_interface == DEBUG_INTERFACE_CONSOLE )
{
printf( "Child %d exited with status %d\n", (int)child_pid, (int)exit_code );
}
else if ( debug_interface == DEBUG_INTERFACE_MI )
else if ( globs.debug_interface == DEBUG_INTERFACE_MI )
{
if ( exit_code == 0 )
printf( "*stopped,reason=\"exited-normally\"\n(gdb) \n" );
@@ -907,11 +907,11 @@ static void debug_parent_child_exited( int pid, int exit_code )
static void debug_parent_child_signalled( int pid, int id )
{
if ( debug_interface == DEBUG_INTERFACE_CONSOLE )
if ( globs.debug_interface == DEBUG_INTERFACE_CONSOLE )
{
printf( "Child %d exited on signal %d\n", child_pid, id );
}
else if ( debug_interface == DEBUG_INTERFACE_MI )
else if ( globs.debug_interface == DEBUG_INTERFACE_MI )
{
const char * name = "unknown";
const char * meaning = "unknown";
@@ -937,14 +937,14 @@ static void debug_parent_on_breakpoint( void )
fprintf( command_output, "info frame\n" );
fflush( command_output );
debug_frame_read( command_child, &base );
if ( debug_interface == DEBUG_INTERFACE_CONSOLE )
if ( globs.debug_interface == DEBUG_INTERFACE_CONSOLE )
{
printf( "Breakpoint %d, ", id );
debug_print_frame_info( base );
printf( "\n" );
debug_print_source( base.file, base.line );
}
else if ( debug_interface == DEBUG_INTERFACE_MI )
else if ( globs.debug_interface == DEBUG_INTERFACE_MI )
{
printf( "*stopped,reason=\"breakpoint-hit\",bkptno=\"%d\",disp=\"keep\",", id );
debug_mi_print_frame_info( &base );
@@ -964,7 +964,7 @@ static void debug_parent_on_end_stepping( void )
fprintf( command_output, "info frame\n" );
fflush( command_output );
debug_frame_read( command_child, &base );
if ( debug_interface == DEBUG_INTERFACE_CONSOLE )
if ( globs.debug_interface == DEBUG_INTERFACE_CONSOLE )
{
debug_print_source( base.file, base.line );
}
@@ -1142,10 +1142,10 @@ static void debug_start_child( int argc, const char * * argv )
string_copy( command_line, "b2 " );
/* Pass the handles as the first and second arguments. */
string_append( command_line, debugger_opt );
string_append( command_line, b2::value::format( "%p", pipe1[ 0 ] )->str() );
string_append( command_line, b2::value::format( "=%p", pipe1[ 0 ] )->str() );
string_push_back( command_line, ' ' );
string_append( command_line, debugger_opt );
string_append( command_line, b2::value::format( "%p", pipe2[ 1 ] )->str() );
string_append( command_line, b2::value::format( "=%p", pipe2[ 1 ] )->str() );
/* Pass the rest of the command line. */
{
int i;
@@ -1265,7 +1265,7 @@ static void debug_parent_run( int argc, const char * * argv )
debug_parent_wait( 1 );
}
debug_parent_run_print( argc, argv );
if ( debug_interface == DEBUG_INTERFACE_MI )
if ( globs.debug_interface == DEBUG_INTERFACE_MI )
{
printf( "=thread-created,id=\"1\",group-id=\"i1\"\n" );
debug_mi_format_token();
@@ -1312,7 +1312,7 @@ static void debug_parent_continue( int argc, const char * * argv )
debug_error( "Too many arguments to continue." );
return;
}
if ( debug_interface == DEBUG_INTERFACE_MI )
if ( globs.debug_interface == DEBUG_INTERFACE_MI )
{
debug_mi_format_token();
printf( "^running\n(gdb) \n" );
@@ -1328,7 +1328,7 @@ static void debug_parent_kill( int argc, const char * * argv )
debug_error( "Too many arguments to kill." );
return;
}
if ( debug_interface == DEBUG_INTERFACE_MI )
if ( globs.debug_interface == DEBUG_INTERFACE_MI )
{
debug_mi_format_token();
printf( "^done\n(gdb) \n" );
@@ -1344,7 +1344,7 @@ static void debug_parent_step( int argc, const char * * argv )
debug_error( "Too many arguments to step." );
return;
}
if ( debug_interface == DEBUG_INTERFACE_MI )
if ( globs.debug_interface == DEBUG_INTERFACE_MI )
{
debug_mi_format_token();
printf( "^running\n(gdb) \n" );
@@ -1360,7 +1360,7 @@ static void debug_parent_next( int argc, const char * * argv )
debug_error( "Too many arguments to next." );
return;
}
if ( debug_interface == DEBUG_INTERFACE_MI )
if ( globs.debug_interface == DEBUG_INTERFACE_MI )
{
debug_mi_format_token();
printf( "^running\n(gdb) \n" );
@@ -1376,7 +1376,7 @@ static void debug_parent_finish( int argc, const char * * argv )
debug_error( "Too many arguments to finish." );
return;
}
if ( debug_interface == DEBUG_INTERFACE_MI )
if ( globs.debug_interface == DEBUG_INTERFACE_MI )
{
debug_mi_format_token();
printf( "^running\n(gdb) \n" );
@@ -1400,11 +1400,11 @@ static void debug_parent_break( int argc, const char * * argv )
}
id = debug_add_breakpoint( argv[ 1 ] );
debug_parent_forward_nowait( argc, argv, 1, 0 );
if ( debug_interface == DEBUG_INTERFACE_CONSOLE )
if ( globs.debug_interface == DEBUG_INTERFACE_CONSOLE )
{
printf( "Breakpoint %d set at %s\n", id, argv[ 1 ] );
}
else if ( debug_interface == DEBUG_INTERFACE_MI )
else if ( globs.debug_interface == DEBUG_INTERFACE_MI )
{
debug_mi_format_token();
printf( "^done\n(gdb) \n" );
@@ -1453,7 +1453,7 @@ static void debug_parent_disable( int argc, const char * * argv )
}
debug_child_disable( argc, argv );
debug_parent_forward_nowait( 2, argv, 1, 0 );
if ( debug_interface == DEBUG_INTERFACE_MI )
if ( globs.debug_interface == DEBUG_INTERFACE_MI )
{
debug_mi_format_token();
printf( "^done\n(gdb) \n" );
@@ -1468,7 +1468,7 @@ static void debug_parent_enable( int argc, const char * * argv )
}
debug_child_enable( argc, argv );
debug_parent_forward_nowait( 2, argv, 1, 0 );
if ( debug_interface == DEBUG_INTERFACE_MI )
if ( globs.debug_interface == DEBUG_INTERFACE_MI )
{
debug_mi_format_token();
printf( "^done\n(gdb) \n" );
@@ -1483,7 +1483,7 @@ static void debug_parent_delete( int argc, const char * * argv )
}
debug_child_delete( argc, argv );
debug_parent_forward_nowait( 2, argv, 1, 0 );
if ( debug_interface == DEBUG_INTERFACE_MI )
if ( globs.debug_interface == DEBUG_INTERFACE_MI )
{
debug_mi_format_token();
printf( "^done\n(gdb) \n" );
@@ -1511,7 +1511,7 @@ static void debug_parent_clear( int argc, const char * * argv )
return;
}
if ( debug_interface == DEBUG_INTERFACE_CONSOLE )
if ( globs.debug_interface == DEBUG_INTERFACE_CONSOLE )
{
printf( "Deleted breakpoint %d\n", id );
}
@@ -1531,12 +1531,12 @@ static void debug_parent_print( int argc, const char * * argv )
}
result = debug_list_read( command_child );
if ( debug_interface == DEBUG_INTERFACE_CONSOLE )
if ( globs.debug_interface == DEBUG_INTERFACE_CONSOLE )
{
list_print( result );
printf( "\n" );
}
else if ( debug_interface == DEBUG_INTERFACE_MI )
else if ( globs.debug_interface == DEBUG_INTERFACE_MI )
{
printf( "~\"$1 = " );
list_print( result );
@@ -2601,11 +2601,11 @@ int debugger( void )
{
command_array = parent_commands;
command_input = stdin;
if ( debug_interface == DEBUG_INTERFACE_MI )
if ( globs.debug_interface == DEBUG_INTERFACE_MI )
printf( "=thread-group-added,id=\"i1\"\n(gdb) \n" );
while ( 1 )
{
if ( debug_interface == DEBUG_INTERFACE_CONSOLE )
if ( globs.debug_interface == DEBUG_INTERFACE_CONSOLE )
printf("(b2db) ");
fflush( stdout );
read_command();
@@ -2727,7 +2727,7 @@ static void debug_listen( void )
}
struct debug_child_data_t debug_child_data;
const char debugger_opt[] = "--b2db-internal-debug-handle=";
const char debugger_opt[] = "--b2db-internal-debug-handle";
int debug_interface;
void debugger_done()
+4 -5
View File
@@ -32,13 +32,12 @@ struct debug_child_data_t
extern struct debug_child_data_t debug_child_data;
extern b2::list_ref debug_print_result;
extern const char debugger_opt[];
extern int debug_interface;
#define DEBUG_INTERFACE_CONSOLE 1
#define DEBUG_INTERFACE_MI 2
#define DEBUG_INTERFACE_CHILD 3
#define DEBUG_INTERFACE_CONSOLE (global_config::debug_interface_console)
#define DEBUG_INTERFACE_MI (global_config::debug_interface_mi)
#define DEBUG_INTERFACE_CHILD (global_config::debug_interface_child)
#define debug_is_debugging() ( debug_interface != 0 )
#define debug_is_debugging() ( globs.debug_interface != global_config::debug_interface_no )
#define debug_on_enter_function( frame, name, file, line ) \
( debug_is_debugging()? \
debug_on_enter_function( frame, name, file, line ) : \
+2 -2
View File
@@ -355,7 +355,7 @@ void exec_cmd
if ( list_empty( shell ) )
shell = default_shell;
if ( DEBUG_EXECCMD )
if ( is_debug_execcmd() )
{
if ( is_raw_cmd )
out_printf( "Executing raw command directly\n" );
@@ -550,7 +550,7 @@ static void invoke_cmd( char const * const command, int32_t const slot )
/* Let the child inherit stdin, as some commands assume it is available. */
si.hStdInput = GetStdHandle( STD_INPUT_HANDLE );
if ( DEBUG_EXECCMD )
if ( is_debug_execcmd() )
out_printf( "Command string for CreateProcessA(): '%s'\n", command );
/* Run the command by creating a sub-process for it. */
+1 -1
View File
@@ -203,7 +203,7 @@ void exec_cmd
*/
argv_from_shell( argv, shell, command->value, slot );
if ( DEBUG_EXECCMD )
if ( is_debug_execcmd() )
{
int i;
out_printf( "Using shell: " );
+1 -1
View File
@@ -265,7 +265,7 @@ void exec_cmd
fclose( f );
if ( DEBUG_EXECCMD )
if ( is_debug_execcmd() )
{
FILE * f;
char buf[ WRTLEN + 1 ] = { 0 };
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -422,7 +422,7 @@ int file_collect_archive_content_( file_archive_info_t * const archive )
offset = SARMAG;
if ( DEBUG_BINDSCAN )
if ( is_debug_bindscan() )
out_printf( "scan archive %s\n", path );
while ( ( read( fd, &ar_hdr, SARHDR ) == SARHDR ) &&
+3 -3
View File
@@ -150,7 +150,7 @@ void file_archivescan( OBJECT * path, archive_scanback func, void * closure )
void file_build1( PATHNAME * const f, string * file )
{
if ( DEBUG_SEARCH )
if ( is_debug_search() )
{
out_printf( "build file: " );
if ( f->f_root.len )
@@ -384,7 +384,7 @@ static void file_archivescan_impl( OBJECT * path, archive_scanback func, void *
/* Lazy collect the archive content information. */
if ( filelist_empty( archive->members ) )
{
if ( DEBUG_BINDSCAN )
if ( is_debug_bindscan() )
printf( "scan archive %s\n", object_str( archive->file->name ) );
if ( file_collect_archive_content_( archive ) < 0 )
return;
@@ -430,7 +430,7 @@ static void file_dirscan_impl( OBJECT * dir, scanback func, void * closure )
/* Lazy collect the directory content information. */
if ( list_empty( d->files ) )
{
if ( DEBUG_BINDSCAN )
if ( is_debug_bindscan() )
out_printf( "scan directory %s\n", object_str( d->name ) );
if ( file_collect_dir_content_( d ) < 0 )
return;
+4 -4
View File
@@ -291,7 +291,7 @@ int file_collect_archive_content_( file_archive_info_t * const archive )
offset = SARMAG;
if ( DEBUG_BINDSCAN )
if ( is_debug_bindscan() )
out_printf( "scan archive %s\n", path );
while ( ( read( fd, &ar_hdr, SARHDR ) == SARHDR ) &&
@@ -349,7 +349,7 @@ int file_collect_archive_content_( file_archive_info_t * const archive )
while ( ( *++c != ' ' ) && ( *c != '/' ) );
*c = '\0';
if ( DEBUG_BINDSCAN )
if ( is_debug_bindscan() )
out_printf( "archive name %s found\n", lar_name );
auto name = b2::value::format( "%s", lar_name );
@@ -399,7 +399,7 @@ static void collect_archive_content_small( int fd, file_archive_info_t * const a
sscanf( fl_hdr.fl_fstmoff, "%ld", &offset );
if ( DEBUG_BINDSCAN )
if ( is_debug_bindscan() )
out_printf( "scan archive %s\n", path );
while ( offset > 0 && lseek( fd, offset, 0 ) >= 0 &&
@@ -454,7 +454,7 @@ static void collect_archive_content_big( int fd, file_archive_info_t * const arc
sscanf( fl_hdr.fl_fstmoff, "%lld", &offset );
if ( DEBUG_BINDSCAN )
if ( is_debug_bindscan() )
out_printf( "scan archive %s\n", path );
while ( offset > 0 && lseek( fd, offset, 0 ) >= 0 &&
+1 -1
View File
@@ -345,7 +345,7 @@ void file_archscan( char const * arch, scanback func, void * closure )
if ( filelist_empty( archive->members ) )
{
if ( DEBUG_BINDSCAN )
if ( is_debug_bindscan() )
out_printf( "scan archive %s\n", object_str( archive->file->name ) );
if ( file_collect_archive_content_( archive ) < 0 )
+1 -1
View File
@@ -4194,7 +4194,7 @@ LIST * function_execute_write_file(
char const * out = object_str( list_front( filename.inner ) );
OBJECT * tmp_filename = nullptr;
FILE * out_file = nullptr;
bool out_debug = DEBUG_EXEC != 0;
bool out_debug = is_debug_exec();
/* For stdout/stderr we will create a temp file and generate a
* command that outputs the content as needed.
+6 -6
View File
@@ -153,7 +153,7 @@ HASHDATA * hash_insert( struct hash * hp, OBJECT * key, int32_t * found )
#ifdef HASH_DEBUG_PROFILE
profile_frame prof[ 1 ];
if ( DEBUG_PROFILE )
if ( is_debug_profile() )
profile_enter( 0, prof );
#endif
@@ -186,7 +186,7 @@ HASHDATA * hash_insert( struct hash * hp, OBJECT * key, int32_t * found )
}
#ifdef HASH_DEBUG_PROFILE
if ( DEBUG_PROFILE )
if ( is_debug_profile() )
profile_exit( prof );
#endif
@@ -205,14 +205,14 @@ HASHDATA * hash_find( struct hash * hp, OBJECT * key )
#ifdef HASH_DEBUG_PROFILE
profile_frame prof[ 1 ];
if ( DEBUG_PROFILE )
if ( is_debug_profile() )
profile_enter( 0, prof );
#endif
if ( !hp->items.nel )
{
#ifdef HASH_DEBUG_PROFILE
if ( DEBUG_PROFILE )
if ( is_debug_profile() )
profile_exit( prof );
#endif
return 0;
@@ -221,7 +221,7 @@ HASHDATA * hash_find( struct hash * hp, OBJECT * key )
i = hash_search( hp, keyval, key, 0 );
#ifdef HASH_DEBUG_PROFILE
if ( DEBUG_PROFILE )
if ( is_debug_profile() )
profile_exit( prof );
#endif
@@ -388,7 +388,7 @@ void hashdone( struct hash * hp )
{
if ( !hp )
return;
if ( DEBUG_MEM || DEBUG_PROFILE )
if ( is_debug_mem() || is_debug_profile() )
hashstat( hp );
hash_free( hp );
}
+5 -5
View File
@@ -342,7 +342,7 @@ cleanup:
goto bail;
}
if ( DEBUG_HEADER )
if ( is_debug_header() )
out_printf( "hcache read from file %s\n", hcachename );
bail:
@@ -409,7 +409,7 @@ void hcache_done()
}
write_netstring( f, "%s", CACHE_RECORD_END );
if ( DEBUG_HEADER )
if ( is_debug_header() )
out_printf( "hcache written to %s. %d dependencies, %.0f%% hit rate\n",
hcachename, header_count, queries ? 100.0 * hits / queries : 0 );
@@ -458,7 +458,7 @@ LIST * hcache( TARGET * t, int rec, b2::regex::program re[], LIST * hdrscan )
}
if ( iter1 != end1 || iter2 != end2 )
{
if ( DEBUG_HEADER )
if ( is_debug_header() )
{
out_printf( "HDRSCAN out of date in cache for %s\n",
object_str( t->boundname ) );
@@ -476,7 +476,7 @@ LIST * hcache( TARGET * t, int rec, b2::regex::program re[], LIST * hdrscan )
}
else
{
if ( DEBUG_HEADER )
if ( is_debug_header() )
out_printf( "using header cache for %s\n", object_str(
t->boundname ) );
c->age = 0;
@@ -486,7 +486,7 @@ LIST * hcache( TARGET * t, int rec, b2::regex::program re[], LIST * hdrscan )
}
else
{
if ( DEBUG_HEADER )
if ( is_debug_header() )
out_printf ("header cache out of date for %s\n", object_str(
t->boundname ) );
list_free( c->includes );
+3 -3
View File
@@ -73,7 +73,7 @@ void macro_headers( TARGET * t )
FILE * f;
char buf[ 1024 ];
if ( DEBUG_HEADER )
if ( is_debug_header() )
out_printf( "macro header scan for %s\n", object_str( t->name ) );
if ( !( f = fopen( object_str( t->boundname ), "r" ) ) )
@@ -97,7 +97,7 @@ void macro_headers( TARGET * t )
std::string macro(re_i[1].begin(), re_i[1].end());
std::string filename(re_i[2].begin(), re_i[2].end());
if ( DEBUG_HEADER )
if ( is_debug_header() )
out_printf( "macro '%s' used to define filename '%s' in '%s'\n",
macro.c_str(), filename.c_str(), object_str( t->boundname )
);
@@ -132,7 +132,7 @@ OBJECT * macro_header_get( OBJECT * macro_name )
if ( header_macros_hash && ( v = (HEADER_MACRO *)hash_find(
header_macros_hash, macro_name ) ) )
{
if ( DEBUG_HEADER )
if ( is_debug_header() )
out_printf( "### macro '%s' evaluated to '%s'\n", object_str( macro_name
), object_str( v->filename ) );
return v->filename;
+6 -6
View File
@@ -71,7 +71,7 @@ void headers( TARGET * t )
if ( list_empty( hdrrule ) )
return;
if ( DEBUG_HEADER )
if ( is_debug_header() )
out_printf( "header scan %s\n", object_str( t->name ) );
/* Compile all regular expressions in HDRSCAN */
@@ -128,7 +128,7 @@ LIST * headers1( LIST * l, OBJECT * file, int rec, b2::regex::program re[] )
#ifdef OPT_IMPROVED_PATIENCE_EXT
static int count = 0;
++count;
if ( ( ( count == 100 ) || !( count % 1000 ) ) && DEBUG_MAKE )
if ( ( ( count == 100 ) || !( count % 1000 ) ) && is_debug_make() )
{
out_printf( "...patience...\n" );
out_flush();
@@ -158,7 +158,7 @@ LIST * headers1( LIST * l, OBJECT * file, int rec, b2::regex::program re[] )
if ( re_i && re_i[ 1 ].begin() )
{
std::string header(re_i[ 1 ].begin(), re_i[ 1 ].end());
if ( DEBUG_HEADER )
if ( is_debug_header() )
out_printf( "header found: %s\n", header.c_str() );
l = list_push_back( l, object_new( header.c_str() ) );
}
@@ -170,21 +170,21 @@ LIST * headers1( LIST * l, OBJECT * file, int rec, b2::regex::program re[] )
{
std::string macro_name(re_macros_i[ 1 ].begin(), re_macros_i[ 1 ].end());
if ( DEBUG_HEADER )
if ( is_debug_header() )
out_printf( "macro header found: %s", macro_name.c_str() );
b2::value_ref macro_name_v(macro_name);
b2::value_ref header_filename_v(macro_header_get( macro_name_v ));
if ( header_filename_v.has_value() )
{
if ( DEBUG_HEADER )
if ( is_debug_header() )
out_printf( " resolved to '%s'\n", header_filename_v->str()
);
l = list_push_back( l, header_filename_v );
}
else
{
if ( DEBUG_HEADER )
if ( is_debug_header() )
out_printf( " ignored !!\n" );
}
}
+517 -508
View File
File diff suppressed because it is too large Load Diff
+268 -254
View File
@@ -29,15 +29,15 @@
#ifdef VMS
#include <types.h>
#include <ctype.h>
#include <file.h>
#include <signal.h>
#include <stat.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <time.h>
#include <types.h>
#include <unistd.h>
#include <unixlib.h>
@@ -45,7 +45,7 @@
#define OSMAJOR "VMS=true"
#define OS_VMS
#define MAXLINE 1024 /* longest 'together' actions */
#define PATH_DELIM '/' /* use CRTL POSIX-style handling */
#define PATH_DELIM '/' /* use CRTL POSIX-style handling */
#define SPLITPATH ','
#define EXITOK EXIT_SUCCESS
#define EXITBAD EXIT_FAILURE
@@ -56,7 +56,7 @@
#define OSPLAT "OSPLAT=VAX"
#endif
#define glob jam_glob /* use jam's glob, not CRTL's */
#define glob jam_glob /* use jam's glob, not CRTL's */
#endif
@@ -70,11 +70,11 @@
#include <fcntl.h>
#include <malloc.h>
#ifndef __MWERKS__
#include <memory.h>
#include <memory.h>
#endif
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <time.h>
@@ -82,7 +82,7 @@
#define OSMINOR "OS=NT"
#define OS_NT
#define SPLITPATH ';'
#define MAXLINE (undefined__see_execnt_c) /* max chars per command line */
#define MAXLINE (undefined__see_execnt_c) /* max chars per command line */
#define USE_EXECNT
#define USE_PATHNT
#define PATH_DELIM '\\'
@@ -90,21 +90,20 @@
/* AS400 cross-compile from NT. */
#ifdef AS400
#undef OSMINOR
#undef OSMAJOR
#define OSMAJOR "AS400=true"
#define OSMINOR "OS=AS400"
#define OS_AS400
#undef OSMINOR
#undef OSMAJOR
#define OSMAJOR "AS400=true"
#define OSMINOR "OS=AS400"
#define OS_AS400
#endif
/* Metrowerks Standard Library on Windows. */
#ifdef __MSL__
#undef HAVE_POPEN
#undef HAVE_POPEN
#endif
#endif /* #ifdef NT */
#endif /* #ifdef NT */
/*
* Windows MingW32
@@ -112,13 +111,13 @@
#ifdef MINGW
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <fcntl.h>
#include <malloc.h>
#include <memory.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
@@ -126,13 +125,12 @@
#define OSMINOR "OS=MINGW"
#define OS_NT
#define SPLITPATH ';'
#define MAXLINE 996 /* max chars per command line */
#define MAXLINE 996 /* max chars per command line */
#define USE_EXECUNIX
#define USE_PATHNT
#define PATH_DELIM '\\'
#endif /* #ifdef MINGW */
#endif /* #ifdef MINGW */
/*
* God fearing UNIX.
@@ -147,193 +145,191 @@
#define PATH_DELIM '/'
#ifdef _AIX
#ifndef unix
#define unix
#endif
#define MAXLINE 23552 /* 24k - 1k, max chars per command line */
#define OSMINOR "OS=AIX"
#define OS_AIX
#define NO_VFORK
#define unix
#define MAXLINE 23552 /* 24k - 1k, max chars per command line */
#define OSMINOR "OS=AIX"
#define OS_AIX
#define NO_VFORK
#endif
#ifdef AMIGA
#define OSMINOR "OS=AMIGA"
#define OS_AMIGA
#define OSMINOR "OS=AMIGA"
#define OS_AMIGA
#endif
#ifdef __BEOS__
#define unix
#define OSMINOR "OS=BEOS"
#define OS_BEOS
#define NO_VFORK
#define unix
#define OSMINOR "OS=BEOS"
#define OS_BEOS
#define NO_VFORK
#endif
#ifdef __bsdi__
#define OSMINOR "OS=BSDI"
#define OS_BSDI
#define OSMINOR "OS=BSDI"
#define OS_BSDI
#endif
#if defined (COHERENT) && defined (_I386)
#define OSMINOR "OS=COHERENT"
#define OS_COHERENT
#define NO_VFORK
#if defined(COHERENT) && defined(_I386)
#define OSMINOR "OS=COHERENT"
#define OS_COHERENT
#define NO_VFORK
#endif
#if defined(__cygwin__) || defined(__CYGWIN__)
#define OSMINOR "OS=CYGWIN"
#define OS_CYGWIN
#define OSMINOR "OS=CYGWIN"
#define OS_CYGWIN
#endif
#if defined(__FreeBSD__) && !defined(__DragonFly__)
#define OSMINOR "OS=FREEBSD"
#define OS_FREEBSD
#define OSMINOR "OS=FREEBSD"
#define OS_FREEBSD
#endif
#ifdef __DragonFly__
#define OSMINOR "OS=DRAGONFLYBSD"
#define OS_DRAGONFLYBSD
#define OSMINOR "OS=DRAGONFLYBSD"
#define OS_DRAGONFLYBSD
#endif
#ifdef __DGUX__
#define OSMINOR "OS=DGUX"
#define OS_DGUX
#define OSMINOR "OS=DGUX"
#define OS_DGUX
#endif
#ifdef __GNU__
#define OSMINOR "OS=HURD"
#define OS_HURD
#define OSMINOR "OS=HURD"
#define OS_HURD
#endif
#ifdef __hpux
#define OSMINOR "OS=HPUX"
#define OS_HPUX
#define OSMINOR "OS=HPUX"
#define OS_HPUX
#endif
#ifdef __HAIKU__
#define unix
#define OSMINOR "OS=HAIKU"
#define OS_HAIKU
#define unix
#define OSMINOR "OS=HAIKU"
#define OS_HAIKU
#endif
#ifdef __OPENNT
#define unix
#define OSMINOR "OS=INTERIX"
#define OS_INTERIX
#define NO_VFORK
#define unix
#define OSMINOR "OS=INTERIX"
#define OS_INTERIX
#define NO_VFORK
#endif
#ifdef __sgi
#define OSMINOR "OS=IRIX"
#define OS_IRIX
#define NO_VFORK
#define OSMINOR "OS=IRIX"
#define OS_IRIX
#define NO_VFORK
#endif
#ifdef __ISC
#define OSMINOR "OS=ISC"
#define OS_ISC
#define NO_VFORK
#define OSMINOR "OS=ISC"
#define OS_ISC
#define NO_VFORK
#endif
#if defined(linux) || defined(__linux) || \
defined(__linux__) || defined(__gnu_linux__)
#define OSMINOR "OS=LINUX"
#define OS_LINUX
#if defined(linux) || defined(__linux) || defined(__linux__) \
|| defined(__gnu_linux__)
#define OSMINOR "OS=LINUX"
#define OS_LINUX
#endif
#ifdef __Lynx__
#define OSMINOR "OS=LYNX"
#define OS_LYNX
#define NO_VFORK
#define unix
#define OSMINOR "OS=LYNX"
#define OS_LYNX
#define NO_VFORK
#define unix
#endif
#ifdef __MACHTEN__
#define OSMINOR "OS=MACHTEN"
#define OS_MACHTEN
#define OSMINOR "OS=MACHTEN"
#define OS_MACHTEN
#endif
#ifdef mpeix
#define unix
#define OSMINOR "OS=MPEIX"
#define OS_MPEIX
#define NO_VFORK
#define unix
#define OSMINOR "OS=MPEIX"
#define OS_MPEIX
#define NO_VFORK
#endif
#ifdef __MVS__
#define unix
#define OSMINOR "OS=MVS"
#define OS_MVS
#define unix
#define OSMINOR "OS=MVS"
#define OS_MVS
#endif
#ifdef _ATT4
#define OSMINOR "OS=NCR"
#define OS_NCR
#define OSMINOR "OS=NCR"
#define OS_NCR
#endif
#ifdef __NetBSD__
#define unix
#define OSMINOR "OS=NETBSD"
#define OS_NETBSD
#define NO_VFORK
#define unix
#define OSMINOR "OS=NETBSD"
#define OS_NETBSD
#define NO_VFORK
#endif
#ifdef __QNX__
#define unix
#ifdef __QNXNTO__
#define OSMINOR "OS=QNXNTO"
#define OS_QNXNTO
#else
#define OSMINOR "OS=QNX"
#define OS_QNX
#define NO_VFORK
#define MAXLINE 996 /* max chars per command line */
#endif
#define unix
#ifdef __QNXNTO__
#define OSMINOR "OS=QNXNTO"
#define OS_QNXNTO
#else
#define OSMINOR "OS=QNX"
#define OS_QNX
#define NO_VFORK
#define MAXLINE 996 /* max chars per command line */
#endif
#endif
#ifdef NeXT
#ifdef __APPLE__
#define OSMINOR "OS=RHAPSODY"
#define OS_RHAPSODY
#else
#define OSMINOR "OS=NEXT"
#define OS_NEXT
#endif
#ifdef __APPLE__
#define OSMINOR "OS=RHAPSODY"
#define OS_RHAPSODY
#else
#define OSMINOR "OS=NEXT"
#define OS_NEXT
#endif
#endif
#ifdef __APPLE__
#define unix
#define OSMINOR "OS=MACOSX"
#define OS_MACOSX
#define unix
#define OSMINOR "OS=MACOSX"
#define OS_MACOSX
#endif
#ifdef __osf__
#ifndef unix
#define unix
#endif
#define OSMINOR "OS=OSF"
#define OS_OSF
#ifndef unix
#define unix
#endif
#define OSMINOR "OS=OSF"
#define OS_OSF
#endif
#ifdef _SEQUENT_
#define OSMINOR "OS=PTX"
#define OS_PTX
#define OSMINOR "OS=PTX"
#define OS_PTX
#endif
#ifdef M_XENIX
#define OSMINOR "OS=SCO"
#define OS_SCO
#define NO_VFORK
#define OSMINOR "OS=SCO"
#define OS_SCO
#define NO_VFORK
#endif
#ifdef sinix
#define unix
#define OSMINOR "OS=SINIX"
#define OS_SINIX
#define unix
#define OSMINOR "OS=SINIX"
#define OS_SINIX
#endif
#if defined(__svr4__) || defined(__SVR4)
#define OSMINOR "OS=SOLARIS"
#define OS_SOLARIS
#define OSMINOR "OS=SOLARIS"
#define OS_SOLARIS
#elif defined(__sun__) || defined(__sun) || defined(sun)
#define OSMINOR "OS=SUNOS"
#define OS_SUNOS
#define OSMINOR "OS=SUNOS"
#define OS_SUNOS
#endif
#ifdef ultrix
#define OSMINOR "OS=ULTRIX"
#define OS_ULTRIX
#define OSMINOR "OS=ULTRIX"
#define OS_ULTRIX
#endif
#ifdef _UNICOS
#define OSMINOR "OS=UNICOS"
#define OS_UNICOS
#define OSMINOR "OS=UNICOS"
#define OS_UNICOS
#endif
#if defined(__USLC__) && !defined(M_XENIX)
#define OSMINOR "OS=UNIXWARE"
#define OS_UNIXWARE
#define OSMINOR "OS=UNIXWARE"
#define OS_UNIXWARE
#endif
#ifdef __OpenBSD__
#define OSMINOR "OS=OPENBSD"
#define OS_OPENBSD
#ifndef unix
#define unix
#endif
#define OSMINOR "OS=OPENBSD"
#define OS_OPENBSD
#ifndef unix
#define unix
#endif
#if defined (__FreeBSD_kernel__) && !defined(__FreeBSD__)
#define OSMINOR "OS=KFREEBSD"
#define OS_KFREEBSD
#endif
#if defined(__FreeBSD_kernel__) && !defined(__FreeBSD__)
#define OSMINOR "OS=KFREEBSD"
#define OS_KFREEBSD
#endif
#ifndef OSMINOR
#define OSMINOR "OS=UNKNOWN"
#define OSMINOR "OS=UNKNOWN"
#endif
/* All the UNIX includes */
@@ -341,199 +337,217 @@
#include <sys/types.h>
#ifndef OS_MPEIX
#include <sys/file.h>
#include <sys/file.h>
#endif
#include <fcntl.h>
#include <stdio.h>
#include <ctype.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#ifndef OS_QNX
#include <memory.h>
#include <memory.h>
#endif
#ifndef OS_ULTRIX
#include <stdlib.h>
#include <stdlib.h>
#endif
#if !defined( OS_BSDI ) && \
!defined( OS_FREEBSD ) && \
!defined( OS_DRAGONFLYBSD ) && \
!defined( OS_NEXT ) && \
!defined( OS_MACHTEN ) && \
!defined( OS_MACOSX ) && \
!defined( OS_RHAPSODY ) && \
!defined( OS_MVS ) && \
!defined( OS_OPENBSD )
#include <malloc.h>
#if !defined(OS_BSDI) && !defined(OS_FREEBSD) && !defined(OS_DRAGONFLYBSD) \
&& !defined(OS_NEXT) && !defined(OS_MACHTEN) && !defined(OS_MACOSX) \
&& !defined(OS_RHAPSODY) && !defined(OS_MVS) && !defined(OS_OPENBSD)
#include <malloc.h>
#endif
#endif /* #ifndef OSMINOR */
#endif /* #ifndef OSMINOR */
/*
* OSPLAT definitions - suppressed when it is a one-of-a-kind.
*/
#if defined( _M_PPC ) || \
defined( PPC ) || \
defined( ppc ) || \
defined( __powerpc__ ) || \
defined( __ppc__ )
#define OSPLAT "OSPLAT=PPC"
#if defined(_M_PPC) || defined(PPC) || defined(ppc) || defined(__powerpc__) \
|| defined(__ppc__)
#define OSPLAT "OSPLAT=PPC"
#endif
#if defined( _ALPHA_ ) || \
defined( __alpha__ )
#define OSPLAT "OSPLAT=AXP"
#if defined(_ALPHA_) || defined(__alpha__)
#define OSPLAT "OSPLAT=AXP"
#endif
#if defined( _i386_ ) || \
defined( __i386__ ) || \
defined( __i386 ) || \
defined( _M_IX86 )
#define OSPLAT "OSPLAT=X86"
#if defined(_i386_) || defined(__i386__) || defined(__i386) || defined(_M_IX86)
#define OSPLAT "OSPLAT=X86"
#endif
#if defined( __ia64__ ) || \
defined( __IA64__ ) || \
defined( __ia64 )
#define OSPLAT "OSPLAT=IA64"
#if defined(__ia64__) || defined(__IA64__) || defined(__ia64)
#define OSPLAT "OSPLAT=IA64"
#endif
#if defined( __x86_64__ ) || \
defined( __amd64__ ) || \
defined( _M_AMD64 )
#define OSPLAT "OSPLAT=X86_64"
#if defined(__x86_64__) || defined(__amd64__) || defined(_M_AMD64)
#define OSPLAT "OSPLAT=X86_64"
#endif
#if defined( __sparc__ ) || \
defined( __sparc )
#define OSPLAT "OSPLAT=SPARC"
#if defined(__sparc__) || defined(__sparc)
#define OSPLAT "OSPLAT=SPARC"
#endif
#ifdef __mips__
#if _MIPS_SIM == _MIPS_SIM_ABI64
#define OSPLAT "OSPLAT=MIPS64"
#elif _MIPS_SIM == _MIPS_SIM_ABI32
#define OSPLAT "OSPLAT=MIPS32"
#endif
#if _MIPS_SIM == _MIPS_SIM_ABI64
#define OSPLAT "OSPLAT=MIPS64"
#elif _MIPS_SIM == _MIPS_SIM_ABI32
#define OSPLAT "OSPLAT=MIPS32"
#endif
#endif
#if defined( __arm__ ) || \
defined( _M_ARM )
#define OSPLAT "OSPLAT=ARM"
#if defined(__arm__) || defined(_M_ARM)
#define OSPLAT "OSPLAT=ARM"
#endif
#if defined( __aarch64__ ) || \
defined( _M_ARM64 )
#define OSPLAT "OSPLAT=ARM64"
#if defined(__aarch64__) || defined(_M_ARM64)
#define OSPLAT "OSPLAT=ARM64"
#endif
#ifdef __s390__
#define OSPLAT "OSPLAT=390"
#define OSPLAT "OSPLAT=390"
#endif
#ifdef __hppa
#define OSPLAT "OSPLAT=PARISC"
#define OSPLAT "OSPLAT=PARISC"
#endif
#if defined( __riscv ) || defined( __riscv__ )
#if __riscv_xlen == 64
#define OSPLAT "OSPLAT=RISCV64"
#elif __riscv_xlen == 32
#define OSPLAT "OSPLAT=RISCV32"
#endif
#if defined(__riscv) || defined(__riscv__)
#if __riscv_xlen == 64
#define OSPLAT "OSPLAT=RISCV64"
#elif __riscv_xlen == 32
#define OSPLAT "OSPLAT=RISCV32"
#endif
#endif
#ifndef OSPLAT
#define OSPLAT ""
#define OSPLAT ""
#endif
/*
* Jam implementation misc.
*/
#ifndef MAXLINE
#define MAXLINE 102400 /* max chars per command line */
#define MAXLINE 102400 /* max chars per command line */
#endif
#ifndef EXITOK
#define EXITOK 0
#define EXITBAD 1
#define EXITOK 0
#define EXITBAD 1
#endif
#ifndef SPLITPATH
#define SPLITPATH ':'
#define SPLITPATH ':'
#endif
/* You probably do not need to muck with these. */
#define MAXSYM 1024 /* longest symbol in the environment */
#define MAXJPATH 1024 /* longest filename */
#define MAXSYM 1024 /* longest symbol in the environment */
#define MAXJPATH 1024 /* longest filename */
#define MAXARGC 32 /* words in $(JAMSHELL) */
#define MAXARGC 32 /* words in $(JAMSHELL) */
/* Jam private definitions below. */
#define DEBUG_MAX 14
#define DEBUG_MAX 14
struct globs
struct global_config
{
int noexec;
int jobs;
int quitquick;
int newestfirst; /* build newest sources first */
int pipe_action;
char debug[ DEBUG_MAX ];
FILE * out; /* mirror output here */
long timeout; /* number of seconds to limit actions to,
* default 0 for no limit.
*/
int dart; /* output build and test results formatted for
* Dart
*/
int max_buf; /* maximum amount of output saved from target
* (kb)
*/
// Do not execute actions.
bool noexec = false;
// Build all targets.
bool anyhow = false;
// Max number of parallel jobs/actions.
int jobs = 1;
// Abort building on first fail occurrence.
bool quitquick = false;
// Build newest sources first.
bool newestfirst = false;
// Where to send the output streams.
int pipe_action = 0;
// If a debug level flag was given.
bool debug_flag_used = false;
// Debug level flags.
bool debug[DEBUG_MAX] = { false, true };
// Mirror output here
FILE * out = nullptr;
// Number of seconds to limit actions to, default 0 for no limit.
long timeout = 0;
// Maximum amount of output saved from target (kb)
int max_buf = 0;
// Is behaving as a debugger.
bool is_debugger = false;
// Debugger interface.
enum : char
{
debug_interface_no = 0,
debug_interface_console,
debug_interface_mi,
debug_interface_child
} debug_interface = debug_interface_no;
// Print out information on configuration actions.
bool debug_configuration = false;
// Show help output instead of building.
bool display_help = false;
void out_print() const;
};
extern struct globs globs;
extern global_config globs;
extern int anyhow;
/* show actions when executed */
inline bool is_debug_make() { return globs.debug[1]; }
/* show even quiet actions */
inline bool is_debug_makeq() { return globs.debug[2]; }
/* show text of actions */
inline bool is_debug_exec() { return globs.debug[2]; }
/* show make0 progress */
inline bool is_debug_makeprog() { return globs.debug[3]; }
/* show when files bound */
inline bool is_debug_bind() { return globs.debug[3]; }
#define DEBUG_MAKE ( globs.debug[ 1 ] ) /* show actions when executed */
#define DEBUG_MAKEQ ( globs.debug[ 2 ] ) /* show even quiet actions */
#define DEBUG_EXEC ( globs.debug[ 2 ] ) /* show text of actons */
#define DEBUG_MAKEPROG ( globs.debug[ 3 ] ) /* show make0 progress */
#define DEBUG_BIND ( globs.debug[ 3 ] ) /* show when files bound */
/* show execcmds()'s work */
inline bool is_debug_execcmd() { return globs.debug[4]; }
#define DEBUG_EXECCMD ( globs.debug[ 4 ] ) /* show execcmds()'s work */
/* show rule invocations */
inline bool is_debug_compile() { return globs.debug[5]; }
#define DEBUG_COMPILE ( globs.debug[ 5 ] ) /* show rule invocations */
/* show result of header scan */
inline bool is_debug_header() { return globs.debug[6]; }
/* show result of dir scan */
inline bool is_debug_bindscan() { return globs.debug[6]; }
/* show binding attempts */
inline bool is_debug_search() { return globs.debug[6]; }
#define DEBUG_HEADER ( globs.debug[ 6 ] ) /* show result of header scan */
#define DEBUG_BINDSCAN ( globs.debug[ 6 ] ) /* show result of dir scan */
#define DEBUG_SEARCH ( globs.debug[ 6 ] ) /* show binding attempts */
/* show variable settings */
inline bool is_debug_varset() { return globs.debug[7]; }
/* show variable fetches */
inline bool is_debug_varget() { return globs.debug[8]; }
/* show variable expansions */
inline bool is_debug_varexp() { return globs.debug[8]; }
/* show 'if' calculations */
inline bool is_debug_if() { return globs.debug[8]; }
/* show list manipulation */
inline bool is_debug_lists() { return globs.debug[9]; }
/* show scanner tokens */
inline bool is_debug_scan() { return globs.debug[9]; }
/* show memory use */
inline bool is_debug_mem() { return globs.debug[9]; }
#define DEBUG_VARSET ( globs.debug[ 7 ] ) /* show variable settings */
#define DEBUG_VARGET ( globs.debug[ 8 ] ) /* show variable fetches */
#define DEBUG_VAREXP ( globs.debug[ 8 ] ) /* show variable expansions */
#define DEBUG_IF ( globs.debug[ 8 ] ) /* show 'if' calculations */
#define DEBUG_LISTS ( globs.debug[ 9 ] ) /* show list manipulation */
#define DEBUG_SCAN ( globs.debug[ 9 ] ) /* show scanner tokens */
#define DEBUG_MEM ( globs.debug[ 9 ] ) /* show memory use */
#define DEBUG_PROFILE ( globs.debug[ 10 ] ) /* dump rule execution times */
#define DEBUG_PARSE ( globs.debug[ 11 ] ) /* debug parsing */
#define DEBUG_GRAPH ( globs.debug[ 12 ] ) /* debug dependencies */
#define DEBUG_FATE ( globs.debug[ 13 ] ) /* show fate changes in make0() */
/* dump rule execution times */
inline bool is_debug_profile() { return globs.debug[10]; }
/* debug parsing */
inline bool is_debug_parse() { return globs.debug[11]; }
/* debug dependencies */
inline bool is_debug_graph() { return globs.debug[12]; }
/* show fate changes in make0() */
inline bool is_debug_fate() { return globs.debug[13]; }
/* Everyone gets the memory definitions. */
#include "mem.h"
+1 -1
View File
@@ -95,7 +95,7 @@ LIST * list_push_back(LIST * head, OBJECT * value)
{
int32_t size = list_length(head);
if (DEBUG_LISTS) out_printf("list > %s <\n", object_str(value));
if (is_debug_lists()) out_printf("list > %s <\n", object_str(value));
/* If the size is a power of 2, reallocate. */
if (size == 0)
+15 -15
View File
@@ -92,7 +92,7 @@ static char const * target_bind[] =
* make() - make a target, given its name.
*/
int32_t make( LIST * targets, int32_t anyhow )
int32_t make( LIST * targets, bool anyhow )
{
COUNTS counts[ 1 ];
int32_t status = 0; /* 1 if anything fails */
@@ -125,7 +125,7 @@ int32_t make( LIST * targets, int32_t anyhow )
}
#ifdef OPT_GRAPH_DEBUG_EXT
if ( DEBUG_GRAPH )
if ( is_debug_graph() )
{
LISTITER iter, end;
for ( iter = list_begin( targets ), end = list_end( targets ); iter != end; iter = list_next( iter ) )
@@ -133,7 +133,7 @@ int32_t make( LIST * targets, int32_t anyhow )
}
#endif
if ( DEBUG_MAKE )
if ( is_debug_make() )
{
if ( counts->targets )
out_printf( "...found %d target%s...\n", counts->targets,
@@ -186,7 +186,7 @@ static void update_dependants( TARGET * t )
{
p->fate = T_FATE_UPDATE;
if ( DEBUG_FATE )
if ( is_debug_fate() )
{
out_printf( "fate change %s from %s to %s (as dependent of %s)\n",
object_str( p->name ), target_fate[ (int32_t) fate0 ], target_fate[ (int32_t) p->fate ], object_str( t->name ) );
@@ -218,7 +218,7 @@ static void force_rebuilds( TARGET * t )
/* If it is not already being rebuilt for other reasons. */
if ( r->fate < T_FATE_BUILD )
{
if ( DEBUG_FATE )
if ( is_debug_fate() )
out_printf( "fate change %s from %s to %s (by rebuild)\n",
object_str( r->name ), target_fate[ (int32_t) r->fate ], target_fate[ T_FATE_REBUILD ] );
@@ -284,7 +284,7 @@ void make0
TARGET * p, /* parent */
int32_t depth, /* for display purposes */
COUNTS * counts, /* for reporting */
int32_t anyhow,
bool anyhow,
TARGET * rescanning
) /* forcibly touch all (real) targets */
{
@@ -303,14 +303,14 @@ void make0
int32_t oldTimeStamp;
#endif
if ( DEBUG_MAKEPROG )
if ( is_debug_makeprog() )
out_printf( "make\t--\t%s%s\n", spaces( depth ), object_str( t->name ) );
/*
* Step 1: Initialize.
*/
if ( DEBUG_MAKEPROG )
if ( is_debug_makeprog() )
out_printf( "make\t--\t%s%s\n", spaces( depth ), object_str( t->name ) );
t->fate = T_FATE_MAKING;
@@ -381,7 +381,7 @@ void make0
* Pause for a little progress reporting.
*/
if ( DEBUG_BIND )
if ( is_debug_bind() )
{
if ( !object_equal( t->name, t->boundname ) )
out_printf( "bind\t--\t%s%s: %s\n", spaces( depth ),
@@ -510,7 +510,7 @@ void make0
fate = max( fate, c->target->fate );
#ifdef OPT_GRAPH_DEBUG_EXT
if ( DEBUG_FATE )
if ( is_debug_fate() )
if ( fate < c->target->fate )
out_printf( "fate change %s from %s to %s by dependency %s\n",
object_str( t->name ), target_fate[ (int32_t)fate ],
@@ -539,7 +539,7 @@ void make0
if ( t->flags & T_FLAG_NOUPDATE )
{
#ifdef OPT_GRAPH_DEBUG_EXT
if ( DEBUG_FATE )
if ( is_debug_fate() )
if ( fate != T_FATE_STABLE )
out_printf( "fate change %s back to stable, NOUPDATE.\n",
object_str( t->name ) );
@@ -636,7 +636,7 @@ void make0
fate = T_FATE_STABLE;
}
#ifdef OPT_GRAPH_DEBUG_EXT
if ( DEBUG_FATE && ( fate != savedFate ) )
if ( is_debug_fate() && ( fate != savedFate ) )
{
if ( savedFate == T_FATE_STABLE )
out_printf( "fate change %s set to %s%s\n", object_str( t->name ),
@@ -659,7 +659,7 @@ void make0
if ( t->flags & T_FLAG_NOCARE )
{
#ifdef OPT_GRAPH_DEBUG_EXT
if ( DEBUG_FATE )
if ( is_debug_fate() )
out_printf( "fate change %s to STABLE from %s, "
"no actions, no dependencies and do not care\n",
object_str( t->name ), target_fate[ fate ] );
@@ -736,7 +736,7 @@ void make0
#ifdef OPT_IMPROVED_PATIENCE_EXT
++counts->targets;
#else
if ( !( ++counts->targets % 1000 ) && DEBUG_MAKE )
if ( !( ++counts->targets % 1000 ) && is_debug_make() )
{
out_printf( "...patience...\n" );
out_flush();
@@ -760,7 +760,7 @@ void make0
&p->time ) > 0 )
flag = "*";
if ( DEBUG_MAKEPROG )
if ( is_debug_makeprog() )
out_printf( "made%s\t%s\t%s%s\n", flag, target_fate[ (int32_t)t->fate ],
spaces( depth ), object_str( t->name ) );
}
+4 -4
View File
@@ -16,20 +16,20 @@
#include "object.h"
#include "rules.h"
int32_t make( LIST * targets, int32_t anyhow );
int32_t make( LIST * targets, bool anyhow );
int32_t make1( LIST * t );
typedef struct {
struct COUNTS {
int32_t temp;
int32_t updating;
int32_t cantfind;
int32_t cantmake;
int32_t targets;
int32_t made;
} COUNTS ;
};
void make0( TARGET * t, TARGET * p, int32_t depth, COUNTS * counts, int32_t anyhow,
void make0( TARGET * t, TARGET * p, int32_t depth, COUNTS * counts, bool anyhow,
TARGET * rescanning );
+17 -17
View File
@@ -258,12 +258,12 @@ int32_t make1( LIST * targets )
clear_state_freelist();
/* Talk about it. */
if ( DEBUG_MAKE && counts->made )
if ( is_debug_make() && counts->made )
{
out_printf( "\n...updated %d target%s...\n", counts->made,
counts->made > 1 ? "s" : "" );
}
if ( DEBUG_MAKE && counts->skipped )
if ( is_debug_make() && counts->skipped )
{
out_printf( "\n...skipped %d target%s...\n",
make_summary->count(targets_skipped),
@@ -473,7 +473,7 @@ static void make1b( state * const pState )
break;
case T_FATE_ISTMP:
if ( DEBUG_MAKE )
if ( is_debug_make() )
out_printf( "...using %s...\n", object_str( t->name ) );
break;
@@ -490,7 +490,7 @@ static void make1b( state * const pState )
if ( t->actions )
{
++counts->total;
if ( DEBUG_MAKE && !( counts->total % 100 ) )
if ( is_debug_make() && !( counts->total % 100 ) )
out_printf( "...on %dth target...\n", counts->total );
t->cmds = (char *)make1cmds( t );
@@ -516,7 +516,7 @@ static void make1b( state * const pState )
if ( t->cmds == NULL || --( ( CMD * )t->cmds )->asynccnt == 0 )
push_state( &state_stack, t, NULL, T_STATE_MAKE1C );
else if ( DEBUG_EXECCMD )
else if ( is_debug_execcmd() )
{
CMD * cmd = ( CMD * )t->cmds;
out_printf( "Delaying %s %s: %d targets not ready\n", object_str( cmd->rule->name ), object_str( t->boundname ), cmd->asynccnt );
@@ -569,8 +569,8 @@ static void make1c( state const * const pState )
/* Increment the jobs running counter. */
++cmdsrunning;
if ( ( globs.jobs == 1 ) && ( DEBUG_MAKEQ ||
( DEBUG_MAKE && !( cmd->rule->actions->flags & RULE_QUIETLY ) ) ) )
if ( ( globs.jobs == 1 ) && ( is_debug_makeq() ||
( is_debug_make() && !( cmd->rule->actions->flags & RULE_QUIETLY ) ) ) )
{
OBJECT * action = cmd->rule->name;
OBJECT * target = list_front( lol_get( (LOL *)&cmd->args, 0 ) );
@@ -578,7 +578,7 @@ static void make1c( state const * const pState )
out_printf( "%s %s\n", object_str( action ), object_str( target ) );
/* Print out the command executed if given -d+2. */
if ( DEBUG_EXEC )
if ( is_debug_exec() )
{
out_puts( cmd->buf->value );
out_putc( '\n' );
@@ -925,8 +925,8 @@ static void make1c_closure
t->status = EXEC_CMD_OK;
}
if ( DEBUG_MAKEQ ||
( DEBUG_MAKE && !( cmd->rule->actions->flags & RULE_QUIETLY ) ) )
if ( is_debug_makeq() ||
( is_debug_make() && !( cmd->rule->actions->flags & RULE_QUIETLY ) ) )
{
rule_name = object_str( cmd->rule->name );
target_name = object_str( list_front( lol_get( (LOL *)&cmd->args, 0 ) )
@@ -949,7 +949,7 @@ static void make1c_closure
if ( !globs.noexec )
{
call_timing_rule( t, time );
if ( DEBUG_EXECCMD )
if ( is_debug_execcmd() )
out_printf( "%f sec system; %f sec user; %f sec clock\n",
time->system, time->user,
timestamp_delta_seconds(&time->start, &time->end) );
@@ -959,10 +959,10 @@ static void make1c_closure
}
/* Print command text on failure. */
if ( t->status == EXEC_CMD_FAIL && DEBUG_MAKE &&
if ( t->status == EXEC_CMD_FAIL && is_debug_make() &&
! ( t->flags & T_FLAG_FAIL_EXPECTED ) )
{
if ( !DEBUG_EXEC )
if ( !is_debug_exec() )
out_printf( "%s\n", cmd->buf->value );
out_printf( "...failed %s ", object_str( cmd->rule->name ) );
@@ -1041,7 +1041,7 @@ static void push_cmds( CMDLIST * cmds, int32_t status )
first_target->cmds = (char *)next_cmd;
push_state( &state_stack, first_target, NULL, T_STATE_MAKE1C );
}
else if ( DEBUG_EXECCMD )
else if ( is_debug_execcmd() )
{
TARGET * first_target = bindtarget( list_front( lol_get( &next_cmd->args, 0 ) ) );
out_printf( "Delaying %s %s: %d targets not ready\n", object_str( next_cmd->rule->name ), object_str( first_target->boundname ), next_cmd->asynccnt );
@@ -1494,7 +1494,7 @@ static int32_t cmd_sem_lock( TARGET * t )
{
if ( iter->target->asynccnt > 0 )
{
if ( DEBUG_EXECCMD )
if ( is_debug_execcmd() )
out_printf( "SEM: %s is busy, delaying launch of %s\n",
object_str( iter->target->name ), object_str( t->name ) );
targetentry( iter->target->parents, t );
@@ -1505,7 +1505,7 @@ static int32_t cmd_sem_lock( TARGET * t )
for ( iter = cmd->lock; iter; iter = iter->next.get() )
{
++iter->target->asynccnt;
if ( DEBUG_EXECCMD )
if ( is_debug_execcmd() )
out_printf( "SEM: %s now used by %s\n", object_str( iter->target->name
), object_str( t->name ) );
}
@@ -1524,7 +1524,7 @@ static void cmd_sem_unlock( TARGET * t )
/* Release the semaphores. */
for ( iter = cmd->unlock.get(); iter; iter = iter->next.get() )
{
if ( DEBUG_EXECCMD )
if ( is_debug_execcmd() )
out_printf( "SEM: %s is now free\n", object_str(
iter->target->name ) );
--iter->target->asynccnt;
+145
View File
@@ -0,0 +1,145 @@
/*
Copyright 2024 René Ferdinand Rivera Morell
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
*/
#include "mod_args.h"
#include "jam.h"
#include "lists.h"
#include "output.h"
#include "startup.h"
#include "value.h"
#include <memory>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>
namespace b2 { namespace args {
namespace {
struct args_reg
{
static args_reg & ref()
{
static args_reg r;
return r;
}
lyra::cli cli;
std::unique_ptr<lyra::parse_result> result;
std::unordered_map<std::string, std::shared_ptr<list_ref>> options;
std::vector<std::string> args;
bool need_reparse = true;
args_reg()
{
cli.style_print_short_first();
}
void set_args(int argc, char ** argv)
{
args.clear();
for (int i = 0; i < argc; ++i)
{
args.emplace_back(argv[i]);
}
}
void reparse()
{
need_reparse = false;
// We can call this multiple times. Hence we go back to a clean state
// on the collected values to get reproducible parsing.
result.reset();
for (auto & o : options)
{
o.second->reset();
}
result.reset(new lyra::parse_result(
cli.parse(lyra::args(args.begin(), args.end()))));
}
void add_opt(const value_ref & name,
list_cref opts,
const value_ref & help,
list_cref flags)
{
if (options.count(name) > 0) return;
need_reparse = true;
bool is_flag = false;
for (auto f : flags)
{
if (f->equal_to(*value_ref("flag"))) is_flag = true;
}
std::shared_ptr<list_ref> values = std::make_shared<list_ref>();
std::unique_ptr<lyra::opt> arg;
if (is_flag)
arg.reset(new lyra::opt([values](bool v) {
values->push_back("true");
}));
else
arg.reset(new lyra::opt(
[values](const std::string & v) { values->push_back(v); },
name->str()));
arg->help(help);
for (auto opt : opts)
{
arg->name(opt->str());
}
cli.add_argument(*arg);
options[name->str()] = values;
}
list_ref get_opt(const value_ref & name)
{
if (need_reparse) reparse();
if (options.count(name->str()) > 0) return *options[name->str()];
if (name == "help")
return globs.display_help ? list_ref("true") : list_ref();
if (name == "debug-configuration")
return globs.debug_configuration ? list_ref("true") : list_ref();
return {};
}
};
} // namespace
void add_arg(
const value_ref & name, list_cref opts, const value_ref & help, list_cref flags)
{
args_reg::ref().add_opt(name, opts, help, flags);
}
list_ref get_arg(const value_ref & name)
{
return args_reg::ref().get_opt(name);
}
void set_args(int argc, char ** argv) { args_reg::ref().set_args(argc, argv); }
lyra::cli & lyra_cli() { return args_reg::ref().cli; }
void process_args(bool silent)
{
args_reg::ref().reparse();
if (!silent && globs.display_help)
{
std::ostringstream out;
out << args_reg::ref().cli;
err_puts(out.str().c_str());
b2::clean_exit(EXITOK);
}
}
const char * args_module::init_code = R"jam(
rule __test__ ( )
{
import assert ;
}
)jam";
}} // namespace b2::args
+97
View File
@@ -0,0 +1,97 @@
/*
Copyright 2025 René Ferdinand Rivera Morell
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
*/
#ifndef B2_MOD_ARGS_H
#define B2_MOD_ARGS_H
#include "bind.h"
#include "ext_bfgroup_lyra.h"
#include "lists.h"
#include "value.h"
/* tag::reference[]
[[b2.reference.modules.args]]
= `args` module.
end::reference[] */
namespace b2 { namespace args {
/* tag::reference[]
== `b2::args::add_arg`
====
[horizontal]
Jam:: `rule add-arg ( name : opts + : help : flags * )`
{CPP}:: `void add_arg(const value_ref & name, list_cref opts, const value_ref &
help, list_cref flags);`
====
Declares a new command line argument option to accept. When specified the
argument is then available for access with `get-arg`. The `name` is a symbolic
tag, used for both retrieving the option value and for the help (`-h`)
displayed. The `opts` is a set of option names that are accepted for this
argument. Both short and long variations are valid for `opts`. The `help` is
a description of the argument printed out in the help output (`-h`). The `flags`
value can indicate definition characteristics for the argument. Accepted `flags`
are:
`flag`:: Declares this as an option that has no value. For example `--version`
as opposed to `--prefix=/some/path`.
end::reference[] */
void add_arg(const value_ref & name,
list_cref opts,
const value_ref & help,
list_cref flags);
/* tag::reference[]
== `b2::args::get_arg`
====
[horizontal]
Jam:: `rule get-arg ( name )`
{CPP}:: `list_ref get_arg(value_ref name);`
====
Retrieve the value of a previous specified command line argument.
end::reference[] */
list_ref get_arg(const value_ref & name);
void set_args(int argc, char ** argv);
lyra::cli & lyra_cli();
void process_args(bool silent = false);
struct args_module : b2::bind::module_<args_module>
{
const char * module_name = "args";
static const char * init_code;
template <class Binder>
void def(Binder & binder)
{
binder
.def(&add_arg, "add-arg",
"name" * _1 | "opts" * _1n | "help" * _1 | "flags" * _n)
.def(&get_arg, "get-arg", "name" * _1);
binder.eval(init_code);
binder.loaded();
}
};
template <typename SubType>
struct declaration_
{
declaration_() { SubType::declare_args(); }
};
}} // namespace b2::args
#endif
+26 -19
View File
@@ -10,6 +10,7 @@ Distributed under the Boost Software License, Version 1.0.
#include "cwd.h"
#include "events.h"
#include "lists.h"
#include "mod_args.h"
#include "mod_db.h"
#include "output.h"
#include "pathsys.h"
@@ -55,9 +56,9 @@ struct database
prop_db.reset(new property_db);
// Default to all targets and no regular action output.
++globs.noexec;
globs.noexec = true;
for (int i = 0; i < DEBUG_MAX; ++i) globs.debug[i] = 0;
++anyhow;
globs.anyhow = true;
// Events to track the commands and exit to generate the output.
add_event_callback(event_tag::pre_exec_cmd,
@@ -144,26 +145,32 @@ struct database
}
};
void declare_args(lyra::cli & cli)
{
cli |= lyra::opt(
[](const std::string & f) { database::get().set_output_format(f); },
"format")
.name("--command-database")
.help("Output a compile commands database as format.");
cli |= lyra::opt(
[](const std::string & f) { database::get().set_output_filename(f); },
"filename")
.name("--command-database-out")
.help(
"Filename to output the command database to. "
"A relative path for the filename is rooted to the project "
"build-dir.");
}
void set_output_dir(value_ref dirname)
{
database::get().output_directory = dirname;
}
}} // namespace b2::command_db
void b2::command_db_module::declare_args()
{
b2::args::lyra_cli()
|= lyra::opt(
[](const std::string & f) {
command_db::database::get().set_output_format(f);
},
"format")
.name("--command-database")
.help("Output a compile commands database as format.");
b2::args::lyra_cli()
|= lyra::opt(
[](const std::string & f) {
command_db::database::get().set_output_filename(f);
},
"filename")
.name("--command-database-out")
.help(
"Filename to output the command database to. "
"A relative path for the filename is rooted to the project "
"build-dir.");
}
+8 -3
View File
@@ -1,5 +1,5 @@
/*
Copyright 2024 René Ferdinand Rivera Morell
Copyright 2025 René Ferdinand Rivera Morell
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
*/
@@ -10,6 +10,7 @@ Distributed under the Boost Software License, Version 1.0.
#include "config.h"
#include "bind.h"
#include "mod_args.h"
#include "value.h"
namespace lyra {
@@ -20,13 +21,15 @@ namespace b2 {
namespace command_db {
void declare_args(lyra::cli &);
// void declare_args(lyra::cli &);
void set_output_dir(value_ref dirname);
} // namespace command_db
struct command_db_module : b2::bind::module_<command_db_module>
struct command_db_module
: b2::bind::module_<command_db_module>
, b2::args::declaration_<command_db_module>
{
const char * module_name = "command-db";
@@ -37,6 +40,8 @@ struct command_db_module : b2::bind::module_<command_db_module>
&command_db::set_output_dir, "set-output-dir", ("dirname" * _1));
binder.loaded();
}
static void declare_args();
};
} // namespace b2
+2 -2
View File
@@ -202,7 +202,7 @@ static void stat_module( void * xmodule, void * data )
{
module_t *m = (module_t *)xmodule;
if ( DEBUG_MEM || DEBUG_PROFILE )
if ( is_debug_mem() || is_debug_profile() )
{
struct hash * class_info = (struct hash *)data;
if ( m->class_module )
@@ -259,7 +259,7 @@ void modules_done()
{
if ( module_hash )
{
if ( DEBUG_MEM || DEBUG_PROFILE )
if ( is_debug_mem() || is_debug_profile() )
{
struct hash * class_hash = hashinit( sizeof( struct module_stats ), "object info" );
hashenumerate( module_hash, stat_module, (void *)class_hash );
-94
View File
@@ -1,94 +0,0 @@
/*
* Copyright 1993, 1995 Christopher Seiwald.
*
* This file is part of Jam - see jam.c for Copyright information.
*/
# include "jam.h"
# include "option.h"
/*
* option.c - command line option processing
*
* {o >o
* \<>) "Process command line options as defined in <option.h>.
* Return the number of argv[] elements used up by options,
* or -1 if an invalid option flag was given or an argument
* was supplied for an option that does not require one."
*/
int getoptions( int argc, char * * argv, const char * opts, bjam_option * optv )
{
int i;
int optc = N_OPTS;
memset( (char *)optv, '\0', sizeof( *optv ) * N_OPTS );
for ( i = 0; i < argc; ++i )
{
char *arg;
if ( ( argv[ i ][ 0 ] != '-' ) ||
( ( argv[ i ][ 1 ] != '-' ) && !isalpha( argv[ i ][ 1 ] ) ) )
continue;
if ( !optc-- )
{
printf( "too many options (%d max)\n", N_OPTS );
return -1;
}
for ( arg = &argv[ i ][ 1 ]; *arg; ++arg )
{
const char * f;
for ( f = opts; *f; ++f )
if ( *f == *arg )
break;
if ( !*f )
{
printf( "Invalid option: -%c\n", *arg );
return -1;
}
optv->flag = *f;
if ( f[ 1 ] != ':' )
{
optv++->val = (char *)"true";
}
else if ( arg[ 1 ] )
{
optv++->val = &arg[1];
break;
}
else if ( ++i < argc )
{
optv++->val = argv[ i ];
break;
}
else
{
printf( "option: -%c needs argument\n", *f );
return -1;
}
}
}
return i;
}
/*
* Name: getoptval() - find an option given its character.
*/
char * getoptval( bjam_option * optv, char opt, int subopt )
{
int i;
for ( i = 0; i < N_OPTS; ++i, ++optv )
if ( ( optv->flag == opt ) && !subopt-- )
return optv->val;
return 0;
}
-25
View File
@@ -1,25 +0,0 @@
/*
* Copyright 1993, 1995 Christopher Seiwald.
*
* This file is part of Jam - see jam.c for Copyright information.
*/
/*
* option.h - command line option processing
*
* {o >o
* \ -) "Command line option."
*/
#include "config.h"
typedef struct bjam_option
{
char flag; /* filled in by getoption() */
char * val; /* set to random address if true */
} bjam_option;
#define N_OPTS 256
int getoptions( int argc, char * * argv, const char * opts, bjam_option * optv );
char * getoptval( bjam_option * optv, char opt, int subopt );
+1 -1
View File
@@ -120,7 +120,7 @@ void out_action
out_printf( "%s %s\n", action, target );
/* Print out the command executed if given -d+2. */
if ( DEBUG_EXEC )
if ( is_debug_exec() )
{
out_puts( command );
out_putc( '\n' );
+1 -1
View File
@@ -763,7 +763,7 @@ int yylex()
do_token_warning();
}
if ( DEBUG_SCAN )
if ( is_debug_scan() )
out_printf( "scan %s\n", symdump( &yylval ).c_str() );
return yylval.type;
+5 -5
View File
@@ -105,7 +105,7 @@ void set_explicit_binding( OBJECT * target, OBJECT * locate )
path_build( f, buf );
boundname = object_new( buf->value );
if ( DEBUG_SEARCH )
if ( is_debug_search() )
out_printf( "explicit locate %s: %s\n", object_str( target ), buf->value );
string_free( buf );
key = path_as_key( boundname );
@@ -171,7 +171,7 @@ OBJECT * search( OBJECT * target, timestamp * const time,
path_build( f, buf );
if ( DEBUG_SEARCH )
if ( is_debug_search() )
out_printf( "locate %s: %s\n", object_str( target ), buf->value );
key = object_new( buf->value );
@@ -197,7 +197,7 @@ OBJECT * search( OBJECT * target, timestamp * const time,
string_truncate( buf, 0 );
path_build( f, buf );
if ( DEBUG_SEARCH )
if ( is_debug_search() )
out_printf( "search %s: %s\n", object_str( target ), buf->value );
test_path = object_new( buf->value );
@@ -208,7 +208,7 @@ OBJECT * search( OBJECT * target, timestamp * const time,
if ( ( ba = (BINDING *)hash_find( explicit_bindings, key ) ) )
{
if ( DEBUG_SEARCH )
if ( is_debug_search() )
out_printf(" search %s: found explicitly located target %s\n",
object_str( target ), object_str( ba->target ) );
if ( another_target )
@@ -244,7 +244,7 @@ OBJECT * search( OBJECT * target, timestamp * const time,
string_truncate( buf, 0 );
path_build( f, buf );
if ( DEBUG_SEARCH )
if ( is_debug_search() )
out_printf( "search %s: %s\n", object_str( target ), buf->value );
key = object_new( buf->value );
+15 -30
View File
@@ -10,6 +10,7 @@ Distributed under the Boost Software License, Version 1.0.
#include "cwd.h"
#include "filesys.h"
#include "frames.h"
#include "mod_args.h"
#include "mod_jam_modules.h"
#include "modules.h"
#include "object.h"
@@ -51,17 +52,14 @@ LIST * b2::startup::builtin_boost_build(FRAME * frame, int flags)
{
// Do nothing, but keep the rule, for backwards compatability.
// But do record the path passed in as a fallback to the loading.
b2::jam::variable(".boost-build-dir")
= b2::list_ref(lol_get(frame->args, 0));
b2::jam::variable(".boost-build-dir") = b2::list_ref(lol_get(frame->args, 0));
return L0;
}
extern char const * saved_argv0;
void bootstrap_dirscan(void * dirs,
OBJECT * path,
int found,
timestamp const * const)
void bootstrap_dirscan(
void * dirs, OBJECT * path, int found, timestamp const * const)
{
if (file_is_file(path) == 1) return;
_pathname p(object_str(path));
@@ -72,18 +70,6 @@ void bootstrap_dirscan(void * dirs,
bool b2::startup::bootstrap(FRAME * frame)
{
b2::value_ref opt_debug_configuration { "--debug-configuration" };
b2::jam::variable dot_OPTION__debug_configuration { ".OPTION",
"debug-configration" };
for (auto arg : *b2::jam::variable("ARGV"))
{
if (opt_debug_configuration == arg)
{
dot_OPTION__debug_configuration = "true";
break;
}
}
// We use the executable path as a root for searches.
char * b2_exe_path_pchar = executable_path(saved_argv0);
const std::string b2_exe_path { b2_exe_path_pchar };
@@ -162,10 +148,10 @@ bool b2::startup::bootstrap(FRAME * frame)
}
// Show where we found it, if asked.
if (!b2_file_path.empty() && dot_OPTION__debug_configuration)
if (!b2_file_path.empty()
&& !b2::args::get_arg("debug-configuration").empty())
{
out_printf(
"notice: found boost-build.jam at %s\n", b2_file_path.c_str());
out_printf("notice: found boost-build.jam at %s\n", b2_file_path.c_str());
}
// Load the boost-build file if we find it for backwards compatability. We
@@ -191,8 +177,8 @@ bool b2::startup::bootstrap(FRAME * frame)
// Check various locations relative to executable.
if (buildsystem_file.empty())
{
const char * dirs[] = {
// Check relative to the executable for portable install location.
const char * dirs[] = { // Check relative to the executable for portable
// install location.
".b2/",
// Check relative to the exec for system install location.
"../share/b2/",
@@ -246,8 +232,7 @@ bool b2::startup::bootstrap(FRAME * frame)
// Last resort, search in the directory referenced by the boost-build rule.
if (buildsystem_file.empty())
{
b2::list_cref dot_boost_build_dir
= b2::jam::variable(".boost-build-dir");
b2::list_cref dot_boost_build_dir = b2::jam::variable(".boost-build-dir");
if (!dot_boost_build_dir.empty())
{
std::string dir = b2::value_ref(*dot_boost_build_dir.begin());
@@ -275,7 +260,8 @@ bool b2::startup::bootstrap(FRAME * frame)
}
// Show where we found the bootstrap, if asked.
if (!buildsystem_file.empty() && dot_OPTION__debug_configuration)
if (!buildsystem_file.empty()
&& !b2::args::get_arg("debug-configuration").empty())
{
out_printf("notice: loading B2 from %s\n", buildsystem_file.c_str());
}
@@ -284,11 +270,10 @@ bool b2::startup::bootstrap(FRAME * frame)
// parse_file(b2::value_ref { buildsystem_file }, frame);
// Add any subdirs to the build-system.jam to search for the jam files.
std::string buildsystem_dir
= b2::paths::normalize(buildsystem_file + "/..");
std::string buildsystem_dir = b2::paths::normalize(buildsystem_file + "/..");
std::vector<std::string> buildsystem_subdirs;
file_dirscan(value_ref(buildsystem_dir), &bootstrap_dirscan,
&buildsystem_subdirs);
file_dirscan(
value_ref(buildsystem_dir), &bootstrap_dirscan, &buildsystem_subdirs);
b2::jam::variable boost_build_path_v("BOOST_BUILD_PATH");
for (auto subdir : buildsystem_subdirs) boost_build_path_v += subdir;
boost_build_path_v += buildsystem_dir;
+5 -5
View File
@@ -201,14 +201,14 @@ LIST * var_get( struct module_t * module, OBJECT * symbol )
if ( ( n = module_get_fixed_var( module, symbol ) ) != -1 )
{
if ( DEBUG_VARGET )
if ( is_debug_varget() )
var_dump( symbol, module->fixed_variables[ n ], "get" );
result = module->fixed_variables[ n ];
}
else if ( module->variables && ( v = (VARIABLE *)hash_find(
module->variables, symbol ) ) )
{
if ( DEBUG_VARGET )
if ( is_debug_varget() )
var_dump( v->symbol, v->value, "get" );
result = v->value;
}
@@ -252,7 +252,7 @@ LIST * var_get( struct module_t * module, OBJECT * symbol )
if ( module->variables && ( v = (VARIABLE *)hash_find(
module->variables, symbol ) ) )
{
if ( DEBUG_VARGET )
if ( is_debug_varget() )
var_dump( v->symbol, v->value, "get" );
result = v->value;
}
@@ -295,7 +295,7 @@ void var_set( struct module_t * module, OBJECT * symbol, LIST * value, int flag
{
LIST * * v = var_enter( module, symbol );
if ( DEBUG_VARSET )
if ( is_debug_varset() )
var_dump( symbol, value, "set" );
switch ( flag )
@@ -327,7 +327,7 @@ LIST * var_swap( struct module_t * module, OBJECT * symbol, LIST * value )
{
LIST * * v = var_enter( module, symbol );
LIST * oldvalue = *v;
if ( DEBUG_VARSET )
if ( is_debug_varset() )
var_dump( symbol, value, "set" );
*v = value;
return oldvalue;
+2 -2
View File
@@ -25,6 +25,7 @@
# <format> is an implicit feature, so for example, typing pdf on the command
# line is a short-cut for format=pdf.
import args ;
import build-system ;
import "class" : new ;
import common ;
@@ -51,8 +52,7 @@ import xsltproc ;
project.initialize $(__name__) ;
project boostbook ;
.debug-configuration = [ MATCH ^(--debug-configuration)$ : [ modules.peek : ARGV
] ] ;
.debug-configuration = [ args.get-arg debug-configuration ] ;
feature.feature format
: html xhtml htmlhelp onehtml man pdf ps docbook fo tests none
+2 -4
View File
@@ -11,6 +11,7 @@
#
# /bzip2//bzip2 -- The bzip library
import args ;
import project ;
import ac ;
import errors ;
@@ -34,10 +35,7 @@ sources = blocksort.c bzlib.c compress.c crctable.c
library-id = 0 ;
if --debug-configuration in [ modules.peek : ARGV ]
{
.debug = true ;
}
.debug = [ args.get-arg debug-configuration ] ;
# Initializes the bzip library.
#
+2 -4
View File
@@ -5,6 +5,7 @@
# (See accompanying file LICENSE.txt
# or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
import args ;
import clang ;
import feature : feature ;
import os ;
@@ -30,10 +31,7 @@ toolset.inherit-flags clang-darwin : clang-linux
<architecture>x86/<address-model>64
;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
# Initializes the clang-darwin toolset
# version in optional
+2 -4
View File
@@ -17,11 +17,11 @@ options as link:#b2.reference.tools.compiler.gcc[`gcc`] toolset.
|# # end::doc[]
import args ;
import common ;
import toolset ;
import feature ;
import toolset : flags ;
import clang ;
import gcc ;
import common ;
@@ -55,9 +55,7 @@ toolset.inherit-flags clang-linux : gcc
: INCLUDE-GCH
;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] {
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
rule init ( version ? : command * : options * ) {
command = [ common.find-compiler clang-linux : clang++ : $(version) : $(command) ] ;
+3 -4
View File
@@ -3,6 +3,7 @@
# (See accompanying file LICENSE.txt
# or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
import args ;
import clang ;
import feature : feature get-values ;
import os ;
@@ -27,10 +28,8 @@ toolset.inherit-generators clang-vxworks
toolset.inherit-rules clang-vxworks : clang-linux ;
toolset.inherit-flags clang-vxworks : clang-linux ;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
# Initializes the clang-vxworks toolset
# version in optional
# compile and link options allow you to specify addition command line options for each version
+2 -1
View File
@@ -15,6 +15,7 @@ options as link:#b2.reference.tools.compiler.msvc[`msvc`] toolset.
|# # end::doc[]
import args ;
import common ;
import errors ;
import feature ;
@@ -34,7 +35,7 @@ toolset.inherit-flags clang-win : msvc : : YLOPTION ;
toolset.inherit-rules clang-win : msvc ;
if [ MATCH (--debug-(clang-(win-)?)?configuration) : [ modules.peek : ARGV ] ]
if [ args.get-arg debug-configuration ]
{
local rule .notice ( messages * )
{
+5 -8
View File
@@ -8,6 +8,7 @@
# Provides actions common to all toolsets, such as creating directories and
# removing files.
import args ;
import os ;
import modules ;
import utility ;
@@ -21,14 +22,10 @@ import toolset ;
import virtual-target ;
import numbers ;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
if [ MATCH (--show-configuration) : [ modules.peek : ARGV ] ]
{
.show-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
args.add-arg show-configuration : --show-configuration : "?" ;
.show-configuration = [ args.get-arg show-configuration ] ;
# Configurations
#
+4 -20
View File
@@ -51,6 +51,7 @@
# For more information on CCE, search for Cray publication S-2529 on the
# Cray publications website (https://pubs.cray.com).
import args ;
import "class" : new ;
import common ;
import feature ;
@@ -233,27 +234,10 @@ rule set-cray-feature-defaults ( )
### Command line options
###
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = [ args.get-arg debug-configuration ] ;
# Check if '--debug-configuration' was passed on the command line. This is
# inspired by 'common.jam' and other modules.
# Variable names with a '.' prefix are intended to be globals.
#
# Refer to: CONTRIBUTING.adoc
# The Jam language uses dynamic scoping. Setting '.debug-configuration' in
# this module influences the behavior of methods called from this module.
.debug-configuration = true ;
}
if [ MATCH (--debug-driver) : [ modules.peek : ARGV ] ]
{
.debug-driver = true ;
}
args.add-arg debug-driver : --debug-driver : "?" ;
.debug-driver = [ args.get-arg debug-driver ] ;
###
### Features
+2 -1
View File
@@ -4,6 +4,7 @@
# Automatic configuration for CodeWarrior toolset. To use, just import this module.
import args ;
import os ;
import toolset : using ;
@@ -24,7 +25,7 @@ if [ os.name ] = NT
if $(cw-path)
{
if --debug-configuration in [ modules.peek : ARGV ]
if [ args.get-arg debug-configuration ]
{
ECHO "notice:" using cw ":" $(cw-version) ":" "$(cw-path)\\Other Metrowerks Tools\\Command Line Tools\\mwcc.exe" ;
}
+2 -4
View File
@@ -71,11 +71,9 @@ import feature : feature get-values ;
import path ;
import sequence : unique ;
import common ;
import args ;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
feature.extend toolset : cw ;
+2 -4
View File
@@ -20,6 +20,7 @@ import version ;
import property-set ;
import regex ;
import errors ;
import args ;
## Use a framework.
feature framework : : free ;
@@ -37,10 +38,7 @@ feature force-load : : free dependency incidental ;
_ = " " ;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
feature.extend toolset : darwin ;
import gcc ;
+2 -1
View File
@@ -18,6 +18,7 @@
# <target> with the Doxygen html files, and a <target>.html file redirecting to
# that directory.
import args ;
import alias ;
import boostbook ;
import "class" : new ;
@@ -164,7 +165,7 @@ local rule modify-config ( )
local rule check-doxygen ( )
{
if --debug-configuration in [ modules.peek : ARGV ]
if [ args.get-arg debug-configuration ]
{
ECHO "notice:" using doxygen ":" $(.doxygen) ;
}
+2 -3
View File
@@ -137,6 +137,7 @@ import clang ;
import gcc ;
import generators ;
import errors ;
import args ;
feature.extend toolset : embarcadero ;
@@ -179,9 +180,7 @@ toolset.inherit-flags embarcadero
<cxxstd>latest/<cxxstd-dialect>iso
;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] {
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
rule init ( version ? : command * : options * )
{
+2 -1
View File
@@ -37,6 +37,7 @@ import toolset ;
import common ;
import type ;
import version ;
import args ;
feature.extend toolset : emscripten ;
@@ -47,7 +48,7 @@ feature.subfeature debug-symbols : source-map : on : optional propagated ;
feature.subfeature exception-handling : demangle-support : on : optional propagated ;
feature.subfeature exception-handling : method : js : optional propagated link-incompatible ;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
if [ args.get-arg debug-configuration ]
{
local rule .debug-configuration ( messages * )
{
+2 -4
View File
@@ -117,15 +117,13 @@ import type ;
import unix ;
import virtual-target ;
import errors ;
import args ;
# Used in actions for multi argument options
_ = " " ;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
feature.extend toolset : gcc ;
+2 -4
View File
@@ -14,6 +14,7 @@ import common ;
import errors ;
import generators ;
import regex ;
import args ;
feature.extend-subfeature toolset intel : platform : darwin ;
@@ -36,10 +37,7 @@ toolset.inherit-flags intel-darwin : gcc
<architecture>x86/<address-model>64
;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
# Initializes the intel-darwin toolset
# version in mandatory
+2 -4
View File
@@ -8,6 +8,7 @@
import toolset ;
import toolset : flags ;
import args ;
import common ;
import errors ;
import feature ;
@@ -37,10 +38,7 @@ toolset.inherit-flags intel-linux : gcc
<warnings-as-errors>off <warnings-as-errors>on
;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
.home = [ os.home-directories ] ;
.home = $(.home[1]) ;
+2 -4
View File
@@ -13,6 +13,7 @@ import common ;
import errors ;
import generators ;
import regex ;
import args ;
feature.extend-subfeature toolset intel : platform : vxworks ;
@@ -35,10 +36,7 @@ toolset.inherit-flags intel-vxworks : gcc
<architecture>x86/<address-model>64
;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
# Initializes the intel-vxworks toolset
# version in mandatory
+6 -9
View File
@@ -5,7 +5,6 @@
# or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
# Importing common is needed because the rules we inherit here depend on it.
# That is nasty.
import common ;
import errors ;
import feature ;
@@ -18,6 +17,7 @@ import generators ;
import type ;
import path ;
import numbers ;
import args ;
feature.extend-subfeature toolset intel : platform : win ;
@@ -66,7 +66,7 @@ rule init ( version ? : # the compiler version
{
local msvc-version = [ feature.get-values <compatibility> : $(options) ] ;
msvc-version = [ get-msvc-version-from-vc-string $(msvc-version) ] ;
for local v in
for local v in
{
if [ is-msvc-supported $(v) : $(msvc-version) ]
{
@@ -294,9 +294,9 @@ local rule configure-really ( version ? : command * : options * : compatibility
local default-assembler-intel64 = ml64 ;
local default-assembler-ia32_intel64 = ml64 ;
local default-assembler-ia32 = "ml -coff" ;
local assembler-flags-intel64 = "-c -Zp4 -Cp -Cx" ;
local assembler-flags-ia32_intel64 = "-c -Zp4 -Cp -Cx" ;
local assembler-flags-ia32 = "-c -Zp4 -Cp -Cx" ;
local assembler-flags-intel64 = "-c -Zp4 -Cp -Cx" ;
local assembler-flags-ia32_intel64 = "-c -Zp4 -Cp -Cx" ;
local assembler-flags-ia32 = "-c -Zp4 -Cp -Cx" ;
assembler = [ feature.get-values <assembler> : $(options) ] ;
for local c in $(target_types)
@@ -537,10 +537,7 @@ local rule get-msvc-version-from-vc-string ( vc-string )
return $(r[1]) ;
}
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
# Copied from msvc.jam
# Supported CPU architectures.
+2 -4
View File
@@ -22,6 +22,7 @@ import modules ;
import indirect ;
import property ;
import property-set ;
import args ;
header = jpeglib.h ;
@@ -40,10 +41,7 @@ sources = jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c
library-id = 0 ;
if --debug-configuration in [ modules.peek : ARGV ]
{
.debug = true ;
}
.debug = [ args.get-arg debug-configuration ] ;
# Initializes the libjpeg library.
#
+2 -4
View File
@@ -22,6 +22,7 @@ import modules ;
import indirect ;
import property ;
import property-set ;
import args ;
header = png.h ;
@@ -35,10 +36,7 @@ sources = png.c pngerror.c pngget.c pngmem.c pngpread.c pngread.c pngrio.c png
library-id = 0 ;
if --debug-configuration in [ modules.peek : ARGV ]
{
.debug = true ;
}
.debug = [ args.get-arg debug-configuration ] ;
# Initializes the libpng library.
#
+2 -4
View File
@@ -22,6 +22,7 @@ import modules ;
import indirect ;
import property ;
import property-set ;
import args ;
header = tiff.h ;
names = tiff ;
@@ -34,10 +35,7 @@ sources = tif_aux.c tif_close.c tif_codec.c tif_color.c tif_compress.c tif_dir
library-id = 0 ;
if --debug-configuration in [ modules.peek : ARGV ]
{
.debug = true ;
}
.debug = [ args.get-arg debug-configuration ] ;
# Initializes the libtiff library.
#
+2 -4
View File
@@ -22,6 +22,7 @@ import modules ;
import indirect ;
import property ;
import property-set ;
import args ;
header = lzma.h ;
# liblzma only needed for VisualC++ builds
@@ -29,10 +30,7 @@ names = lzma liblzma ;
library-id = 0 ;
if --debug-configuration in [ modules.peek : ARGV ]
{
.debug = true ;
}
.debug = [ args.get-arg debug-configuration ] ;
# Initializes the lzma library.
#
+2 -4
View File
@@ -65,6 +65,7 @@ import testing ;
import toolset ;
import type ;
import path ;
import args ;
feature mpi.run-flags : : free incidental ;
@@ -72,10 +73,7 @@ feature mpi.run-flags : : free incidental ;
project.initialize $(__name__) ;
project mpi ;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
# Assuming the first part of the command line is the given prefix
# followed by some non-empty value, remove the first argument. Returns
+2 -4
View File
@@ -216,6 +216,7 @@ http://blogs.msdn.com/b/vcblog/archive/2014/07/18/using-boost-libraries-in-windo
#
################################################################################
import args ;
import "class" : new ;
import common ;
import feature ;
@@ -2112,10 +2113,7 @@ local rule register-configuration ( version : path ? )
#
################################################################################
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
# Miscellaneous constants.
.RM = [ common.rm-command ] ;
+2 -4
View File
@@ -23,6 +23,7 @@ import indirect ;
import os ;
import property ;
import property-set ;
import args ;
header = openssl.h ;
ssl_names = ssl ssleay32 ;
@@ -30,10 +31,7 @@ crypto_names = crypto libeay32 ;
library-id = 0 ;
if --debug-configuration in [ modules.peek : ARGV ]
{
.debug = true ;
}
.debug = [ args.get-arg debug-configuration ] ;
# Initializes the openssl library.
#
+7 -4
View File
@@ -40,11 +40,13 @@ import stage ;
import targets ;
import modules ;
import os ;
import args ;
feature.feature install-default-prefix : : free incidental ;
class package-paths
{
import args ;
import feature ;
import modules ;
import option ;
@@ -52,10 +54,11 @@ class package-paths
import path ;
rule __init__ ( default-prefix )
{
local explicit-options = [ MATCH --(prefix|bindir|libdir|includedir|datarootdir)=.*
: [ modules.peek : ARGV ] ] ;
self.has-$(explicit-options) = true ;
if prefix in $(explicit-options)
for local explicit-option in prefix bindir libdir includedir datarootdir
{
self.has-$(explicit-option) = [ args.get-arg $(explicit-option) ] ;
}
if $(self.has-prefix)
{
# If --prefix is explicitly specified on the command line,
# then we need wipe away any settings of libdir/includir that
+2 -1
View File
@@ -4,6 +4,7 @@
# Automatic configuration for Python tools and librries. To use, just import this module.
import args ;
import os ;
import toolset : using ;
@@ -17,7 +18,7 @@ if [ os.name ] = NT
if $(python-path)
{
if --debug-configuration in [ modules.peek : ARGV ]
[ args.get-arg debug-configuration ]
{
ECHO "notice:" using python ":" $(python-version) ":" $(python-path) ;
}
+2 -1
View File
@@ -35,6 +35,7 @@ import feature ;
import set ;
import builtin ;
import property-set ;
import args ;
# Make this module a project.
@@ -241,7 +242,7 @@ local rule invokes-cygwin-symlink ( cmd )
local rule debug-message ( message * )
{
if --debug-configuration in [ modules.peek : ARGV ]
if [ args.get-arg debug-configuration ]
{
ECHO "notice:" "[python-cfg]" $(message) ;
}
+3 -5
View File
@@ -63,6 +63,7 @@ import toolset : flags ;
import os ;
import virtual-target ;
import scanner ;
import args ;
# Qt3Support control feature
#
@@ -97,14 +98,11 @@ project qt ;
.project = [ project.current ] ;
# Helper utils for easy debug output
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = TRUE ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
local rule debug-message ( message * )
{
if $(.debug-configuration) = TRUE
if $(.debug-configuration)
{
ECHO notice\: "[qt4-cfg]" $(message) ;
}
+3 -5
View File
@@ -63,6 +63,7 @@ import toolset : flags ;
import os ;
import virtual-target ;
import scanner ;
import args ;
# The Qt version used for requirements
# Valid are <qt>5.0 or <qt>5.1.0
@@ -80,14 +81,11 @@ project qt5 ;
.project = [ project.current ] ;
# Helper utils for easy debug output
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = TRUE ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
local rule debug-message ( message * )
{
if $(.debug-configuration) = TRUE
if $(.debug-configuration)
{
ECHO notice\: "[qt5-cfg]" $(message) ;
}
+3 -2
View File
@@ -4,6 +4,7 @@
# Automatic configuration for BoostBook tools. To use, just import this module.
import args ;
import os ;
import toolset : using ;
@@ -21,7 +22,7 @@ if [ os.name ] = NT
if $(quickbook-path)
{
if --debug-configuration in [ modules.peek : ARGV ]
if [ args.get-arg debug-configuration ]
{
ECHO "notice:" using quickbook ":" $(quickbook-path) ;
}
@@ -35,7 +36,7 @@ else
if $(quickbook-path)
{
if --debug-configuration in [ modules.peek : ARGV ]
if [ args.get-arg debug-configuration ]
{
ECHO "notice:" using quickbook ":" $(quickbook-path) ;
}
+2 -4
View File
@@ -9,16 +9,14 @@
# License Version 1.0. (See accompanying file LICENSE.txt or
# https://www.bfgroup.xyz/b2/LICENSE.txt)
import args ;
import generators ;
import feature ;
import scanner ;
import toolset : flags ;
import type ;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
type.register RC : rc ;
+13
View File
@@ -16,6 +16,7 @@ single location.
|# # end::doc[]
import args ;
import "class" : new ;
import feature ;
import generators ;
@@ -29,6 +30,18 @@ import types/register ;
import virtual-target ;
args.add-arg prefix : --prefix
: "Install to a tree rooted at prefix." ;
args.add-arg bindir : --bindir
: "Install binaries to this directory. [default: <prefix>/bin]" ;
args.add-arg libdir : --libdir
: "Install libraries to this directory. [default: <prefix>/lib]" ;
args.add-arg includedir : --includedir
: "install include files to this directory. [default: <prefix>/include]" ;
args.add-arg datarootdir : --datarootdir
: "Install shared data files to this directory. [default: <prefix>/share]" ;
feature.feature <install-dependencies> : off on : incidental ;
feature.feature <install-type> : : free incidental ;
feature.feature <install-source-root> : : free path ;
+4 -1
View File
@@ -1,3 +1,4 @@
import args ;
import feature ;
# This module is imported by testing.py. The definitions here are
@@ -179,8 +180,10 @@ else
}
args.add-arg verbose-test : --verbose-test
: "Include output of tests when run." ;
.VERBOSE_TEST = 0 ;
if --verbose-test in [ modules.peek : ARGV ]
if [ args.get-arg verbose-test ]
{
.VERBOSE_TEST = 1 ;
}
+11 -5
View File
@@ -34,6 +34,7 @@
import alias ;
import args ;
import build-system ;
import "class" ;
import common ;
@@ -224,7 +225,8 @@ rule dump-tests
}
}
if ( --dump-tests in [ modules.peek : ARGV ] )
args.add-arg dump-tests : --dump-tests : "?" ;
if [ args.get-arg dump-tests ]
{
IMPORT testing : dump-tests : : testing.dump-tests ;
build-system.add-pre-build-hook testing.dump-tests ;
@@ -243,7 +245,7 @@ local rule get-library-name ( path )
if $(match1) { return $(match1[2]) ; }
else if $(match2) { return $(match2[2]) ; }
else if $(match3) { return "" ; }
else if --dump-tests in [ modules.peek : ARGV ]
else if [ args.get-arg dump-tests ]
{
# The 'run' rule and others might be used outside boost. In that case,
# just return the path, since the 'library name' makes no sense.
@@ -253,7 +255,7 @@ local rule get-library-name ( path )
# Was an XML dump requested?
.out-xml = [ MATCH --out-xml=(.*) : [ modules.peek : ARGV ] ] ;
.out-xml = [ args.get-arg out-xml ] ;
# Takes a target (instance of 'basic-target') and prints
@@ -517,7 +519,9 @@ toolset.flags testing.capture-output LAUNCHER <testing.launcher> ;
toolset.uses-features testing.capture-output :
<testing.launcher> <testing.execute> <dll-path> <xdll-path> <target-os> ;
if --remove-test-targets in [ modules.peek : ARGV ]
args.add-arg remove-test-targets : --remove-test-targets
: "Delete intermediate test files for successful tests." ;
if [ args.get-arg remove-test-targets ]
{
feature.set-default preserve-test-targets : off ;
}
@@ -644,8 +648,10 @@ else
.NULL_OUT = [ modules.peek common : NULL_OUT ] ;
args.add-arg verbose-test : --verbose-test
: "Include output of tests when run." ;
.VERBOSE_TEST = 0 ;
if --verbose-test in [ modules.peek : ARGV ]
if [ args.get-arg verbose-test ]
{
.VERBOSE_TEST = 1 ;
}
+2 -4
View File
@@ -18,12 +18,10 @@ import common ;
import unix ;
import path ;
import regex ;
import args ;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
.debug-configuration = [ args.get-arg debug-configuration ] ;
feature.extend toolset : vmsdecc ;
+2 -1
View File
@@ -5,6 +5,7 @@
# Automatic configuration for the xsltproc toolset. To use, just import this
# module.
import args ;
import os ;
import toolset : using ;
@@ -28,7 +29,7 @@ local rule locate-executable ( name )
local xsltproc-exe = [ locate-executable xsltproc ] ;
if $(xsltproc-exe)
{
if --debug-configuration in [ modules.peek : ARGV ]
if [ args.get-arg debug-configuration ]
{
ECHO notice\: using xsltproc ":" $(xsltproc-exe) ;
}
+2 -4
View File
@@ -23,6 +23,7 @@ import indirect ;
import os ;
import property ;
import property-set ;
import args ;
header = zlib.h ;
names = z zlib zll zdll ;
@@ -33,10 +34,7 @@ sources = adler32.c compress.c
library-id = 0 ;
if --debug-configuration in [ modules.peek : ARGV ]
{
.debug = true ;
}
.debug = [ args.get-arg debug-configuration ] ;
# Initializes the zlib library.
#
+2 -4
View File
@@ -22,6 +22,7 @@ import modules ;
import indirect ;
import property ;
import property-set ;
import args ;
header = zstd.h ;
# libzstd only needed for VisualC++ builds
@@ -30,10 +31,7 @@ names = zstd zstd_static libzstd libzstd_static ;
library-id = 0 ;
if --debug-configuration in [ modules.peek : ARGV ]
{
.debug = true ;
}
.debug = [ args.get-arg debug-configuration ] ;
rule init (
version ?

Some files were not shown because too many files have changed in this diff Show More