Rakefile.local
author Mahlon E. Smith <mahlon@martini.nu>
Thu, 25 Dec 2008 08:35:46 +0000
branchmahlon-misc
changeset 11 e908d309e7ec
parent 10 b1426511fb64
permissions -rw-r--r--
* It compiles! * Removed additional leftover link parser stuff. * Removed unused memory allocate/free stuff until I discuss with my cohort. It may be back... it may be left over from linkparser too. ;) * list() works, but cores. Not sure why yet. Really, list() should be renamed to something sensible, and return instantiated BSD::Jail objects to attach() to or get additional info on. * Ruby C bindings are way, way fun. Reminds me how little C I can remember with one project a year :)

#!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 )