Sha256: b0c433b4b52c0fd49ba68a85166447e8ea2e792e6092a50ef1386d78ce9443fc

Contents?: true

Size: 2 KB

Versions: 17

Compression:

Stored size: 2 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'


CFLAGS = [Config::CONFIG['CFLAGS'], ENV['CFLAGS'], '-g', '-DDEBUG']
LDFLAGS = [Config::CONFIG['LDFLAGS'], ENV['LDFLAGS']]


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=#{CFLAGS.join(' ')}", "--with-ldflags=#{LDFLAGS.join(' ')}"
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'

file 'swig_vpi.h' => 'vpi_user.h' do |t|
  # avoid problems with SWIG-generated wrapper for VPI vprintf functions which use va_list
  ruby %{-pe 'gsub /\\bva_list\\b/, "int"' #{t.prerequisites[0]} > #{t.name}}
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

17 entries across 17 versions & 1 rubygems

Version Path
ruby-vpi-11.0.0 ext/Rakefile
ruby-vpi-10.0.0 ext/Rakefile
ruby-vpi-11.1.1 ext/Rakefile
ruby-vpi-12.0.1 ext/Rakefile
ruby-vpi-12.0.0 ext/Rakefile
ruby-vpi-11.1.0 ext/Rakefile
ruby-vpi-12.0.2 ext/Rakefile
ruby-vpi-12.1.0 ext/Rakefile
ruby-vpi-13.0.0 ext/Rakefile
ruby-vpi-8.1.0 ext/Rakefile
ruby-vpi-7.0.0 ext/Rakefile
ruby-vpi-7.2.0 ext/Rakefile
ruby-vpi-8.0.0 ext/Rakefile
ruby-vpi-7.3.0 ext/Rakefile
ruby-vpi-7.1.0 ext/Rakefile
ruby-vpi-9.0.0 ext/Rakefile
ruby-vpi-8.2.0 ext/Rakefile