#!/usr/bin/env ruby
# $Id: extconf.rb,v 1.2 2001/09/18 02:03:21 matju Exp $

require "rbconfig"
require "ftools"
include Config

DESTDIR = CONFIG["sitedir"] + "/" + CONFIG["MAJOR"] + "." + CONFIG["MINOR"]

FILES1 = %w(
 Contract.rb MainLoop.rb SProfiler.rb
 RubySchema.rb Type.rb
 UndoQueue.rb
 Version.rb
)

# Hollow/
FILES2 = %w(
 List.rb Array.rb Hash.rb String.rb
)

# lgram/
FILES3 = %w(
 Marshal.rb
)

File.open("Makefile","w") {|f|
	f.puts "DESTDIR = #{DESTDIR}"
	f.puts
	f.puts "all::"
	f.puts
	f.puts "Makefile: extconf.rb"
	f.puts "\truby extconf.rb"
	f.puts

	f.puts "install::"
	f.puts "\t@mkdir $(DESTDIR)/Hollow $(DESTDIR)/lgram || true"
	FILES1.each {|fn1|
		fn2 = fn1
		f.puts "\tinstall --mode 644 #{fn2} $(DESTDIR)/#{fn2}"
	}
	FILES2.each {|fn1|
		fn2 = "Hollow/#{fn1}"
		f.puts "\tinstall --mode 644 #{fn2} $(DESTDIR)/#{fn2}"
	}
	FILES3.each {|fn1|
		fn2 = "lgram/#{fn1}"
		f.puts "\tinstall --mode 644 #{fn2} $(DESTDIR)/#{fn2}"
	}
}

#FILES.each {|name|
#  File.install "lib/#{name}", "#{DSTPATH}/#{name}", 0644, true   
#end


