Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-04-07 04:03:25


On Sunday 26 March 2006 00:19, Noel Belcourt wrote:

> I have this in my user-config.jam
>
> # Configure Sun
> using sun ; # : 5.7 : /opt/SUNWhpc/bin/mpCC : <stdlib>sun-stlport ;
> using sunf77 ; # : 5.7 : /opt/SUNWhpc/bin/mpf95 : <fflags>-f77 ;
>
> and I want users to get the CC/cc/f77 compilers by default. But I want
> to make it easy for users to build with the MPI compiler wrappers
> located in Sun's High Performance Computing directory
> (/opt/SUNWhpc/bin) which are invoked as mpCC/mpcc/mpf77.
>
> So the tools/build/v2/tools/sun.jam file has this initialization rule
>
> rule init ( version ? : command * : options * )
> {
> local condition = [ common.check-init-parameters sun : version
> $(version) ] ;
> command = [ common.get-invocation-command sun : CC : $(command) :
> "/opt/SUNWspro/bin" ] ;
> common.handle-options sun : $(condition) : $(command) : $(options) ;
> command_c = $(command_c[1--2]) $(command[-1]:B=cc) ;
> toolset.flags sun CONFIG_C_COMMAND $(condition) : $(command_c) ;
> }
>
> which is almost correct for what I need. The only problem is that when
> users compile with the SUNWhpc compilers, C files are invoked as
> /opt/SUNWhpc/bin/cc rather than the correct /opt/SUNWhpc/bin/mpcc.
>
> Part of my problem is that I want to take the user supplied command,
> /opt/SUNWhpc/bin/mpCC, and just replace the CC with cc to compile c
> files but I don't know how to do that.

Hi Noel,
I think the simple way is to use "MATCH rule". Something like this:

  local compiler_basename = $(command[1]:B) ;

  local m = [ MATCH (.*)CC(.*) : $(compiler_basename) ] ;
  local new_basename = $(m[1])cc$(m[2]) ;

  command_c = $(command[1--2]) $(command[-1]:B=$(new_basename)) ;

Let me know if this works for you. If yes, we can adjust sun.jam that's in
CVS.

- Volodya

>
> I just not sure what the best solution is to this problem, any ideas?
>
> -- Noel
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost-build

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk