diff --git a/lib/rscons/builder.rb b/lib/rscons/builder.rb index b82f918..41e16da 100644 --- a/lib/rscons/builder.rb +++ b/lib/rscons/builder.rb @@ -8,6 +8,15 @@ module Rscons class Builder class << self + # Return a String specifying an extra path component used to + # differentiate build targets built by this builder from others. + # + # @return [String, nil] + # Extra path component used to differentiate build targets built by + # this builder from others. + def extra_path + end + # Return the name of the builder. # # If not overridden this defaults to the last component of the class name. diff --git a/lib/rscons/builders/shared_object.rb b/lib/rscons/builders/shared_object.rb index 64942ce..3a355a8 100644 --- a/lib/rscons/builders/shared_object.rb +++ b/lib/rscons/builders/shared_object.rb @@ -5,6 +5,12 @@ module Rscons # source files. class SharedObject < Builder include Mixins::Object + + class << self + def extra_path + "_shared" + end + end end end end diff --git a/lib/rscons/environment.rb b/lib/rscons/environment.rb index 6d581f6..4f7fa71 100644 --- a/lib/rscons/environment.rb +++ b/lib/rscons/environment.rb @@ -245,7 +245,9 @@ module Rscons # @return [String] # The file name to be built from +source_fname+ with suffix +suffix+. def get_build_fname(source_fname, suffix, builder_class) - extra_path = builder_class == Builders::SharedObject ? "/_shared" : "" + if extra_path = builder_class.extra_path + extra_path = "/#{extra_path}" + end "#{@build_root}#{extra_path}/#{Util.make_relative_path(Rscons.set_suffix(source_fname, suffix))}".gsub("\\", "/") end