#!/usr/bin/env ruby

require "mkmf"

config = {}
config["CC"] = Config::CONFIG["CC"]
config["CFLAGS"] = Config::CONFIG["CFLAGS"] + " -I" + $hdrdir
config["LIBS"] = Config::CONFIG["LIBS"]
config["LIBRUBYARG"] = Config::CONFIG["LIBRUBYARG"]

open("Makefile.in") do |min|
  open("Makefile", "w") do |mout|
    while line = min.gets
      line.gsub!(/@.*?@/) do |s|
        key = s[1..-2]
        config[key]
      end
      mout.print(line)
    end
  end
end

