Index: pylib/gyp/generator/make.py |
diff --git a/pylib/gyp/generator/make.py b/pylib/gyp/generator/make.py |
index 8fde23cfbb9868c6517702141074fe625f59dc0d..4f56aa048355e33bb9b52e73e921c3f0ace4828b 100644 |
--- a/pylib/gyp/generator/make.py |
+++ b/pylib/gyp/generator/make.py |
@@ -598,8 +598,7 @@ def QuoteIfNecessary(string): |
def StringToMakefileVariable(string): |
"""Convert a string to a value that is acceptable as a make variable name.""" |
- # TODO: replace other metacharacters that we encounter. |
- return re.sub('[ {}$]', '_', string) |
+ return re.sub('[^a-zA-Z0-9_]', '_', string) |
srcdir_prefix = '' |
@@ -691,6 +690,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD |
self.fp.write(header) |
+ self.qualified_target = qualified_target |
self.path = base_path |
self.target = spec['target_name'] |
self.type = spec['type'] |
@@ -837,7 +837,8 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD |
part_of_all: flag indicating this target is part of 'all' |
""" |
for action in actions: |
- name = self.target + '_' + StringToMakefileVariable(action['action_name']) |
+ name = StringToMakefileVariable('%s_%s' % (self.qualified_target, |
+ action['action_name'])) |
self.WriteLn('### Rules for action "%s":' % action['action_name']) |
inputs = action['inputs'] |
outputs = action['outputs'] |
@@ -931,7 +932,8 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD |
part_of_all: flag indicating this target is part of 'all' |
""" |
for rule in rules: |
- name = self.target + '_' + StringToMakefileVariable(rule['rule_name']) |
+ name = StringToMakefileVariable('%s_%s' % (self.qualified_target, |
+ rule['rule_name'])) |
count = 0 |
self.WriteLn('### Generated for rule %s:' % name) |
@@ -1046,7 +1048,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD |
""" |
self.WriteLn('### Generated for copy rule.') |
- variable = self.target + '_copies' |
+ name = StringToMakefileVariable(self.qualified_target + '_copies') |
outputs = [] |
for copy in copies: |
for path in copy['files']: |