diff --git a/new/builtin.jam b/new/builtin.jam index 41a92f497..37becc243 100644 --- a/new/builtin.jam +++ b/new/builtin.jam @@ -21,6 +21,7 @@ import symlink ; import alias ; import property ; import print ; +import utility ; # This feature is used to determine which OS we're on. # In future, this may become and @@ -298,10 +299,11 @@ rule response-file ( target : sources * : properties * ) response-file-2 $(target) : $(sources[2-]) ; } print.output $(target) ; - print.text [ on $(target) - return "$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" - "$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)" - ] : : suffix ; + print.text [ utility.apply-default-suffix .lib : + [ on $(target) + return "$(LIBRARY_OPTION)$(FINDLIBS_ST)" + "$(LIBRARY_OPTION)$(FINDLIBS_SA)" + ] ] ; } actions quietly response-file-1 diff --git a/new/utility.jam b/new/utility.jam index 1230b1d84..0fd45e847 100644 --- a/new/utility.jam +++ b/new/utility.jam @@ -76,6 +76,26 @@ rule less ( a b ) } } +# For all elements of 'list' which do not have a suffix, +# add 'suffix'. +rule apply-default-suffix ( suffix : list * ) +{ + local result ; + for local i in $(list) + { + if $(i:S) + { + result += $(i) ; + } + else + { + result += $(i:S=$(suffix)) ; + } + } + return $(result) ; +} + + local rule __test__ ( ) { import assert ; @@ -110,6 +130,8 @@ local rule __test__ ( ) assert.true equal 1 1 ; assert.false equal 1 2 ; assert.result "not sure" : equal [ new test-class__ ] 1 ; + + assert.result foo.lib foo.a : apply-default-suffix .lib : foo foo.a ; } diff --git a/tools/msvc.jam b/tools/msvc.jam index 342addbd6..6a6706b1b 100644 --- a/tools/msvc.jam +++ b/tools/msvc.jam @@ -306,7 +306,6 @@ flags msvc LINKFLAGS LIB/shared : /DLL ; toolset.flags msvc.link USER_LINKFLAGS ; toolset.flags msvc.link LINKPATH ; -toolset.flags msvc.link FINDLIBS ; flags builtin.response-file LIBRARY_PATH_OPTION msvc : /LIBPATH: : unchecked ; flags builtin.response-file LIBRARY_OPTION msvc : "" : unchecked ; @@ -353,6 +352,6 @@ else # CYGWIN actions link { - $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" $(.implib)"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" "$(FINDLIBS:S=.lib)" $(USER_LINKFLAGS) @"$(>:W)" + $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" $(.implib)"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" $(USER_LINKFLAGS) @"$(>:W)" } diff --git a/v2/tools/builtin.jam b/v2/tools/builtin.jam index 41a92f497..37becc243 100644 --- a/v2/tools/builtin.jam +++ b/v2/tools/builtin.jam @@ -21,6 +21,7 @@ import symlink ; import alias ; import property ; import print ; +import utility ; # This feature is used to determine which OS we're on. # In future, this may become and @@ -298,10 +299,11 @@ rule response-file ( target : sources * : properties * ) response-file-2 $(target) : $(sources[2-]) ; } print.output $(target) ; - print.text [ on $(target) - return "$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" - "$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)" - ] : : suffix ; + print.text [ utility.apply-default-suffix .lib : + [ on $(target) + return "$(LIBRARY_OPTION)$(FINDLIBS_ST)" + "$(LIBRARY_OPTION)$(FINDLIBS_SA)" + ] ] ; } actions quietly response-file-1 diff --git a/v2/tools/msvc.jam b/v2/tools/msvc.jam index 342addbd6..6a6706b1b 100644 --- a/v2/tools/msvc.jam +++ b/v2/tools/msvc.jam @@ -306,7 +306,6 @@ flags msvc LINKFLAGS LIB/shared : /DLL ; toolset.flags msvc.link USER_LINKFLAGS ; toolset.flags msvc.link LINKPATH ; -toolset.flags msvc.link FINDLIBS ; flags builtin.response-file LIBRARY_PATH_OPTION msvc : /LIBPATH: : unchecked ; flags builtin.response-file LIBRARY_OPTION msvc : "" : unchecked ; @@ -353,6 +352,6 @@ else # CYGWIN actions link { - $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" $(.implib)"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" "$(FINDLIBS:S=.lib)" $(USER_LINKFLAGS) @"$(>:W)" + $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" $(.implib)"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" $(USER_LINKFLAGS) @"$(>:W)" } diff --git a/v2/util/utility.jam b/v2/util/utility.jam index 1230b1d84..0fd45e847 100644 --- a/v2/util/utility.jam +++ b/v2/util/utility.jam @@ -76,6 +76,26 @@ rule less ( a b ) } } +# For all elements of 'list' which do not have a suffix, +# add 'suffix'. +rule apply-default-suffix ( suffix : list * ) +{ + local result ; + for local i in $(list) + { + if $(i:S) + { + result += $(i) ; + } + else + { + result += $(i:S=$(suffix)) ; + } + } + return $(result) ; +} + + local rule __test__ ( ) { import assert ; @@ -110,6 +130,8 @@ local rule __test__ ( ) assert.true equal 1 1 ; assert.false equal 1 2 ; assert.result "not sure" : equal [ new test-class__ ] 1 ; + + assert.result foo.lib foo.a : apply-default-suffix .lib : foo foo.a ; }