Sha256: b1f1efa558d14a8818a0d1d993769c83be3d1c8e855dde62cade6564ac7e2475

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

# Build file for the native C extension.
#
# = Environment variables
# CFLAGS:: Arguments to the compiler.
# LDFLAGS:: Arguments to the linker.
#--
# Copyright 2006 Suraj N. Kurapati
# See the file named LICENSE for details.

require 'rake/clean'
require 'rbconfig'

$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'ruby-vpi/rake'


desc "Builds the extension."
task :default => 'Makefile' do |t|
  sh 'make', '-f', t.prerequisites[0]
end

file 'Makefile' => [:swig, 'extconf.rb'] do |t|
  ruby t.prerequisites[1], "--with-cflags=#{ENV['CFLAGS']}", "--with-ldflags=#{ENV['LDFLAGS']}"
end

CLEAN.include 'Makefile', 'mkmf.log', '*.o', '*.so'


desc 'Generate Ruby wrapper for VPI.'
task :swig => 'swig_wrap.cin'

file 'swig_wrap.cin' => 'swig_vpi.i' do |t|
  sh %w{swig -ruby -o}, t.name, t.prerequisites[0]
end

file 'swig_vpi.i' => 'swig_vpi.h'

# avoid compilation problems due to va_list, which is used in the SWIG-generated
# wrapper for VPI vprintf functions
file 'swig_vpi.h' => 'vpi_user.h' do |t|
  src, dst = t.prerequisites[0], t.name

  File.open(dst, 'w') do |f|
    f << File.read(src).gsub(/\bva_list\b/, 'int')
  end
end

# NOTE: since SWIG is not a requirement for users, we should not clobber these
# generated files
#CLOBBER.include 'swig_wrap.cin', 'swig_vpi.h'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-vpi-16.0.0 ext/Rakefile