2007-12-17 03:47:28 -05:00
|
|
|
#! ./miniruby
|
|
|
|
|
|
|
|
dir = File.expand_path("../..", __FILE__)
|
|
|
|
$:.unshift(File.join(dir, "lib"))
|
|
|
|
$:.unshift(dir)
|
|
|
|
$:.unshift(".")
|
|
|
|
require 'mkmf'
|
2007-12-22 13:35:53 -05:00
|
|
|
require 'erb'
|
2007-12-17 03:47:28 -05:00
|
|
|
|
2007-12-17 12:30:57 -05:00
|
|
|
if /--builtin-encs=/ =~ ARGV[0]
|
2007-12-22 13:35:53 -05:00
|
|
|
BUILTIN_ENCS = $'.split.map {|e| File.basename(e, '.*') << '.c'}
|
2007-12-17 12:30:57 -05:00
|
|
|
ARGV.shift
|
|
|
|
else
|
|
|
|
BUILTIN_ENCS = []
|
|
|
|
end
|
|
|
|
|
2007-12-17 11:15:46 -05:00
|
|
|
if File.exist?(depend = File.join($srcdir, "depend"))
|
2007-12-22 13:35:53 -05:00
|
|
|
erb = ERB.new(File.read(depend), nil, '%')
|
|
|
|
erb.filename = depend
|
|
|
|
tmp = erb.result(binding)
|
2007-12-23 22:49:56 -05:00
|
|
|
dep = "\n#### depend ####\n\n" << depend_rules(tmp).join
|
|
|
|
else
|
|
|
|
dep = ""
|
2007-12-17 11:15:46 -05:00
|
|
|
end
|
2007-12-23 22:49:56 -05:00
|
|
|
mkin = File.read(File.join($srcdir, "Makefile.in"))
|
|
|
|
mkin.gsub!(/@(#{CONFIG.keys.join('|')})@/) {CONFIG[$1]}
|
2007-12-17 12:30:57 -05:00
|
|
|
open(ARGV[0], 'wb') {|f|
|
2007-12-23 22:49:56 -05:00
|
|
|
f.puts mkin, dep
|
2007-12-17 03:47:28 -05:00
|
|
|
}
|