summaryrefslogtreecommitdiff
path: root/lib/mkmf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mkmf.rb')
-rw-r--r--lib/mkmf.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 1eb52047a38..513dff35837 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -2051,7 +2051,10 @@ RULES
implicit = [[m[1], m[2]], [m.post_match]]
next
elsif RULE_SUBST and /\A(?!\s*\w+\s*=)[$\w][^#]*:/ =~ line
- line.gsub!(%r"(\s)(?!\.)([^$(){}+=:\s\/\\,]+)(?=\s|\z)") {$1 + RULE_SUBST % $2}
+ line.sub!(/\s*\#.*$/, '')
+ comment = $&
+ line.gsub!(%r"(\s)(?!\.)([^$(){}+=:\s\\,]+)(?=\s|\z)") {$1 + RULE_SUBST % $2}
+ line = line.chomp + comment + "\n" if comment
end
depout << line
end