| OLD | NEW |
| 1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
| 2 # Copyright 2008, Google Inc. | 2 # Copyright 2008, Google Inc. |
| 3 # All rights reserved. | 3 # All rights reserved. |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 '// This file is auto-generated by the ConcatSource builder.'] | 53 '// This file is auto-generated by the ConcatSource builder.'] |
| 54 | 54 |
| 55 for source_file in source: | 55 for source_file in source: |
| 56 # Skip source files which are not CPP files. These will be passed through | 56 # Skip source files which are not CPP files. These will be passed through |
| 57 # to the output list by the pseudo-builder. | 57 # to the output list by the pseudo-builder. |
| 58 if source_file.suffix not in env['CONCAT_SOURCE_SUFFIXES']: | 58 if source_file.suffix not in env['CONCAT_SOURCE_SUFFIXES']: |
| 59 continue | 59 continue |
| 60 | 60 |
| 61 source_path = str(source_file) | 61 source_path = str(source_file) |
| 62 | 62 |
| 63 if 'msvc' in env['TOOLS']: | 63 if env.get('CC') == 'cl': |
| 64 # Add message pragma for nicer progress indication when building with | 64 # Add message pragma for nicer progress indication when building with |
| 65 # MSVC. | 65 # MSVC. |
| 66 output_lines.append('#pragma message("--%s")' % ( | 66 output_lines.append('#pragma message("--%s")' % ( |
| 67 source_path.replace("\\", "/"))) | 67 source_path.replace("\\", "/"))) |
| 68 | 68 |
| 69 output_lines.append('#include "%s"' % source_path) | 69 output_lines.append('#include "%s"' % source_path) |
| 70 | 70 |
| 71 output_file = open(str(target[0]), 'w') |
| 71 # Need an EOL at the end of the file for more finicky build tools | 72 # Need an EOL at the end of the file for more finicky build tools |
| 72 output_lines.append('\n') | 73 output_file.write('\n'.join(output_lines) + '\n') |
| 73 | |
| 74 output_file = open(str(target[0]), 'w') | |
| 75 output_file.write('\n'.join(output_lines)) | |
| 76 output_file.close() | 74 output_file.close() |
| 77 | 75 |
| 78 | 76 |
| 79 def ConcatSourcePseudoBuilder(self, target, source): | 77 def ConcatSourcePseudoBuilder(self, target, source): |
| 80 """ConcatSource pseudo-builder; calls builder or passes through source nodes. | 78 """ConcatSource pseudo-builder; calls builder or passes through source nodes. |
| 81 | 79 |
| 82 Args: | 80 Args: |
| 83 self: Environment in which to build | 81 self: Environment in which to build |
| 84 target: List of target nodes | 82 target: List of target nodes |
| 85 source: List of source nodes | 83 source: List of source nodes |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 # Suffixes of sources we can concatenate. Files not in this list will be | 124 # Suffixes of sources we can concatenate. Files not in this list will be |
| 127 # passed through untouched. (Note that on Mac, Objective C/C++ files | 125 # passed through untouched. (Note that on Mac, Objective C/C++ files |
| 128 # cannot be concatenated with regular C/C++ files.) | 126 # cannot be concatenated with regular C/C++ files.) |
| 129 # TODO(rspangler): Probably shouldn't mix C, C++ either... | 127 # TODO(rspangler): Probably shouldn't mix C, C++ either... |
| 130 env['CONCAT_SOURCE_SUFFIXES'] = ['.c', '.C', '.cxx', '.cpp', '.c++', '.cc', | 128 env['CONCAT_SOURCE_SUFFIXES'] = ['.c', '.C', '.cxx', '.cpp', '.c++', '.cc', |
| 131 '.h', '.H', '.hxx', '.hpp', '.hh'] | 129 '.h', '.H', '.hxx', '.hpp', '.hh'] |
| 132 | 130 |
| 133 # Add a psuedo-builder method which can look at the environment to determine | 131 # Add a psuedo-builder method which can look at the environment to determine |
| 134 # whether to call the ConcatSource builder or not | 132 # whether to call the ConcatSource builder or not |
| 135 env.AddMethod(ConcatSourcePseudoBuilder, 'ConcatSource') | 133 env.AddMethod(ConcatSourcePseudoBuilder, 'ConcatSource') |
| OLD | NEW |