19.3. Letting SCons Handle The File Suffixes

By supplying additional information when you create a Builder, you can let SCons add appropriate file suffixes to the target and/or the source file. For example, rather than having to specify explicitly that you want the Foo Builder to build the file.foo target file from the file.input source file, you can give the .foo and .input suffixes to the Builder, making for more compact and readable calls to the Foo Builder:


       bld = Builder(action = 'foobuild < $SOURCE > $TARGET',
                     suffix = '.foo',
                     src_suffix = '.input')
       env = Environment(BUILDERS = {'Foo' : bld})
       env.Foo('file1')
       env.Foo('file2')
    

      % scons -Q
      foobuild < file1.input > file1.foo
      foobuild < file2.input > file2.foo
    

You can also supply a prefix keyword argument if it's appropriate to have SCons append a prefix to the beginning of target file names.