Rakefile.local
author Michael Granger <ged@FaerieMUD.org>
Thu, 20 Nov 2008 16:43:02 +0000
changeset 3 7f6da371e2ce
parent 0 92d00ff32c56
permissions -rw-r--r--
* Converted from Mkrf-based build back to mkmf. * Updated the build system.

#!rake

#!rake

# C extension constants
EXT_MAKEFILE  = EXTDIR + 'Makefile'
EXT_SOURCES   = FileList[ EXTDIR + '*.c' ]
EXT_SO        = EXTDIR + "bsdjail.#{CONFIG['DLEXT']}"


#####################################################################
###	T A S K S
#####################################################################

# Make both the default task and the spec task depend on building the extension
task :local => :build
task :spec => :build
namespace :spec do
	task :doc   => [ :build ]
	task :quiet => [ :build ]
	task :html  => [ :build ]
	task :text  => [ :build ]
end

desc "Make the Makefile for the C extension"
file EXT_MAKEFILE.to_s => EXT_SOURCES do
	log "Configuring bsdjail C extension"
	in_subdirectory( EXTDIR ) do
		ruby 'extconf.rb'
	end
end
CLOBBER.include( EXTDIR + 'mkmf.log', EXT_SO )

desc "Build the C extension"
task :build => [ EXT_MAKEFILE.to_s, *EXT_SOURCES ] do
	in_subdirectory( EXTDIR ) do
		sh 'make'
	end
end


desc "Rebuild the C extension"
task :rebuild => [ :clean, :build ]


task :clean do
	if EXT_MAKEFILE.exist?
		in_subdirectory( EXTDIR ) do
			sh 'make clean'
		end
	end
end	

task :clobber do
	if EXT_MAKEFILE.exist?
		in_subdirectory( EXTDIR ) do
			sh 'make distclean'
		end
	end
end	
CLOBBER.include( EXT_MAKEFILE )