diff --git a/src/tools/clang-linux.jam b/src/tools/clang-linux.jam index 8754a549d..c37105cdc 100644 --- a/src/tools/clang-linux.jam +++ b/src/tools/clang-linux.jam @@ -18,6 +18,7 @@ import generators ; import type ; import numbers ; import os ; +import property ; feature.extend-subfeature toolset clang : platform : linux ; @@ -206,34 +207,115 @@ SPACE = " " ; rule link ( targets * : sources * : properties * ) { SPACE on $(targets) = " " ; JAM_SEMAPHORE on $(targets) = clang-linux-link-semaphore ; + + local tosw ; + local pselect = [ property.select : $(properties) ] ; + + if $(pselect) + { + + local tosv = [ feature.get-values : $(pselect) ] ; + + if $(tosv) = windows + { + tosw = 1 ; + } + } + else if [ os.name ] in NT + { + tosw = 1 ; + } + if $(tosw) + { + link-w $(targets) : $(sources) ; + } + else + { + link-o $(targets) : $(sources) ; + } } rule link.dll ( targets * : sources * : properties * ) { SPACE on $(targets) = " " ; JAM_SEMAPHORE on $(targets) = clang-linux-link-semaphore ; + + local tosw ; + local pselect = [ property.select : $(properties) ] ; + + if $(pselect) + { + + local tosv = [ feature.get-values : $(pselect) ] ; + + if $(tosv) = windows + { + tosw = 1 ; + } + } + else if [ os.name ] in NT + { + tosw = 1 ; + } + if $(tosw) + { + link.dll-w $(targets) : $(sources) ; + } + else + { + link.dll-o $(targets) : $(sources) ; + } } if [ os.name ] in NT { -actions link bind LIBRARIES { +# All the links on Windows use a response file because of Windows line limit issues + +# Target OS is not Windows, needs the RPATH stuff +actions link-o bind LIBRARIES { + "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" @"@($(<[1]:T).rsp:E=$(START-GROUP) "$(>:T)" "$(LIBRARIES:T)" $(FINDLIBS-ST-PFX:T) -l$(FINDLIBS-ST:T) $(FINDLIBS-SA-PFX:T) -l$(FINDLIBS-SA:T) $(END-GROUP))" $(OPTIONS) $(USER_OPTIONS) +} + +# Target OS is not Windows, needs the RPATH and SONAME stuff +actions link.dll-o bind LIBRARIES { + "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-soname$(SPACE)-Wl,$(<[1]:D=) -shared @"@($(<[1]:T).rsp:E=$(START-GROUP) "$(>:T)" "$(LIBRARIES:T)" $(FINDLIBS-ST-PFX:T) -l$(FINDLIBS-ST:T) $(FINDLIBS-SA-PFX:T) -l$(FINDLIBS-SA:T) $(END-GROUP))" $(OPTIONS) $(USER_OPTIONS) +} + +# Target OS is Windows, does not need the RPATH stuff +actions link-w bind LIBRARIES { "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -o "$(<)" @"@($(<[1]:T).rsp:E=$(START-GROUP) "$(>:T)" "$(LIBRARIES:T)" $(FINDLIBS-ST-PFX:T) -l$(FINDLIBS-ST:T) $(FINDLIBS-SA-PFX:T) -l$(FINDLIBS-SA:T) $(END-GROUP))" $(OPTIONS) $(USER_OPTIONS) } -actions link.dll bind LIBRARIES { +# Target OS is Windows, does not need the RPATH and SONAME stuff +actions link.dll-w bind LIBRARIES { "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -o "$(<)" -shared @"@($(<[1]:T).rsp:E=$(START-GROUP) "$(>:T)" "$(LIBRARIES:T)" $(FINDLIBS-ST-PFX:T) -l$(FINDLIBS-ST:T) $(FINDLIBS-SA-PFX:T) -l$(FINDLIBS-SA:T) $(END-GROUP))" $(OPTIONS) $(USER_OPTIONS) + } } else { -actions link bind LIBRARIES { +# None of the links on non-Windows need a response file + +# Target OS is not Windows, needs the RPATH stuff +actions link-o bind LIBRARIES { "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS) } -actions link.dll bind LIBRARIES { +# Target OS is not Windows, needs the RPATH and SONAME stuff +actions link.dll-o bind LIBRARIES { "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-soname$(SPACE)-Wl,$(<[1]:D=) -shared $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS) } +# Target OS is Windows, does not need the RPATH stuff +actions link-w bind LIBRARIES { + "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -o "$(<)" $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS) +} + +# Target OS is Windows, does not need the RPATH and SONAME stuff +actions link.dll-w bind LIBRARIES { + "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -o "$(<)" -shared $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS) +} + } diff --git a/src/tools/embarcadero.jam b/src/tools/embarcadero.jam index 003dc5b1d..c9d51d86e 100644 --- a/src/tools/embarcadero.jam +++ b/src/tools/embarcadero.jam @@ -592,11 +592,11 @@ actions updated together piecemeal archive } rule link ( targets * : sources * : properties * ) { - JAM_SEMAPHORE on $(targets) = clang-linux-link-semaphore ; + JAM_SEMAPHORE on $(targets) = embarcadero-link-semaphore ; } rule link.dll ( targets * : sources * : properties * ) { - JAM_SEMAPHORE on $(targets) = clang-linux-link-semaphore ; + JAM_SEMAPHORE on $(targets) = embarcadero-link-semaphore ; } actions link bind LIBRARIES {