Sha256: a08254066b7fe7c87d3f9f82d03d8117c2916100a7be56fd1d0cc13c5ff07246

Contents?: true

Size: 1.94 KB

Versions: 2

Compression:

Stored size: 1.94 KB

Contents

# Build file for the native C extension.
#
# = Environment variables
# CFLAGS:: Arguments to the compiler.
# LDFLAGS:: Arguments to the linker.

=begin
  Copyright 2006 Suraj N. Kurapati

  This file is part of Ruby-VPI.

  Ruby-VPI is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  Ruby-VPI is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with Ruby-VPI; if not, write to the Free Software Foundation,
  Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
=end

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

2 entries across 2 versions & 1 rubygems

Version Path
ruby-vpi-15.0.2 ext/Rakefile
ruby-vpi-15.0.1 ext/Rakefile