diff --git a/doc/src/tasks.xml b/doc/src/tasks.xml index 4a37c0f8e..0d7549988 100644 --- a/doc/src/tasks.xml +++ b/doc/src/tasks.xml @@ -457,10 +457,12 @@ rule run ( sources + : args * : input-files * : requirements * : target-name ? - The run and the run-fail rules, if the test - passes, automatically delete the linked executable, to save space. This - behaviour can be suppressed by passing the - --preserve-test-targets command line option. + preserve-test-targets + If the preserve-test-targets feature has the value + off, then run and the run-fail + rules will remove the executable after running it. This somewhat decreases + disk space requirements for continuous testing environments. The default + value of preserve-test-targets feature is on. diff --git a/example/built_tool/Jamroot.jam b/example/built_tool/Jamroot.jam new file mode 100644 index 000000000..c458650e8 --- /dev/null +++ b/example/built_tool/Jamroot.jam @@ -0,0 +1,8 @@ + +import feature ; + +feature.feature tblgen : : dependency free ; + +project built_tool ; + +build-project core ; \ No newline at end of file diff --git a/example/built_tool/core/Jamfile.jam b/example/built_tool/core/Jamfile.jam new file mode 100644 index 000000000..2d96f7182 --- /dev/null +++ b/example/built_tool/core/Jamfile.jam @@ -0,0 +1,30 @@ + +import toolset ; + +project : requirements ../tblgen//tblgen ; + + +# Create a.c using a custom action defined below. +make a.c : a.td : @tblgen ; + +# Use a.c in executable. +exe core : core.cpp a.c ; + +# The action has to invoke the tool built in other +# parts of the project. The feature is used +# to specify the location of the tool, and the flags +# statement below make the full path to the tool +# available inside the action. +toolset.flags tblgen COMMAND ; + +# We generally want a.c to be rebuilt when the tool changes. +rule tblgen ( targets * : sources * : properties * ) +{ + DEPENDS $(targets) : [ on $(targets) return $(COMMAND) ] ; +} + +# The action that invokes the tool +actions tblgen bind COMMAND +{ + $(COMMAND:E=tblgen) > $(<) +} diff --git a/example/built_tool/core/a.td b/example/built_tool/core/a.td new file mode 100644 index 000000000..e69de29bb diff --git a/example/built_tool/core/core.cpp b/example/built_tool/core/core.cpp new file mode 100644 index 000000000..31a133726 --- /dev/null +++ b/example/built_tool/core/core.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/example/built_tool/readme.txt b/example/built_tool/readme.txt new file mode 100644 index 000000000..bbb9f9b3a --- /dev/null +++ b/example/built_tool/readme.txt @@ -0,0 +1,5 @@ + +This example shows how to build an executable and then use it +for generating other targets. The 'tblgen' subdirectory builds +a tool, while the 'core' subdirectory uses that tool. Refer +to core/Jamfile.jam for detailed comments. \ No newline at end of file diff --git a/example/built_tool/tblgen/Jamfile.jam b/example/built_tool/tblgen/Jamfile.jam new file mode 100644 index 000000000..af4906278 --- /dev/null +++ b/example/built_tool/tblgen/Jamfile.jam @@ -0,0 +1,4 @@ + +project : requirements -tblgen//tblgen ; + +exe tblgen : tblgen.cpp ; \ No newline at end of file diff --git a/example/built_tool/tblgen/tblgen.cpp b/example/built_tool/tblgen/tblgen.cpp new file mode 100644 index 000000000..fbd058133 --- /dev/null +++ b/example/built_tool/tblgen/tblgen.cpp @@ -0,0 +1,9 @@ + +#include + +int main() +{ + std::cout << "int foo;\n"; + return 0; +} + diff --git a/example/generate/jamroot.jam b/example/generate/jamroot.jam index bc8563a4a..a244f65fc 100644 --- a/example/generate/jamroot.jam +++ b/example/generate/jamroot.jam @@ -2,32 +2,28 @@ # 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) -import common ; import "class" : new ; +import common ; rule generate-example ( project name : property-set : sources * ) { local result ; for local s in $(sources) { - #local ea = [ $(s).action ] ; - #local ep = [ $(ea).properties ] ; + #local source-name = [ $(s).name ] ; + #local source-action = [ $(s).action ] ; + #local source-properties = [ $(source-action).properties ] ; - # Create a new action, that takes the source target - # and runs 'common.copy' comamnd on it. - local a = [ - new non-scanning-action $(s) : common.copy : $(property-set) ] ; + # Create a new action, that takes the source target and runs the + # 'common.copy' command on it. + local a = [ new non-scanning-action $(s) : common.copy : $(property-set) + ] ; - local source-name = [ $(s).name ] ; - - # Create the target to represent the result of the action. - # The target has the name that was specified in Jamfile - # and passed here via the 'name' parameter, - # and the same type and project as the source. - result += [ new file-target $(name) - : [ $(s).type ] - : $(project) - : $(a) ] ; + # Create a target to represent the action result. Uses the target name + # passed here via the 'name' parameter and the same type and project as + # the source. + result += [ new file-target $(name) : [ $(s).type ] : $(project) : $(a) + ] ; } return $(result) ; } diff --git a/src/build-system.jam b/src/build-system.jam index 0a3b571c3..ef2e83068 100644 --- a/src/build-system.jam +++ b/src/build-system.jam @@ -388,6 +388,24 @@ local rule load-configuration-files ECHO "notice: User configuration file loading explicitly disabled." ; } } + + # We look for project-config.jam from "." upward. + # I am not sure this is 100% right decision, we might as well check for + # it only alonside the Jamroot file. However: + # + # - We need to load project-root.jam before Jamroot + # - We probably would need to load project-root.jam even if there's no + # Jamroot - e.g. to implement automake-style out-of-tree builds. + local file = [ path.glob "." : project-config.jam ] ; + if ! $(file) + { + file = [ path.glob-in-parents "." : project-config.jam ] ; + } + if $(file) + { + initialize-config-module project-config ; + load-config project-config : project-config.jam : $(file:D) ; + } } diff --git a/src/build/feature.jam b/src/build/feature.jam index 4982524a4..0005405eb 100644 --- a/src/build/feature.jam +++ b/src/build/feature.jam @@ -469,7 +469,9 @@ rule validate-value-string ( feature value-string ) if $($(feature).subfeatures) { - values = [ regex.split $(value-string) - ] ; + if ! ( $(value-string) in $($(feature).subfeatures) ) { + values = [ regex.split $(value-string) - ] ; + } } if ! ( $(values[1]) in $($(feature).values) ) && diff --git a/src/build/project.jam b/src/build/project.jam index d7af1fb3b..53c32d027 100644 --- a/src/build/project.jam +++ b/src/build/project.jam @@ -439,6 +439,10 @@ rule initialize ( { parent-module = site-config ; } + else if $(module-name) = project-config + { + parent-module = user-config ; + } else { # We search for parent/project-root only if Jamfile was specified, i.e. @@ -453,7 +457,15 @@ rule initialize ( # inherit from user-config. if $(location) { - parent-module = user-config ; + # If project-config module exist, inherit from it. + if $(project-config.attributes) + { + parent-module = project-config ; + } + else + { + parent-module = user-config ; + } jamroot = true ; } } diff --git a/src/build/targets.jam b/src/build/targets.jam index 20da57988..a7aa2c008 100644 --- a/src/build/targets.jam +++ b/src/build/targets.jam @@ -78,6 +78,7 @@ import property-set ; import sequence ; import set ; import toolset ; +import build-request ; # Base class for all abstract targets. @@ -557,7 +558,6 @@ local rule end-building ( main-target-instance ) class main-target : abstract-target { import assert ; - import build-request ; import errors ; import feature ; import print ; @@ -657,65 +657,8 @@ class main-target : abstract-target rule apply-default-build ( property-set ) { - # 1. First, see what properties from default-build are already present - # in property-set. - - local raw = [ $(property-set).raw ] ; - local specified-features = $(raw:G) ; - - local defaults-to-apply ; - for local d in [ $(self.default-build).raw ] - { - if ! $(d:G) in $(specified-features) - { - defaults-to-apply += $(d) ; - } - } - - # 2. If there are any defaults to be applied, form a new build request. - # Pass it through to 'expand-no-defaults' since default-build might - # contain "release debug" resulting in two property-sets. - local result ; - if $(defaults-to-apply) - { - properties = [ - build-request.expand-no-defaults - - # We have to compress subproperties here to prevent property - # lists like: - # - # msvc 7.1 multi - # - # from being expanded into: - # - # 7.1/multi - # msvc/7.1/multi - # - # due to a cross-product property combination. That may be an - # indication that build-request.expand-no-defaults is the wrong - # rule to use here. - [ feature.compress-subproperties $(raw) ] - $(defaults-to-apply) - ] ; - - if $(properties) - { - for local p in $(properties) - { - result += [ property-set.create - [ feature.expand [ feature.split $(p) ] ] ] ; - } - } - else - { - result = [ property-set.empty ] ; - } - } - else - { - result = $(property-set) ; - } - return $(result) ; + return [ targets.apply-default-build $(property-set) + : $(self.default-build) ] ; } # Select an alternative for this main target, by finding all alternatives @@ -883,6 +826,69 @@ rule generate-from-reference ( return [ $(target).generate $(rproperties) ] ; } +rule apply-default-build ( property-set : default-build ) +{ + # 1. First, see what properties from default-build are already present + # in property-set. + + local raw = [ $(property-set).raw ] ; + local specified-features = $(raw:G) ; + + local defaults-to-apply ; + for local d in [ $(default-build).raw ] + { + if ! $(d:G) in $(specified-features) + { + defaults-to-apply += $(d) ; + } + } + + # 2. If there are any defaults to be applied, form a new build request. + # Pass it through to 'expand-no-defaults' since default-build might + # contain "release debug" resulting in two property-sets. + local result ; + if $(defaults-to-apply) + { + properties = [ + build-request.expand-no-defaults + + # We have to compress subproperties here to prevent property + # lists like: + # + # msvc 7.1 multi + # + # from being expanded into: + # + # 7.1/multi + # msvc/7.1/multi + # + # due to a cross-product property combination. That may be an + # indication that build-request.expand-no-defaults is the wrong + # rule to use here. + [ feature.compress-subproperties $(raw) ] + $(defaults-to-apply) + ] ; + + if $(properties) + { + for local p in $(properties) + { + result += [ property-set.create + [ feature.expand [ feature.split $(p) ] ] ] ; + } + } + else + { + result = [ property-set.empty ] ; + } + } + else + { + result = $(property-set) ; + } + return $(result) ; +} + # Given a build request and requirements, return properties common to dependency # build request and target requirements. @@ -1559,6 +1565,23 @@ rule main-target-alternative ( target ) return $(target) ; } +# Creates a new metargets with the specified properties, using 'klass' as +# the class. 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-metatarget ( klass : project : name : sources * : requirements * : + default-build * : usage-requirements * ) +{ + return [ + targets.main-target-alternative + [ new $(klass) $(name) : $(project) + : [ targets.main-target-sources $(sources) : $(name) ] + : [ targets.main-target-requirements $(requirements) : $(project) ] + : [ targets.main-target-default-build $(default-build) : $(project) ] + : [ targets.main-target-usage-requirements $(usage-requirements) : $(project) ] + ] ] ; +} # Creates a typed-target with the specified properties. The 'name', 'sources', # 'requirements', 'default-build' and 'usage-requirements' are assumed to be in diff --git a/src/build/type.jam b/src/build/type.jam index fdd9acc8f..1a7a57823 100644 --- a/src/build/type.jam +++ b/src/build/type.jam @@ -117,7 +117,7 @@ rule register-suffixes ( suffixes + : type ) { .type.$(s) = $(type) ; } - else if $(.type.$(s)) != type + else if $(.type.$(s)) != $(type) { errors.error Attempting to specify multiple types for suffix \"$(s)\" : "Old type $(.type.$(s)), New type $(type)" ; diff --git a/src/build/virtual-target.jam b/src/build/virtual-target.jam index ac6f58247..9c2874e8b 100644 --- a/src/build/virtual-target.jam +++ b/src/build/virtual-target.jam @@ -655,6 +655,8 @@ class notfile-target : abstract-file-target { NOTFILE $(target) ; ALWAYS $(target) ; + # TEMPORARY $(target) ; + NOUPDATE $(target) ; } } @@ -675,6 +677,7 @@ class action import property-set ; import indirect ; import path ; + import set : difference ; rule __init__ ( sources * : action-name + : property-set ? ) { @@ -700,6 +703,12 @@ class action self.targets += $(targets) ; } + rule replace-targets ( old-targets * : new-targets * ) + { + self.targets = [ set.difference $(self.targets) : $(old-targets) ] ; + self.targets += $(new-targets) ; + } + rule targets ( ) { return $(self.targets) ; diff --git a/src/tools/acc.jam b/src/tools/acc.jam index e5a35b683..0f8c4c113 100644 --- a/src/tools/acc.jam +++ b/src/tools/acc.jam @@ -63,6 +63,9 @@ flags acc LINKFLAGS off : -s ; flags acc CFLAGS on : -pg ; flags acc LINKFLAGS on : -pg ; +flags acc CFLAGS 64 : +DD64 ; +flags acc LINKFLAGS 64 : +DD64 ; + flags acc CFLAGS ; flags acc C++FLAGS ; flags acc DEFINES ; diff --git a/src/tools/boostbook.jam b/src/tools/boostbook.jam index 946a65698..bdb14b78e 100644 --- a/src/tools/boostbook.jam +++ b/src/tools/boostbook.jam @@ -312,7 +312,6 @@ class boostbook-generator : generator local catalog = $(global-catalog[1]) ; local catalog-file = $(global-catalog[2]) ; local targets ; - local targets ; # Add the catalog to the property set property-set = [ $(property-set).add-raw $(catalog-file) ] ; diff --git a/src/tools/common.jam b/src/tools/common.jam index d37c14d7a..20f52d52e 100644 --- a/src/tools/common.jam +++ b/src/tools/common.jam @@ -559,6 +559,23 @@ rule file-creation-command ( ) { if [ os.name ] = NT { + # A few alternative implementations on Windows: + # + # 'type NUL >> ' + # That would construct an empty file instead of a file containing + # a space and an end-of-line marker but it would also not change + # the target's timestamp in case the file already exists. + # + # 'type NUL > ' + # That would construct an empty file instead of a file containing + # a space and an end-of-line marker but it would also destroy an + # already existing file by overwriting it with an empty one. + # + # I guess the best solution would be to allow Boost Jam to define + # built-in functions such as 'create a file', 'touch a file' or 'copy a + # file' which could be used from inside action code. That would allow + # completely portable operations without this kind of kludge. + # (22.02.2009.) (Jurko) return "echo. > " ; } else diff --git a/src/tools/darwin.jam b/src/tools/darwin.jam index e7652cb5c..925db1b91 100644 --- a/src/tools/darwin.jam +++ b/src/tools/darwin.jam @@ -91,6 +91,9 @@ rule init ( version ? : command * : options * : requirement * ) # - The configured compile driver command. local command = [ common.get-invocation-command darwin : g++ : $(command) ] ; + # The version as reported by the compiler + local real-version ; + # - Autodetect the root and bin dir if not given. if $(command) { @@ -113,8 +116,9 @@ rule init ( version ? : command * : options * : requirement * ) # - The 'command' variable can have multiple elements. When calling # the SHELL builtin we need a single string. local command-string = $(command:J=" ") ; - version ?= [ MATCH "^([0-9.]+)" + real-version = [ MATCH "^([0-9.]+)" : [ SHELL "$(command-string) -dumpversion" ] ] ; + version ?= $(real-version) ; } # - Define the condition for this toolset instance. @@ -125,12 +129,12 @@ rule init ( version ? : command * : options * : requirement * ) common.handle-options darwin : $(condition) : $(command) : $(options) ; # - GCC 4.0 and higher in Darwin does not have -fcoalesce-templates. - if $(version) < "4.0.0" + if $(real-version) < "4.0.0" { flags darwin.compile.c++ OPTIONS $(condition) : -fcoalesce-templates ; } # - GCC 4.2 and higher in Darwin does not have -Wno-long-double. - if $(version) < "4.2.0" + if $(real-version) < "4.2.0" { flags darwin.compile OPTIONS $(condition) : -Wno-long-double ; } diff --git a/src/tools/docutils.jam b/src/tools/docutils.jam old mode 100755 new mode 100644 index d6155ecfe..9055f8d53 --- a/src/tools/docutils.jam +++ b/src/tools/docutils.jam @@ -42,15 +42,19 @@ type.set-scanner ReST : rst-scanner ; generators.register-standard docutils.html : ReST : HTML ; -rule init ( docutils-dir ? ) +rule init ( docutils-dir ? : tools-dir ? ) { + ECHO docutils-dir= $(docutils-dir) ; docutils-dir ?= [ modules.peek : DOCUTILS_DIR ] ; + ECHO tools-dir= $(tools-dir) ; + tools-dir ?= $(docutils-dir)/tools ; if ! $(.initialized) { .initialized = true ; .docutils-dir = $(docutils-dir) ; - + .tools-dir = $(tools-dir:R="") ; + .setup = [ common.prepend-path-variable-command PYTHONPATH : $(.docutils-dir) $(.docutils-dir)/extras ] ; @@ -62,7 +66,7 @@ rule html ( target : source : properties * ) if ! [ on $(target) return $(RST2XXX) ] { local python-cmd = [ property.select : $(properties) ] ; - RST2XXX on $(target) = $(python-cmd:G=:E="python") $(.docutils-dir)/tools/rst2html.py ; + RST2XXX on $(target) = $(python-cmd:G=:E="python") $(.tools-dir)/rst2html.py ; } } diff --git a/src/tools/intel-darwin.jam b/src/tools/intel-darwin.jam index 9a5ef9982..aa0fd8fb6 100644 --- a/src/tools/intel-darwin.jam +++ b/src/tools/intel-darwin.jam @@ -17,7 +17,12 @@ import generators ; feature.extend-subfeature toolset intel : platform : darwin ; toolset.inherit-generators intel-darwin - intel darwin : gcc : gcc.mingw.link gcc.mingw.link.dll ; + intel darwin + : gcc + # Don't inherit PCH generators. They were not tested, and probably + # don't work for this compiler. + : gcc.mingw.link gcc.mingw.link.dll gcc.compile.c.pch gcc.compile.c++.pch + ; generators.override intel-darwin.prebuilt : builtin.lib-generator ; generators.override intel-darwin.prebuilt : builtin.prebuilt ; diff --git a/src/tools/intel-linux.jam b/src/tools/intel-linux.jam index 66897e412..de5bf8c7c 100644 --- a/src/tools/intel-linux.jam +++ b/src/tools/intel-linux.jam @@ -13,6 +13,8 @@ import gcc ; import common ; import errors ; import generators ; +import type ; +import numbers ; feature.extend-subfeature toolset intel : platform : linux ; @@ -22,6 +24,12 @@ generators.override intel-linux.prebuilt : builtin.lib-generator ; generators.override intel-linux.prebuilt : builtin.prebuilt ; generators.override intel-linux.searched-lib-generator : searched-lib-generator ; +# Override default do-nothing generators. +generators.override intel-linux.compile.c.pch : pch.default-c-pch-generator ; +generators.override intel-linux.compile.c++.pch : pch.default-cpp-pch-generator ; + +type.set-generated-target-suffix PCH : intel linux : pchi ; + toolset.inherit-rules intel-linux : gcc ; toolset.inherit-flags intel-linux : gcc : off on full space @@ -55,7 +63,27 @@ rule init ( version ? : command * : options * ) { bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ; root ?= $(bin:D) ; - + + local command-string = $(command:J=" ") ; + local version-output = [ SHELL "$(command-string) --version" ] ; + local real-version = [ MATCH "([0-9.]+)" : $(version-output) ] ; + local major = [ MATCH "([0-9]+).*" : $(real-version) ] ; + + # If we failed to determine major version, use the behaviour for + # the current compiler. + if $(major) && [ numbers.less $(major) 10 ] + { + flags intel-linux.compile OPTIONS $(condition)/off : "-Ob0" ; + flags intel-linux.compile OPTIONS $(condition)/on : "-Ob1" ; + flags intel-linux.compile OPTIONS $(condition)/full : "-Ob2" ; + } + else + { + flags intel-linux.compile OPTIONS $(condition)/off : "-inline-level=0" ; + flags intel-linux.compile OPTIONS $(condition)/on : "-inline-level=1" ; + flags intel-linux.compile OPTIONS $(condition)/full : "-inline-level=2" ; + } + if $(root) { # Libraries required to run the executable may be in either @@ -74,9 +102,6 @@ rule init ( version ? : command * : options * ) SPACE = " " ; -flags intel-linux.compile OPTIONS off : "-Ob0" ; -flags intel-linux.compile OPTIONS on : "-Ob1" ; -flags intel-linux.compile OPTIONS full : "-Ob2" ; flags intel-linux.compile OPTIONS space : "-O1" ; # no specific space optimization flag in icc flags intel-linux.compile OPTIONS off : -w0 ; @@ -87,22 +112,50 @@ rule compile.c++ ( targets * : sources * : properties * ) { gcc.setup-threading $(targets) : $(sources) : $(properties) ; gcc.setup-fpic $(targets) : $(sources) : $(properties) ; + DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; } -actions compile.c++ +actions compile.c++ bind PCH_FILE { - "$(CONFIG_COMMAND)" -c -xc++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" + "$(CONFIG_COMMAND)" -c -xc++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -use-pch"$(PCH_FILE)" -c -o "$(<)" "$(>)" } rule compile.c ( targets * : sources * : properties * ) { gcc.setup-threading $(targets) : $(sources) : $(properties) ; gcc.setup-fpic $(targets) : $(sources) : $(properties) ; + DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; } -actions compile.c +actions compile.c bind PCH_FILE { - "$(CONFIG_COMMAND)" -c -xc $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" + "$(CONFIG_COMMAND)" -c -xc $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -use-pch"$(PCH_FILE)" -c -o "$(<)" "$(>)" +} + +rule compile.c++.pch ( targets * : sources * : properties * ) +{ + gcc.setup-threading $(targets) : $(sources) : $(properties) ; + gcc.setup-fpic $(targets) : $(sources) : $(properties) ; +} +# +# Compiling a pch first deletes any existing *.pchi file, as Intel's compiler +# won't over-write an existing pch: instead it creates filename$1.pchi, filename$2.pchi +# etc - which appear not to do anything except take up disk space :-( +# +actions compile.c++.pch +{ + rm -f "$(<)" && "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -pch-create "$(<)" "$(>)" +} + +rule compile.c.pch ( targets * : sources * : properties * ) +{ + gcc.setup-threading $(targets) : $(sources) : $(properties) ; + gcc.setup-fpic $(targets) : $(sources) : $(properties) ; +} + +actions compile.c.pch +{ + rm -f "$(<)" && "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -pch-create "$(<)" "$(>)" } rule link ( targets * : sources * : properties * ) @@ -129,3 +182,6 @@ actions link.dll bind LIBRARIES { "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-soname$(SPACE)-Wl,$(<[1]:D=) -shared "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) } + + + diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam index b59703420..372757e8e 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -988,16 +988,22 @@ class msvc-linking-generator : linking-generator { local result = [ linking-generator.generated-targets $(sources) : $(property-set) : $(project) $(name) ] ; - if [ $(property-set).get ] = "off" + + if $(result) { - if ! $(name) - { - name = [ determine-output-name $(sources) ] ; - } - + local name = [ $(result[0]).name ] ; local action = [ $(result[0]).action ] ; - result += [ virtual-target.register - [ class.new file-target $(name) : MANIFEST : $(project) : $(action) ] ] ; + + if [ $(property-set).get ] = "off" + { + local target = [ class.new file-target $(name) : MANIFEST : $(project) : $(action) ] ; + local registered-target = [ virtual-target.register $(target) ] ; + if $(action) && ( $(target) != $(registered-target) ) + { + $(action).replace-targets $(target) : $(registered-target) ; + } + result += $(registered-target) ; + } } return $(result) ; } diff --git a/src/tools/pathscale.jam b/src/tools/pathscale.jam index 3042750d0..1a81444e1 100644 --- a/src/tools/pathscale.jam +++ b/src/tools/pathscale.jam @@ -13,7 +13,7 @@ import fortran ; feature.extend toolset : pathscale ; toolset.inherit pathscale : unix ; -generators.override pathscale.prebuilt : builtin.lib-generator ; +generators.override pathscale.prebuilt : builtin.prebuilt ; generators.override pathscale.searched-lib-generator : searched-lib-generator ; # Documentation and toolchain description located diff --git a/src/tools/stlport.jam b/src/tools/stlport.jam index 4390585ba..d6d2dc6bc 100644 --- a/src/tools/stlport.jam +++ b/src/tools/stlport.jam @@ -142,7 +142,14 @@ class stlport-target-class : basic-target name += _static ; } - name += .$(self.version.5) ; + # Starting with version 5.2.0, the STLport static libraries no longer + # include a version number in their name + local version.pre.5.2 = [ MATCH "^(5[.][01]+).*" : $(version) ] ; + if $(version.pre.5.2) || [ feature.get-values : $(raw) ] != "static" + { + name += .$(self.version.5) ; + } + name = $(name:J=) ; if [ feature.get-values : $(raw) ] = "on" diff --git a/src/tools/sun.jam b/src/tools/sun.jam index 539fd3003..8f10d6a44 100644 --- a/src/tools/sun.jam +++ b/src/tools/sun.jam @@ -49,7 +49,7 @@ generators.register-c-compiler sun.compile.c++ : CPP : OBJ : sun ; # Declare flags and actions for compilation flags sun.compile OPTIONS on : -g ; flags sun.compile OPTIONS on : -xprofile=tcov ; -flags sun.compile OPTIONS speed : -fast ; +flags sun.compile OPTIONS speed : -xO4 ; flags sun.compile OPTIONS space : -xO2 -xspace ; flags sun.compile OPTIONS multi : -mt ; diff --git a/src/tools/testing.jam b/src/tools/testing.jam index 00ae42555..25398ee72 100644 --- a/src/tools/testing.jam +++ b/src/tools/testing.jam @@ -62,7 +62,7 @@ feature.feature test-info : : free incidental ; feature.feature testing.arg : : free incidental ; feature.feature testing.input-file : : free dependency ; -feature.feature preserve-test-targets : off on : incidental propagated ; +feature.feature preserve-test-targets : on off : incidental propagated ; # Register target types. type.register TEST : test ; diff --git a/src/tools/types/exe.jam b/src/tools/types/exe.jam index af6b33e46..47109513a 100644 --- a/src/tools/types/exe.jam +++ b/src/tools/types/exe.jam @@ -6,4 +6,4 @@ import type ; type.register EXE ; type.set-generated-target-suffix EXE : windows : "exe" ; -type.set-generated-target-suffix EXE : cygiwn : "exe" ; +type.set-generated-target-suffix EXE : cygwin : "exe" ; diff --git a/src/tools/types/lib.jam b/src/tools/types/lib.jam index 45446cbe1..c343b788a 100644 --- a/src/tools/types/lib.jam +++ b/src/tools/types/lib.jam @@ -25,6 +25,7 @@ type.set-generated-target-prefix IMPORT_LIB : : "" ; type.register SHARED_LIB : so dll dylib : LIB ; type.set-generated-target-suffix SHARED_LIB : windows : dll ; +type.set-generated-target-suffix SHARED_LIB : cygwin : dll ; type.set-generated-target-suffix SHARED_LIB : darwin : dylib ; type SEARCHED_LIB : : LIB ; diff --git a/src/tools/vacpp.jam b/src/tools/vacpp.jam index 5addf28e3..a3ab61c6c 100644 --- a/src/tools/vacpp.jam +++ b/src/tools/vacpp.jam @@ -16,7 +16,7 @@ import os ; feature.extend toolset : vacpp ; toolset.inherit vacpp : unix ; -generators.override vacpp.prebuilt : builtin.lib-generator ; +generators.override vacpp.prebuilt : builtin.prebuilt ; generators.override vacpp.searched-lib-generator : searched-lib-generator ; # Configure the vacpp toolset @@ -69,14 +69,25 @@ flags vacpp LINKFLAGS off : -s ; if [ os.name ] = AIX { - # Tell the linker to discard unneeded object files from archive libraries. - # Please note that the static constructors contained by the discarded object - # files will not be invoked. flags vacpp.compile C++FLAGS : -qfuncsect ; - flags vacpp.link LINKFLAGS static : -qtwolink ; + + # The -bnoipath strips the prepending (relative) path of libraries from + # the loader section in the target library or executable. Hence, during + # load-time LIBPATH (identical to LD_LIBRARY_PATH) or a hard-coded + # -blibpath (*similar* to -lrpath/-lrpath-link) is searched. Without + # this option, the prepending (relative) path + library name is + # hard-coded in the loader section, causing *only* this path to be + # searched during load-time. Note that the AIX linker does not have an + # -soname equivalent, this is as close as it gets. + # + # The above options are definately for AIX 5.x, and most likely also for + # AIX 4.x and AIX 6.x. For details about the AIX linker see: + # http://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf + # + flags vacpp.link LINKFLAGS shared : -bnoipath ; # Run-time linking - flags vacpp.link EXE-LINKFLAGS shared : -brtl -qtwolink ; + flags vacpp.link EXE-LINKFLAGS shared : -brtl ; } else { diff --git a/test/generator_selection.py b/test/generator_selection.py index d141dc334..9616bd5bc 100755 --- a/test/generator_selection.py +++ b/test/generator_selection.py @@ -36,11 +36,19 @@ alias the-other-obj : Other//other-obj ; t.write("Other/mygen.jam", """ import generators ; +import os ; import type ; type.register MY_TYPE : extension ; generators.register-standard mygen.generate-a-cpp-file : MY_TYPE : CPP ; rule generate-a-cpp-file { ECHO Generating a CPP file... ; } -actions generate-a-cpp-file { echo "void g() {}" > "$(<)" } +if [ os.name ] = NT +{ + actions generate-a-cpp-file { echo void g() {} > "$(<)" } +} +else +{ + actions generate-a-cpp-file { echo "void g() {}" > "$(<)" } +} """) t.write("Other/jamfile.jam", """ diff --git a/test/test_all.py b/test/test_all.py index c2c43da53..26e1019a7 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -13,8 +13,8 @@ import BoostBuild xml = "--xml" in sys.argv toolset = BoostBuild.get_toolset() - - + + # Clear environment for testing. # for s in ('BOOST_ROOT', 'BOOST_BUILD_PATH', 'JAM_TOOLSET', 'BCCROOT', 'MSVCDir', @@ -42,11 +42,11 @@ def run_tests(critical_tests, other_tests): pass_count = 0 failures_count = 0 - + for i in all_tests: passed = 1 - if not xml: - print ("%-25s : " %(i)), + if not xml: + print ("%-25s : " %(i)), try: __import__(i) except SystemExit: @@ -58,12 +58,12 @@ def run_tests(critical_tests, other_tests): failures_count = failures_count + 1 # Restore the current directory, which might be changed by the test. os.chdir(invocation_dir) - + if not xml: if passed: print "PASSED" else: - print "FAILED" + print "FAILED" else: rs = "succeed" if not passed: @@ -79,9 +79,9 @@ def run_tests(critical_tests, other_tests): print """ -""" - - pass_count = pass_count + 1 +""" + if passed: + pass_count = pass_count + 1 sys.stdout.flush() # Makes testing under emacs more entertaining. # Erase the file on success.