anchor.diff:  select_compile_exe_template("$CC")  -> "EXE_CC_TEMPLATE";
   select_compile_exe_template("$CXX") -> "EXE_CXX_TEMPLATE".
   
  -select_link_template(Target) ->
  -    case target_type(Target) of
  -        drv -> "DRV_LINK_TEMPLATE";
  -        exe -> "EXE_LINK_TEMPLATE"
  +select_link_template(LinkLang, Target) ->
  +    case {LinkLang, target_type(Target)} of
  +        {cc,  drv} -> "DRV_LINK_TEMPLATE";
  +        {cxx, drv} -> "DRV_LINK_CXX_TEMPLATE";
  +        {cc,  exe} -> "EXE_LINK_TEMPLATE";
  +        {cxx, exe} -> "EXE_LINK_CXX_TEMPLATE"
       end.
   
   target_type(Target) -> target_type1(filename:extension(Target)).
  
positive.code:     Sources = port_sources(rebar_config:get_list(Config, port_sources,
                                                   ["c_src/*.c"])),
      #spec { type = target_type(Target),
              target = maybe_switch_extension(os:type(), Target),
              sources = Sources,
              objects = port_objects(Sources) }.
  
negative.code:     get_port_spec(Config, OsType, {Arch, Target, Sources, []});
  get_port_spec(Config, OsType, {_Arch, Target, Sources, Opts}) ->
      SourceFiles = port_sources(Sources),
      LinkLang =
          case lists:any(
                 fun(Src) -> compiler(filename:extension(Src)) == "$CXX" end,
                 SourceFiles) of
              true  -> cxx;
              false -> cc
          end,
      ObjectFiles = port_objects(SourceFiles),
      #spec{type=target_type(Target),
            target=maybe_switch_extension(OsType, Target),
            link_lang=LinkLang,
            sources=SourceFiles,
            objects=ObjectFiles,
            opts=port_opts(Config, Opts)}.
  