mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
enc: Expand substitution variables in Makefile.in by default
This change makes `make_encmake.rb` expand all substitution variables when replacing them in `enc/Makefile.in` to avoid propagating all possibly referenced variables to the generated Makefile. The old behavior, which don't expand make variables when generating Makefile, was useful to temporarily override inherited variables like `cflags` in `CFLAGS` at make-time. However, it's not a common use case and it requires to propagate all possibly referenced variables properly considering key name duplication between `enc/Makefile.in` and `RbConfig::CONFIG`.
This commit is contained in:
parent
072761bb3f
commit
0d9a681eff
1 changed files with 6 additions and 1 deletions
|
@ -129,7 +129,12 @@ else
|
|||
dep = ""
|
||||
end
|
||||
mkin = File.read(File.join($srcdir, "Makefile.in"))
|
||||
mkin.gsub!(/@(#{CONFIG.keys.join('|')})@/) {CONFIG[$1]}
|
||||
# Variables that should not be expanded in Makefile.in to allow
|
||||
# overriding inherited variables at make-time.
|
||||
not_expand_vars = %w(CFLAGS)
|
||||
mkin.gsub!(/@(#{RbConfig::CONFIG.keys.join('|')})@/) do
|
||||
not_expand_vars.include?($1) ? CONFIG[$1] : RbConfig::CONFIG[$1]
|
||||
end
|
||||
File.open(ARGV[0], 'wb') {|f|
|
||||
f.puts mkin, dep
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue