1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/enc/make_encmake.rb

24 lines
584 B
Ruby
Raw Normal View History

#! ./miniruby
dir = File.expand_path("../..", __FILE__)
$:.unshift(File.join(dir, "lib"))
$:.unshift(dir)
File.directory?("enc") || File.mkdir("enc")
$:.unshift(".")
require 'mkmf'
require 'tool/serb'
encdir = File.join($top_srcdir, "enc")
encs = Dir.open(encdir) {|d| d.grep(/.+\.c\z/)}
encs -= CONFIG["BUILTIN_ENCS"].split
encs.each {|e| e.chomp!(".c")}
mkin = File.read(File.join(encdir, "Makefile.in"))
mkin.gsub!(/^\#!\# ?/, '')
mkin.gsub!(/@(#{RbConfig::MAKEFILE_CONFIG.keys.join('|')})@/) {CONFIG[$1]}
tmp = ''
eval(serb(mkin, 'tmp'))
open(ARGV[0], 'w') {|f|
f.puts tmp
}