diff --git a/v2/build/alias.jam b/v2/build/alias.jam index 9b2b7b519..8552389a5 100644 --- a/v2/build/alias.jam +++ b/v2/build/alias.jam @@ -2,27 +2,26 @@ # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) -# This module defines the 'alias' rule and the associated target class. +# This module defines the 'alias' rule and the associated target class. # -# Alias is just a main target which returns its source targets without any -# processing. For example: +# Alias is just a main target which returns its source targets without any +# processing. For example: # -# alias bin : hello test_hello ; -# alias lib : helpers xml_parser ; +# alias bin : hello test_hello ; +# alias lib : helpers xml_parser ; # -# Another important use of 'alias' is to conveniently group source files: +# Another important use of 'alias' is to conveniently group source files: # -# alias platform-src : win.cpp : NT ; -# alias platform-src : linux.cpp : LINUX ; -# exe main : main.cpp platform-src ; +# alias platform-src : win.cpp : NT ; +# alias platform-src : linux.cpp : LINUX ; +# exe main : main.cpp platform-src ; # -# Lastly, it's possible to create local alias for some target, with different -# properties:: +# Lastly, it is possible to create local alias for some target, with different +# properties: # -# alias big_lib : : @/external_project/big_lib/static ; +# alias big_lib : : @/external_project/big_lib/static ; # - import "class" : new ; import project ; import property-set ; @@ -53,6 +52,7 @@ class alias-target-class : basic-target } # Declares the 'alias' target. It will build sources, and return them unaltered. +# rule alias ( name : sources * : requirements * : default-build * : usage-requirements * ) { local project = [ project.current ] ; @@ -67,6 +67,3 @@ rule alias ( name : sources * : requirements * : default-build * : usage-require } IMPORT $(__name__) : alias : : alias ; - - - diff --git a/v2/build/targets.jam b/v2/build/targets.jam index 47e05b435..dbaccd21d 100644 --- a/v2/build/targets.jam +++ b/v2/build/targets.jam @@ -5,29 +5,28 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -# Supports 'abstract' targets, which are targets explicitly defined in a -# Jamfile. +# Supports 'abstract' targets, which are targets explicitly defined in a +# Jamfile. # -# Abstract targets are represented by classes derived from 'abstract-target' -# class. The first abstract target is 'project-target', which is created for -# each Jamfile, and can be obtained by the 'target' rule in the Jamfile's -# module (see project.jam). +# Abstract targets are represented by classes derived from 'abstract-target' +# class. The first abstract target is 'project-target', which is created for +# each Jamfile, and can be obtained by the 'target' rule in the Jamfile's module +# (see project.jam). # -# Project targets keep a list of 'main-target' instances. A main target is -# what the user explicitly defines in a Jamfile. It is possible to have -# several definitions for a main target, for example to have different lists -# of sources for different platforms. So, main targets keep a list of -# alternatives. +# Project targets keep a list of 'main-target' instances. A main target is +# what the user explicitly defines in a Jamfile. It is possible to have several +# definitions for a main target, for example to have different lists of sources +# for different platforms. So, main targets keep a list of alternatives. # -# Each alternative is an instance of 'abstract-target'. When a main target -# subvariant is defined by some rule, that rule will decide what class to use, -# create an instance of that class and add it to the list of alternatives for -# the main target. +# Each alternative is an instance of 'abstract-target'. When a main target +# subvariant is defined by some rule, that rule will decide what class to use, +# create an instance of that class and add it to the list of alternatives for +# the main target. # -# Rules supplied by the build system will use only targets derived from -# 'basic-target' class, which will provide some default behaviour. There will -# be different classes derived from it such as 'make-target', created by the -# 'make' rule, and 'typed-target', created by rules such as 'exe' and 'lib'. +# Rules supplied by the build system will use only targets derived from +# 'basic-target' class, which will provide some default behaviour. There will be +# different classes derived from it such as 'make-target', created by the 'make' +# rule, and 'typed-target', created by rules such as 'exe' and 'lib'. # # +------------------------+ @@ -80,7 +79,9 @@ import sequence ; import set ; import toolset ; + # Base class for all abstract targets. +# class abstract-target { import project ; @@ -135,6 +136,7 @@ class abstract-target # - a list of produced virtual targets, which may be empty. # If 'property-set' is empty, performs the default build of this target, in # a way specific to the derived class. + # rule generate ( property-set ) { errors.error "method should be defined in derived classes" ; @@ -181,6 +183,7 @@ rule decrease-indent ( ) # that time, alternatives can also be renamed to account for inline targets. # - The first time 'main-target' or 'has-main-target' rule is called, all # alternatives are enumerated and main targets are created. +# class project-target : abstract-target { import project ; @@ -211,6 +214,7 @@ class project-target : abstract-target # This is needed only by the 'make' rule. Need to find the way to make # 'make' work without this method. + # rule project-module ( ) { return $(self.project-module) ; @@ -238,6 +242,7 @@ class project-target : abstract-target } # Generates all possible targets contained in this project. + # rule generate ( property-set * ) { if [ modules.peek : .debug-building ] @@ -261,6 +266,7 @@ class project-target : abstract-target # Computes and returns a list of abstract-target instances which must be # built when this project is built. + # rule targets-to-build ( ) { local result ; @@ -291,6 +297,7 @@ class project-target : abstract-target # Add 'target' to the list of targets in this project that should be build # only by explicit request + # rule mark-target-as-explicit ( target-name ) { # Record the name of the target, not instance, since this @@ -299,6 +306,7 @@ class project-target : abstract-target } # Add new target alternative + # rule add-alternative ( target-instance ) { if $(self.built-main-targets) @@ -310,6 +318,7 @@ class project-target : abstract-target } # Returns a 'main-target' class instance corresponding to the 'name'. + # rule main-target ( name ) { if ! $(self.built-main-targets) @@ -321,6 +330,7 @@ class project-target : abstract-target } # Tells if a main target with the specified name exists. + # rule has-main-target ( name ) { if ! $(self.built-main-targets) @@ -334,8 +344,9 @@ class project-target : abstract-target } } - # Find and return the target with the specified id, treated - # relative to self. + # Find and return the target with the specified id, treated relative to + # self. + # rule find-really ( id ) { local result ; @@ -452,6 +463,7 @@ class project-target : abstract-target } # Accessor, add a constant. + # rule add-constant ( name # Variable name of the constant. : value + # Value of the constant. @@ -506,7 +518,8 @@ class project-target : abstract-target } -# Helper rules to detect cycles in main target references +# Helper rules to detect cycles in main target references. +# local rule start-building ( main-target-instance ) { if $(main-target-instance) in $(.targets-being-built) @@ -532,6 +545,7 @@ local rule end-building ( main-target-instance ) # A named top-level target in Jamfile. +# class main-target : abstract-target { import assert ; @@ -568,6 +582,7 @@ class main-target : abstract-target # Returns the best viable alternative for this property-set. See the # documentation for selection rules. + # local rule select-alternatives ( property-set debug ? ) { # When selecting alternatives we have to consider defaults, for example: @@ -697,8 +712,9 @@ class main-target : abstract-target # Select an alternative for this main target, by finding all alternatives # which requirements are satisfied by 'properties' and picking the one with - # longest requirements set. Returns the result of calling 'generate' on that - # alternative. + # the longest requirements set. Returns the result of calling 'generate' on + # that alternative. + # rule generate ( property-set ) { start-building $(__name__) ; @@ -726,7 +742,8 @@ class main-target : abstract-target # Generates the main target with the given property set and returns a list # which first element is property-set object containing usage-requirements # of generated target and with generated virtual target in other elements. - # It's possible that no targets are generated. + # It is possible that no targets are generated. + # local rule generate-really ( property-set ) { local best-alternatives = [ select-alternatives $(property-set) ] ; @@ -757,6 +774,7 @@ class main-target : abstract-target # Abstract target which refers to a source file. This is an artificial entity # allowing sources to a target to be represented using a list of abstract target # instances. +# class file-reference : abstract-target { import virtual-target ; @@ -811,6 +829,7 @@ class file-reference : abstract-target # Given a target-reference, made in context of 'project', returns the # abstract-target instance that is referred to, as well as properties explicitly # specified for this reference. +# rule resolve-reference ( target-reference : project ) { # Separate target name from properties override @@ -834,6 +853,7 @@ rule resolve-reference ( target-reference : project ) # both to a main target or to a file. Returns a list consisting of # - usage requirements # - generated virtual targets, if any +# rule generate-from-reference ( target-reference # Target reference. : project # Project where the reference is made. @@ -861,6 +881,7 @@ rule generate-from-reference ( # Given a build request and requirements, return properties common to dependency # build request and target build properties. +# rule common-properties ( build-request requirements ) { # For optimization, we add free requirements directly, without using a @@ -891,6 +912,7 @@ rule common-properties ( build-request requirements ) # # If 'what' is 'refined' returns context refined with new requirements. If # 'what' is 'added' returns just the requirements to be applied. +# rule evaluate-requirements ( requirements : context : what ) { # Apply non-conditional requirements. It's possible that further conditional @@ -1007,6 +1029,7 @@ rule common-properties2 ( build-request requirements ) # Implements the most standard way of constructing main target alternative from # sources. Allows sources to be either file or other main target and handles # generation of those dependency targets. +# class basic-target : abstract-target { import build-request ; @@ -1051,6 +1074,7 @@ class basic-target : abstract-target # Returns the list of abstract-targets which are used as sources. The extra # properties specified for sources are not represented. The only user for # this rule at the moment is the "--dump-tests" feature of the test system. + # rule sources ( ) { if ! $(self.source-targets) { @@ -1075,16 +1099,16 @@ class basic-target : abstract-target # Returns the alternative condition for this alternative, if the condition # is satisfied by 'property-set'. + # rule match ( property-set debug ? ) { - # The condition is composed of all base non-conditional properties. It's - # not clear if we should expand 'self.requirements' or not. For one + # The condition is composed of all base non-conditional properties. It + # is not clear if we should expand 'self.requirements' or not. For one # thing, it would be nice to be able to put # msvc-6.0 - # in requirements. - # On the other hand, if we have release in condition it does - # not make sense to require full to be in build request - # just to select this variant. + # in requirements. On the other hand, if we have release as a + # condition it does not make sense to require full to be + # in the build request just to select this variant. local bcondition = [ $(self.requirements).base ] ; local ccondition = [ $(self.requirements).conditional ] ; local condition = [ set.difference $(bcondition) : $(ccondition) ] ; @@ -1116,6 +1140,7 @@ class basic-target : abstract-target # # The results are added to the variable called 'result-var'. Usage # requirements are added to the variable called 'usage-requirements-var'. + # rule generate-dependencies ( dependencies * : property-set : result-var usage-requirements-var ) { @@ -1135,6 +1160,7 @@ class basic-target : abstract-target # Determines final build properties, generates sources, and calls # 'construct'. This method should not be overridden. + # rule generate ( property-set ) { if [ modules.peek : .debug-building ] @@ -1267,6 +1293,7 @@ class basic-target : abstract-target # Given the set of generated targets, and refined build properties, # determines and sets appripriate usage requirements on those targets. + # rule compute-usage-requirements ( subvariant ) { local rproperties = [ $(subvariant).build-properties ] ; @@ -1309,6 +1336,7 @@ class basic-target : abstract-target # 'root-targets' - virtual targets to be returned to dependants # 'all-targets' - virtual targets created while building this main target # 'build-request' - property-set instance with requested build properties + # local rule create-subvariant ( root-targets * : all-targets * : build-request : sources * : rproperties : usage-requirements ) @@ -1333,8 +1361,9 @@ class basic-target : abstract-target } # Constructs virtual targets for this abstract target and the dependency - # graph. Returns the list of virtual targets. Should be overriden in derived - # classes. + # graph. Returns a usage-requirements property-set and a list of virtual + # targets. Should be overriden in derived classes. + # rule construct ( name : source-targets * : properties * ) { errors.error "method should be defined in derived classes" ; @@ -1423,6 +1452,7 @@ rule main-target-sources ( sources * : main-target-name : no-renaming ? ) # Returns the requirements to use when declaring a main target, obtained by # translating all specified property paths and refining project requirements # with the ones specified for the target. +# rule main-target-requirements ( specification * # Properties explicitly specified for the main target. : project # Project where the main target is to be declared. @@ -1444,6 +1474,7 @@ rule main-target-requirements ( # Returns the usage requirements to use when declaring a main target, which are # obtained by translating all specified property paths and adding project's # usage requirements. +# rule main-target-usage-requirements ( specification * # Use-properties explicitly specified for a main target. : project # Project where the main target is to be declared. @@ -1466,6 +1497,7 @@ rule main-target-usage-requirements ( # Return the default build value to use when declaring a main target, which is # obtained by using the specified value if not empty and parent's default build # attribute otherwise. +# rule main-target-default-build ( specification * # Default build explicitly specified for a main target. : project # Project where the main target is to be declared. @@ -1485,6 +1517,7 @@ rule main-target-default-build ( # Registers the specified target as a main target alternative and returns it. +# rule main-target-alternative ( target ) { local ptarget = [ $(target).project ] ; @@ -1496,6 +1529,7 @@ rule main-target-alternative ( target ) # Creates a typed-target with the specified properties. The 'name', 'sources', # 'requirements', 'default-build' and 'usage-requirements' are assumed to be in # the form specified by the user in Jamfile corresponding to 'project'. +# rule create-typed-target ( type : project : name : sources * : requirements * : default-build * : usage-requirements * ) { diff --git a/v2/build/virtual-target.jam b/v2/build/virtual-target.jam index 82bc4f56f..8b21b2e90 100644 --- a/v2/build/virtual-target.jam +++ b/v2/build/virtual-target.jam @@ -4,10 +4,10 @@ # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) -# Implements virtual targets, which correspond to actual files created during -# a build, but are not yet targets in Jam sense. They are needed, for example, -# when searching for possible transormation sequences, when it's not yet known -# whether a particular target should be created at all. +# Implements virtual targets, which correspond to actual files created during a +# build, but are not yet targets in Jam sense. They are needed, for example, +# when searching for possible transformation sequences, when it's not yet known +# whether a particular target should be created at all. import "class" : new ; import errors ; @@ -64,6 +64,7 @@ import utility ; # The 'compile-action' and 'link-action' classes are not defined here but in # builtin.jam modules. They are shown in the diagram to give the big picture. + # Models a potential target. It can be converted into a Jam target and used in # building, if needed. However, it can be also dropped, which allows us to # search for different transformations and select only one. @@ -86,12 +87,15 @@ class virtual-target } # Name of this target. + # rule name ( ) { return $(self.name) ; } # Project of this target. + # rule project ( ) { return $(self.project) ; } # Adds additional 'virtual-target' instances this one depends on. + # rule depends ( d + ) { self.dependencies = [ sequence.merge $(self.dependencies) @@ -113,6 +117,7 @@ class virtual-target # file if 'scanner' is specified. # # If scanner is not specified then the actual target is returned. + # rule actualize ( scanner ? ) { local actual-name = [ actualize-no-scanner ] ; @@ -146,12 +151,14 @@ class virtual-target # Sets up build actions for 'target'. Should call appropriate rules and set # target variables. + # rule actualize-action ( target ) { errors.error "method should be defined in derived classes" ; } # Sets up variables on 'target' which specify its location. + # rule actualize-location ( target ) { errors.error "method should be defined in derived classes" ; @@ -159,6 +166,7 @@ class virtual-target # If the target is a generated one, returns the path where it will be # generated. Otherwise, returns an empty list. + # rule path ( ) { errors.error "method should be defined in derived classes" ; @@ -166,6 +174,7 @@ class virtual-target # Returns the actual target name to be used in case when no scanner is # involved. + # rule actual-name ( ) { errors.error "method should be defined in derived classes" ; @@ -175,8 +184,8 @@ class virtual-target rule actualize-no-scanner ( ) { # In fact, we just need to merge virtual-target with - # abstract-virtual-target as the latter is the only class derived from - # the former. But that's for later. + # abstract-file-target as the latter is the only class derived from the + # former. But that's for later. errors.error "method should be defined in derived classes" ; } } @@ -190,6 +199,7 @@ class virtual-target # # The target's grist is concatenation of its project's location, properties of # action (for derived files) and, optionally, value identifying the main target. +# class abstract-file-target : virtual-target { import project ; @@ -230,12 +240,14 @@ class abstract-file-target : virtual-target # Sets the path. When generating target name, it will override any path # computation from properties. + # rule set-path ( path ) { self.path = [ path.native $(path) ] ; } # Returns the currently set action. + # rule action ( ) { return $(self.action) ; @@ -243,6 +255,7 @@ class abstract-file-target : virtual-target # Sets/gets the 'root' flag. Target is root if it directly corresponds to # some variant of a main target. + # rule root ( set ? ) { if $(set) @@ -256,9 +269,10 @@ class abstract-file-target : virtual-target # when target is brought into existance and is never changed after that. In # particular, if a target is shared by a subvariant, only the first is # stored. - rule creating-subvariant ( s ? # If specified, specifies the value to set, - # which should be a 'subvariant' class - # instance. + # + rule creating-subvariant ( s ? # If specified, specifies the value to set, + # which should be a 'subvariant' class + # instance. ) { if $(s) && ! $(self.creating-subvariant) && ! $(overwrite) @@ -333,7 +347,6 @@ class abstract-file-target : virtual-target local grist = [ grist ] ; local basename = [ path.native $(self.name) ] ; self.actual-name = <$(grist)>$(basename) ; - } return $(self.actual-name) ; } @@ -341,6 +354,7 @@ class abstract-file-target : virtual-target # Helper to 'actual-name', above. Computes a unique prefix used to # distinguish this target from other targets with the same name creating # different files. + # rule grist ( ) { # Depending on target, there may be different approaches to generating @@ -379,11 +393,12 @@ class abstract-file-target : virtual-target # Given the target name specified in constructor, returns the name which # should be really used, by looking at the properties. Tag properties - # need to be specified as @rule-name. This makes Boost.Build call the + # need to be specified as @rule-name. This makes Boost Build call the # specified rule with the target name, type and properties to get the new # name. If no property is specified or the rule specified by # returns nothing, returns the result of calling # virtual-target.add-prefix-and-suffix. + # rule _adjust-name ( specified-name ) { local ps ; @@ -468,6 +483,7 @@ class abstract-file-target : virtual-target # Appends the suffix appropriate to 'type/property-set' combination to the # specified name and returns the result. +# rule add-prefix-and-suffix ( specified-name : type ? : property-set ) { local suffix = [ type.generated-target-suffix $(type) : $(property-set) ] ; @@ -546,7 +562,7 @@ class file-target : abstract-file-target DEPENDS $(target) : $(path) ; common.MkDir $(path) ; - # It's possible that the target name includes a directory too, for + # It is possible that the target name includes a directory too, for # example when installing headers. Create that directory. if $(target:D) { @@ -584,6 +600,7 @@ class file-target : abstract-file-target } # Returns the directory for this target. + # rule path ( ) { if ! $(self.path) @@ -616,6 +633,7 @@ class notfile-target : abstract-file-target } # Returns nothing to indicate that the target's path is not known. + # rule path ( ) { return ; @@ -635,7 +653,7 @@ class notfile-target : abstract-file-target # rule action-name ( targets + : sources * : properties * ) # Targets and sources are passed as actual Jam targets. The rule may not # establish additional dependency relationships. - +# class action { import "class" ; @@ -691,6 +709,7 @@ class action } # Generates actual build instructions. + # rule actualize ( ) { if ! $(self.actualized) @@ -733,6 +752,7 @@ class action # Helper for 'actualize-sources'. For each passed source, actualizes it with # the appropriate scanner. Returns the actualized virtual targets. + # rule actualize-source-type ( sources * : property-set ) { local result = ; @@ -756,6 +776,7 @@ class action # # New values will be *appended* to the variables. They may be non-empty if # caller wants it. + # rule actualize-sources ( sources * : property-set ) { local dependencies = [ $(self.properties).get ] ; @@ -786,6 +807,7 @@ class action # the last chance to fix properties, for example to adjust includes to get # generated headers correctly. Default implementation simply returns its # argument. + # rule adjust-properties ( property-set ) { return $(property-set) ; @@ -797,6 +819,7 @@ class action # properties out of nowhere. It's needed to distinguish virtual targets with # different properties that are known to exist and have no actions which create # them. +# class null-action : action { rule __init__ ( property-set ? ) @@ -820,6 +843,7 @@ class null-action : action # Class which acts exactly like 'action', except that its sources are not # scanned for dependencies. +# class non-scanning-action : action { rule __init__ ( sources * : action-name + : property-set ? ) @@ -846,6 +870,7 @@ class non-scanning-action : action # name and source location for the project, and use that path to determine if # the target was already created. # TODO: passing a project with all virtual targets is starting to be annoying. +# rule from-file ( file : file-loc : project ) { import type ; # Had to do this here to break a circular dependency. @@ -880,6 +905,7 @@ rule from-file ( file : file-loc : project ) # same sources and equal action. If such target is found it is returned and a # new 'target' is not registered. Otherwise, 'target' is registered and # returned. +# rule register ( target ) { local signature = [ sequence.join @@ -905,9 +931,9 @@ rule register ( target ) { local ps1 = [ $(a1).properties ] ; local ps2 = [ $(a2).properties ] ; - local p1 = [ $(ps1).base ] [ $(ps1).free ] + local p1 = [ $(ps1).base ] [ $(ps1).free ] [ set.difference [ $(ps1).dependency ] : [ $(ps1).incidental ] ] ; - local p2 = [ $(ps2).base ] [ $(ps2).free ] + local p2 = [ $(ps2).base ] [ $(ps2).free ] [ set.difference [ $(ps2).dependency ] : [ $(ps2).incidental ] ] ; if $(p1) = $(p2) { @@ -934,6 +960,7 @@ rule register ( target ) # Each target returned by 'register' is added to a recent-targets list, returned # by this function. This allows us to find all targets created when building a # given main target, even if the target... !!!MISSING TEXT HERE!!! +# rule recent-targets ( ) { return $(.recent-targets) ; @@ -947,6 +974,7 @@ rule clear-recent-targets ( ) # Returns all virtual targets ever created. +# rule all-targets ( ) { return $(.all-targets) ; @@ -955,6 +983,7 @@ rule all-targets ( ) # Returns all targets from 'targets' with types equal to 'type' or derived from # it. +# rule select-by-type ( type : targets * ) { local result ; @@ -1013,6 +1042,7 @@ rule register-actual-name ( actual-name : virtual-target ) # found during traversal, it's either included or not, depending on the value of # 'include-roots'. In either case traversal stops at root targets, i.e. sources # of root targets are not traversed. +# rule traverse ( target : include-roots ? : include-sources ? ) { local result ; @@ -1046,6 +1076,7 @@ rule traverse ( target : include-roots ? : include-sources ? ) # produced by the action. The rule-name and properties are set to # 'new-rule-name' and 'new-properties', if those are specified. Returns the # cloned action. +# rule clone-action ( action : new-project : new-action-name ? : new-properties ? ) { if ! $(new-action-name) @@ -1059,7 +1090,7 @@ rule clone-action ( action : new-project : new-action-name ? : new-properties ? local action-class = [ modules.peek $(action) : __class__ ] ; local cloned-action = [ class.new $(action-class) - [ $(action).sources ] : $(new-action-name) : $(new-properties) ] ; + [ $(action).sources ] : $(new-action-name) : $(new-properties) ] ; local cloned-targets ; for local target in [ $(action).targets ] @@ -1151,6 +1182,7 @@ class subvariant # indirectly, and either as sources, or as dependency properties. Targets # referred to using the dependency property are returned as properties, not # targets. + # rule all-referenced-targets ( ) { # Find directly referenced targets. @@ -1179,6 +1211,7 @@ class subvariant # referred by properties. For all targets of type # 'target-type' (or for all targets, if 'target-type' is not specified), the # result will contain <$(feature)>path-to-that-target. + # rule implicit-includes ( feature : target-type ? ) { local key = ii$(feature)-$(target-type:E="") ; diff --git a/v2/tools/builtin.jam b/v2/tools/builtin.jam index d0eddf397..5bcc566e3 100644 --- a/v2/tools/builtin.jam +++ b/v2/tools/builtin.jam @@ -449,9 +449,9 @@ scanner.register c-scanner : include ; # which is handled specifically. type.set-scanner CPP : c-scanner ; type.set-scanner C : c-scanner ; -# One case where scanning of H/HPP files is necessary is PCH generation -- -# if any header included by HPP being precompiled changes, we need to -# recompile the header. +# One case where scanning of H/HPP files is necessary is PCH generation -- if +# any header included by HPP being precompiled changes, we need to recompile the +# header. type.set-scanner H : c-scanner ; type.set-scanner HPP : c-scanner ; diff --git a/v2/tools/common.jam b/v2/tools/common.jam index d890ed97b..c03db3bb8 100644 --- a/v2/tools/common.jam +++ b/v2/tools/common.jam @@ -63,6 +63,7 @@ class configurations # # Returns 'true' if the configuration has been added and an empty value if # it already exists. Reports an error if the configuration is 'used'. + # rule register ( id ) { if $(id) in $(self.used) @@ -88,6 +89,7 @@ class configurations # Returns 'true' if the state of the configuration has been changed to # 'used' and an empty value if it the state wasn't changed. Reports an error # if the configuration isn't known. + # rule use ( id ) { if ! $(id) in $(self.all) @@ -109,24 +111,28 @@ class configurations } # Return all registered configurations. + # rule all ( ) { return $(self.all) ; } # Return all used configurations. + # rule used ( ) { return $(self.used) ; } # Returns the value of a configuration parameter. + # rule get ( id : param ) { return $(self.$(param).$(id)) ; } # Sets the value of a configuration parameter. + # rule set ( id : param : value * ) { self.$(param).$(id) = $(value) ; @@ -140,11 +146,12 @@ class configurations # will check that the combination of all parameter values is unique in all # invocations. # -# Each parameter name corresponds to a subfeature. This rule will declare -# a subfeature the first time a non-empty parameter value is passed and will +# Each parameter name corresponds to a subfeature. This rule will declare a +# subfeature the first time a non-empty parameter value is passed and will # extend it with all the values. # # The return value from this rule is a condition to be used for flags settings. +# rule check-init-parameters ( toolset requirement * : * ) { local sig = $(toolset) ; @@ -251,6 +258,7 @@ rule check-init-parameters ( toolset requirement * : * ) # This rule returns the command to be used when invoking the tool. If we can't # find the tool, a warning is issued. If 'path-last' is specified, PATH is # checked after 'additional-paths' when searching for 'tool'. +# rule get-invocation-command-nodefault ( toolset : tool : user-provided-command * : additional-paths * : path-last ? ) { @@ -281,6 +289,7 @@ rule get-invocation-command-nodefault ( # Same as get-invocation-command-nodefault, except that if no tool is found, # returns either the user-provided-command, if present, or the 'tool' parameter. +# rule get-invocation-command ( toolset : tool : user-provided-command * : additional-paths * : path-last ? ) { @@ -304,6 +313,7 @@ rule get-invocation-command ( # Given an invocation command return the absolute path to the command. This # works even if command has no path element and was found on the PATH. +# rule get-absolute-tool-path ( command ) { if $(command:D) @@ -323,6 +333,7 @@ rule get-absolute-tool-path ( command ) # absolute name. If the tool is found in several directories, returns all paths. # Otherwise, returns an empty string. If 'path-last' is specified, PATH is # searched after 'additional-paths'. +# rule find-tool ( name : additional-paths * : path-last ? ) { local path = [ path.programs-path ] ; @@ -358,6 +369,7 @@ rule find-tool ( name : additional-paths * : path-last ? ) # Checks if 'command' can be found either in path or is a full name to an # existing file. +# rule check-tool-aux ( command ) { if $(command:D) @@ -384,6 +396,7 @@ rule check-tool-aux ( command ) # Checks that a tool can be invoked by 'command'. If command is not an absolute # path, checks if it can be found in 'path'. If comand is an absolute path, # check that it exists. Returns 'command' if ok or empty string otherwise. +# rule check-tool ( xcommand + ) { if [ check-tool-aux $(xcommand[1]) ] || @@ -399,8 +412,9 @@ rule check-tool ( xcommand + ) # - CONFIG_COMMAND to 'command' # - OPTIONS for compile.c to the value of in options # - OPTIONS for compile.c++ to the value of in options -# - OPTIOns for compile to the value of in options -# - OPTIONs for link to the value of in options +# - OPTIONS for compile to the value of in options +# - OPTIONS for link to the value of in options +# rule handle-options ( toolset : condition * : command * : options * ) { if $(.debug-configuration) @@ -411,19 +425,20 @@ rule handle-options ( toolset : condition * : command * : options * ) # The last parameter ('true') says it's OK to set flags for another module. toolset.flags $(toolset) CONFIG_COMMAND $(condition) : $(command) : unchecked ; toolset.flags $(toolset).compile OPTIONS $(condition) : - [ feature.get-values : $(options) ] : unchecked ; + [ feature.get-values : $(options) ] : unchecked ; toolset.flags $(toolset).compile.c OPTIONS $(condition) : - [ feature.get-values : $(options) ] : unchecked ; + [ feature.get-values : $(options) ] : unchecked ; toolset.flags $(toolset).compile.c++ OPTIONS $(condition) : - [ feature.get-values : $(options) ] : unchecked ; + [ feature.get-values : $(options) ] : unchecked ; toolset.flags $(toolset).compile.fortran OPTIONS $(condition) : - [ feature.get-values : $(options) ] : unchecked ; + [ feature.get-values : $(options) ] : unchecked ; toolset.flags $(toolset).link OPTIONS $(condition) : - [ feature.get-values : $(options) ] : unchecked ; + [ feature.get-values : $(options) ] : unchecked ; } -# Returns the location of the "program files" directory on a windows platform. +# Returns the location of the "program files" directory on a Windows platform. +# rule get-program-files-dir ( ) { local ProgramFiles = [ modules.peek : ProgramFiles ] ; @@ -471,6 +486,7 @@ rule copy-command ( ) # visible in the environment seen by subsequently executed commands. In other # words, on Unix systems, the variable is exported, which is consistent with the # only possible behavior on Windows systems. +# rule variable-setting-command ( variable : value ) { local nl = " @@ -489,6 +505,7 @@ rule variable-setting-command ( variable : value ) # Returns a command to sets a named shell path variable to the given NATIVE # paths on the current platform. +# rule path-variable-setting-command ( variable : paths * ) { local sep = [ os.path-separator ] ; @@ -498,6 +515,7 @@ rule path-variable-setting-command ( variable : paths * ) # Returns a command that prepends the given paths to the named path variable on # the current platform. +# rule prepend-path-variable-command ( variable : paths * ) { return [ path-variable-setting-command $(variable) @@ -508,6 +526,7 @@ rule prepend-path-variable-command ( variable : paths * ) # Return a command which can create a file. If 'r' is result of invocation, then # 'r foobar' will create foobar with unspecified content. What happens if file # already exists is unspecified. +# rule file-creation-command ( ) { if [ modules.peek : NT ] @@ -524,6 +543,7 @@ rule file-creation-command ( ) # Returns a command that may be used for 'touching' files. It is not a real # 'touch' command on NT because it adds an empty line at the end of file but it # works with source files. +# rule file-touch-command ( ) { if [ os.name ] in NT @@ -550,7 +570,7 @@ rule MkDir $(<)-mkdir = true ; MkDir1 $(<) ; - Depends dirs : $(<) ; + DEPENDS dirs : $(<) ; # Recursively make parent directories. # $(<:P) = $(<)'s parent, & we recurse until root @@ -568,7 +588,7 @@ rule MkDir if $(s) && $(s) != $(<) { - Depends $(<) : $(s) ; + DEPENDS $(<) : $(s) ; MkDir $(s) ; } else if $(s) @@ -703,7 +723,7 @@ rule format-name ( format * : name : type ? : property-set ) result += [ join-tag $(f:G=) : $(p) ] ; } } - + case * : result += $(f:G=) ; } diff --git a/v2/tools/make.jam b/v2/tools/make.jam index 0328b6c1b..319383298 100644 --- a/v2/tools/make.jam +++ b/v2/tools/make.jam @@ -1,9 +1,9 @@ -# Copyright 2003 Dave Abrahams -# Copyright 2003 Douglas Gregor -# Copyright 2006 Rene Rivera -# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) +# Copyright 2003 Dave Abrahams +# Copyright 2003 Douglas Gregor +# Copyright 2006 Rene Rivera +# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) # This module defines the 'make' main target rule. @@ -16,58 +16,56 @@ import regex ; import property-set ; import project ; + class make-target-class : basic-target { - import type regex virtual-target ; + import type regex virtual-target ; import "class" : new ; - + rule __init__ ( name : project : sources * : requirements * : default-build * : usage-requirements * ) - { - basic-target.__init__ $(name) : $(project) : $(sources) + { + basic-target.__init__ $(name) : $(project) : $(sources) : $(requirements) : $(default-build) : $(usage-requirements) ; } - + rule construct ( name : source-targets * : property-set ) { - local action-name = [ $(property-set).get ] ; - # 'm' will always be set -- we add '@' outselfs in 'make' - # rule below. + local action-name = [ $(property-set).get ] ; + # 'm' will always be set -- we add '@' ourselves in 'make' rule below. local m = [ MATCH ^@(.*) : $(action-name) ] ; - + local a = [ new action $(source-targets) : $(m[1]) - : $(property-set) ] ; - local t = [ new file-target $(self.name) exact - : [ type.type $(self.name) ] : $(self.project) : $(a) ] ; + : $(property-set) ] ; + local t = [ new file-target $(self.name) exact + : [ type.type $(self.name) ] : $(self.project) : $(a) ] ; return [ property-set.empty ] [ virtual-target.register $(t) ] ; - } + } } # Declares the 'make' main target. +# rule make ( target-name : sources * : generating-rule + : requirements * : usage-requirements * ) { local project = [ project.current ] ; - - # The '@' sign causes the feature.jam module to qualify rule name - # with the module name of current project, if needed. + + # The '@' sign causes the feature.jam module to qualify rule name with the + # module name of current project, if needed. local m = [ MATCH ^(@).* : $(generating-rule) ] ; if ! $(m) { generating-rule = @$(generating-rule) ; - } + } requirements += $(generating-rule) ; - + targets.main-target-alternative [ new make-target-class $(target-name) : $(project) - : [ targets.main-target-sources $(sources) : $(target-name) ] - : [ targets.main-target-requirements $(requirements) : $(project) ] - : [ targets.main-target-default-build : $(project) ] + : [ targets.main-target-sources $(sources) : $(target-name) ] + : [ targets.main-target-requirements $(requirements) : $(project) ] + : [ targets.main-target-default-build : $(project) ] : [ targets.main-target-usage-requirements $(usage-requirements) : $(project) ] ] ; - } IMPORT $(__name__) : make : : make ; - - diff --git a/v2/util/path.jam b/v2/util/path.jam index b5eae854c..bb30285aa 100644 --- a/v2/util/path.jam +++ b/v2/util/path.jam @@ -6,16 +6,16 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -# Performs various path manipulations. Paths are always in a 'normalized' -# representation. In it, a path may be either: +# Performs various path manipulations. Paths are always in a 'normalized' +# representation. In it, a path may be either: # # - '.', or # -# - ['/'] [ ( '..' '/' )* (token '/')* token ] +# - ['/'] [ ( '..' '/' )* (token '/')* token ] # -# In plain english, path can be rooted, '..' elements are allowed only -# at the beginning, and it never ends in slash, except for path consisting -# of slash only. +# In plain english, path can be rooted, '..' elements are allowed only at the +# beginning, and it never ends in slash, except for path consisting of slash +# only. import errors ; import modules ; @@ -35,7 +35,7 @@ if [ modules.peek : UNIX ] } } -# Converts the native path into normalized form. +# Converts the native path into normalized form. # rule make ( native ) { @@ -43,7 +43,7 @@ rule make ( native ) } -# Builds native representation of the path. +# Builds native representation of the path. # rule native ( path ) { @@ -51,7 +51,7 @@ rule native ( path ) } -# Tests if a path is rooted. +# Tests if a path is rooted. # rule is-rooted ( path ) { @@ -59,7 +59,7 @@ rule is-rooted ( path ) } -# Tests if a path has a parent. +# Tests if a path has a parent. # rule has-parent ( path ) { @@ -74,7 +74,7 @@ rule has-parent ( path ) } -# Returns the path without any directory components. +# Returns the path without any directory components. # rule basename ( path ) { @@ -82,7 +82,7 @@ rule basename ( path ) } -# Returns parent directory of the path. If no parent exists, error is issued. +# Returns parent directory of the path. If no parent exists, error is issued. # rule parent ( path ) { @@ -94,8 +94,8 @@ rule parent ( path ) } else { - # Strip everything at the end of path up to and including - # the last slash + # Strip everything at the end of path up to and including the last + # slash. local result = [ regex.match "((.*)/)?([^/]+)" : $(path) : 2 3 ] ; # Did we strip what we shouldn't? @@ -127,8 +127,8 @@ rule parent ( path ) } -# Returns path2 such that "[ join path path2 ] = .". -# The path may not contain ".." element or be rooted. +# Returns path2 such that "[ join path path2 ] = .". The path may not contain +# ".." element or be rooted. # rule reverse ( path ) { @@ -150,8 +150,8 @@ rule reverse ( path ) # Auxillary rule: does all the semantic of 'join', except for error cheching. -# The error checking is separated because this rule is recursive, and I don't -# like the idea of checking the same input over and over. +# The error checking has been separated because this rule is recursive, and I +# do not like the idea of checking the same input over and over. # local rule join-imp ( elements + ) { @@ -168,8 +168,8 @@ local rule join-imp ( elements + ) } -# Contanenates the passed path elements. Generates an error if -# any element other than the first one is rooted. +# Concatenates the passed path elements. Generates an error if any element other +# than the first one is rooted. # rule join ( elements + ) { @@ -191,7 +191,7 @@ rule join ( elements + ) } -# If 'path' is relative, it is rooted at 'root'. Otherwise, it's unchanged. +# If 'path' is relative, it is rooted at 'root'. Otherwise, it's unchanged. # rule root ( path root ) { @@ -203,7 +203,7 @@ rule root ( path root ) } -# Returns the current working directory. +# Returns the current working directory. # rule pwd ( ) { @@ -219,19 +219,20 @@ rule pwd ( ) } -# Returns the list of files matching the given pattern in the -# specified directory. Both directories and patterns are -# supplied as portable paths. Each pattern should be non-absolute -# path, and can't contain "." or ".." elements. Each slash separated -# element of pattern can contain the following special characters: -# - '?', which match any character -# - '*', which matches arbitrary number of characters. -# A file $(d)/e1/e2/e3 (where 'd' is in $(dirs)) matches pattern p1/p2/p3 -# if and only if e1 matches p1, e2 matches p2 and so on. +# Returns the list of files matching the given pattern in the specified +# directory. Both directories and patterns are supplied as portable paths. Each +# pattern should be non-absolute path, and can't contain "." or ".." elements. +# Each slash separated element of pattern can contain the following special +# characters: +# - '?', which match any character +# - '*', which matches arbitrary number of characters. +# A file $(d)/e1/e2/e3 (where 'd' is in $(dirs)) matches pattern p1/p2/p3 if and +# only if e1 matches p1, e2 matches p2 and so on. +# +# For example: +# [ glob . : *.cpp ] +# [ glob . : */build/Jamfile ] # -# For example: -# [ glob . : *.cpp ] -# [ glob . : */build/Jamfile ] rule glob ( dirs * : patterns + : exclude-patterns * ) { local result ; @@ -262,12 +263,11 @@ rule glob ( dirs * : patterns + : exclude-patterns * ) } -# Recursive version of GLOB. Builds the glob of files while -# also searching in the subdirectories of the given roots. An -# optional set of exclusion patterns will filter out the -# matching entries from the result. The exclusions also apply -# to the subdirectory scanning, such that directories that -# match the exclusion patterns will not be searched. +# Recursive version of GLOB. Builds the glob of files while also searching in +# the subdirectories of the given roots. An optional set of exclusion patterns +# will filter out the matching entries from the result. The exclusions also +# apply to the subdirectory scanning, such that directories that match the +# exclusion patterns will not be searched. # rule glob-tree ( roots * : patterns + : exclude-patterns * ) { @@ -311,9 +311,9 @@ rule exists ( file ) NATIVE_RULE path : exists ; -# Find out the absolute name of path and returns the list of all the parents, -# starting with the immediate one. Parents are returned as relative names. -# If 'upper_limit' is specified, directories above it will be pruned. +# Find out the absolute name of path and returns the list of all the parents, +# starting with the immediate one. Parents are returned as relative names. If +# 'upper_limit' is specified, directories above it will be pruned. # rule all-parents ( path : upper_limit ? : cwd ? ) { @@ -349,8 +349,8 @@ rule all-parents ( path : upper_limit ? : cwd ? ) } -# Search for 'pattern' in parent directories of 'dir', up till and including -# 'upper_limit', if it is specified, or till the filesystem root otherwise. +# Search for 'pattern' in parent directories of 'dir', up till and including +# 'upper_limit', if it is specified, or till the filesystem root otherwise. # rule glob-in-parents ( dir : patterns + : upper-limit ? ) { @@ -366,8 +366,8 @@ rule glob-in-parents ( dir : patterns + : upper-limit ? ) } -# Assuming 'child' is a subdirectory of 'parent', return the relative -# path from 'parent' to 'child' +# Assuming 'child' is a subdirectory of 'parent', return the relative path from +# 'parent' to 'child'. # rule relative ( child parent ) { @@ -429,8 +429,9 @@ rule relative-to ( path1 path2 ) } -# Returns the list of paths which are used by the operating system -# for looking up programs +# Returns the list of paths which are used by the operating system for looking +# up programs. +# rule programs-path ( ) { local result ; @@ -451,10 +452,10 @@ rule make-NT ( native ) local tokens = [ regex.split $(native) "[/\\]" ] ; local result ; - # Handle paths ending with slashes + # Handle paths ending with slashes. if $(tokens[-1]) = "" { - tokens = $(tokens[1--2]) ; # discard the empty element + tokens = $(tokens[1--2]) ; # Discard the empty element. } result = [ path.join $(tokens) ] ; @@ -518,16 +519,17 @@ rule make-CYGWIN ( path ) rule native-CYGWIN ( path ) { local result = $(path) ; - if [ regex.match "(^/.:)" : $(path) ] # win absolute + if [ regex.match "(^/.:)" : $(path) ] # Windows absolute path. { - result = [ MATCH "^/?(.*)" : $(path) ] ; # remove leading '/' + result = [ MATCH "^/?(.*)" : $(path) ] ; # Remove leading '/'. } return [ native-UNIX $(result) ] ; } -# split-VMS: splits input native path into -# device dir file (each part is optional), +# split-path-VMS: splits input native path into device dir file (each part is +# optional). +# # example: # # dev:[dir]file.c => dev: [dir] file.c @@ -545,12 +547,11 @@ rule split-path-VMS ( native ) # Converts a native VMS path into a portable path spec. # -# Does not handle current-device absolute paths such -# as "[dir]File.c" as it is not clear how to represent -# them in the portable path notation. +# Does not handle current-device absolute paths such as "[dir]File.c" as it is +# not clear how to represent them in the portable path notation. # -# Adds a trailing dot (".") to the file part if no extension -# is present (helps when converting it back into native path). +# Adds a trailing dot (".") to the file part if no extension is present (helps +# when converting it back into native path). # rule make-VMS ( native ) { @@ -621,8 +622,8 @@ rule make-VMS ( native ) # Converts a portable path spec into a native VMS path. # -# Relies on having at least one dot (".") included in the file -# name to be able to differentiate it ftom the directory part. +# Relies on having at least one dot (".") included in the file name to be able +# to differentiate it from the directory part. # rule native-VMS ( path ) {