anchor.diff:              {NewBins, ExistingBins} = compile_each(Sources, Config, Env, [], []),
   
               %% Construct the driver name and make sure priv/ exists
  -            SoName = so_name(Config, AppFile),
  -            ok = filelib:ensure_dir(SoName),
  +            SoSpecs = so_specs(Config, AppFile, NewBins ++ ExistingBins),
  +            ?INFO("Using specs ~p\n", [SoSpecs]),
  +            lists:foreach(fun({SoName,_}) -> ok = filelib:ensure_dir(SoName) end, SoSpecs),
   
               %% Only relink if necessary, given the SoName and list of new binaries
  -            case needs_link(SoName, NewBins) of
  -                true ->
  -                    AllBins = string:join(NewBins ++ ExistingBins, " "),
  +            lists:foreach(fun({SoName,Bins}) ->
  +                case needs_link(SoName, sets:to_list(sets:intersection([sets:from_list(Bins),sets:from_list(NewBins)]))) of
  +                  true ->
                       rebar_utils:sh_failfast(?FMT("$CC ~s $LDFLAGS $DRV_LDFLAGS -o ~s",
  -                                                 [AllBins, SoName]), Env);
  -                false ->
  +                                                  [string:join(Bins, " "), SoName]), Env);
  +                  false ->
                       ?INFO("Skipping relink of ~s\n", [SoName]),
                       ok
  -            end
  +                end
  +              end, SoSpecs)
       end.
   
   clean(Config, AppFile) ->
  
positive.code:     Ext = filename:extension(Source),
      filename:rootname(Source, Ext) ++ ".o".
  
  so_name(Config, AppFile) ->
      %% Check config to see if a custom so_name has been specified
      PortName = case rebar_config:get(Config, so_name, undefined) of
                     undefined ->
                         %% Get the app name, which we'll use to
                         %% generate the linked port driver name
                         case rebar_app_utils:load_app_file(AppFile) of
                             {ok, AppName, _} ->
                                 lists:concat([AppName, "_drv.so"]);
                             error ->
                                 ?FAIL
                         end;
                     Soname ->
                         Soname
                 end,
  
      %% Construct the driver name
      ?FMT("priv/~s", [PortName]).
  
negative.code: %% Supported configuration variables:
  %%
  %% * port_sources - Erlang list of files and/or wildcard strings to be compiled
  %%
  %% * so_specs  - Erlang list of tuples of the form {"priv/so_name.so", ["c_src/object_file_name.o"]} useful for
  %%               building multiple *.so files.
  %%
  %% * port_envs - Erlang list of key/value pairs which will control the environment when
  %%               running the compiler and linker. By default, the following variables
  