OLD | NEW |
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # Notes: | 5 # Notes: |
6 # | 6 # |
7 # This is all roughly based on the Makefile system used by the Linux | 7 # This is all roughly based on the Makefile system used by the Linux |
8 # kernel, but is a non-recursive make -- we put the entire dependency | 8 # kernel, but is a non-recursive make -- we put the entire dependency |
9 # graph in front of make and let it figure it out. | 9 # graph in front of make and let it figure it out. |
10 # | 10 # |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 def QuoteIfNecessary(string): | 595 def QuoteIfNecessary(string): |
596 """TODO: Should this ideally be replaced with one or more of the above | 596 """TODO: Should this ideally be replaced with one or more of the above |
597 functions?""" | 597 functions?""" |
598 if '"' in string: | 598 if '"' in string: |
599 string = '"' + string.replace('"', '\\"') + '"' | 599 string = '"' + string.replace('"', '\\"') + '"' |
600 return string | 600 return string |
601 | 601 |
602 | 602 |
603 def StringToMakefileVariable(string): | 603 def StringToMakefileVariable(string): |
604 """Convert a string to a value that is acceptable as a make variable name.""" | 604 """Convert a string to a value that is acceptable as a make variable name.""" |
605 # TODO: replace other metacharacters that we encounter. | 605 return re.sub('[^a-zA-Z0-9_]', '_', string) |
606 return re.sub('[ {}$]', '_', string) | |
607 | 606 |
608 | 607 |
609 srcdir_prefix = '' | 608 srcdir_prefix = '' |
610 def Sourceify(path): | 609 def Sourceify(path): |
611 """Convert a path to its source directory form.""" | 610 """Convert a path to its source directory form.""" |
612 if '$(' in path: | 611 if '$(' in path: |
613 return path | 612 return path |
614 if os.path.isabs(path): | 613 if os.path.isabs(path): |
615 return path | 614 return path |
616 return srcdir_prefix + path | 615 return srcdir_prefix + path |
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2133 root_makefile.write(" include " + include_file + "\n") | 2132 root_makefile.write(" include " + include_file + "\n") |
2134 root_makefile.write("endif\n") | 2133 root_makefile.write("endif\n") |
2135 root_makefile.write('\n') | 2134 root_makefile.write('\n') |
2136 | 2135 |
2137 if generator_flags.get('auto_regeneration', True): | 2136 if generator_flags.get('auto_regeneration', True): |
2138 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) | 2137 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) |
2139 | 2138 |
2140 root_makefile.write(SHARED_FOOTER) | 2139 root_makefile.write(SHARED_FOOTER) |
2141 | 2140 |
2142 root_makefile.close() | 2141 root_makefile.close() |
OLD | NEW |