Removed RCS-style IDs.
[ruby-esmart.git] / library.rb
1 require "rbconfig"
2
3 class Library
4         def initialize(name, prefix, dir, lib = name)
5                 @name = name
6                 @prefix = prefix
7                 @dir = dir
8                 @lib = lib
9         end
10
11         def ldflags
12                 s = "#{ENV["LDFLAGS"]} -L #{@prefix}/lib -L " +
13                     Config::CONFIG["libdir"] + " " +
14                     Config::CONFIG["LIBRUBYARG_SHARED"] +
15                         " -shared -Wl"
16                 s << " -l#{@lib}" unless @lib.nil?
17                 s
18         end
19
20         def cflags
21                 "#{ENV["CFLAGS"]} -I #{@prefix}/include " +
22                 "-I #{Config::CONFIG['archdir']} " +
23                 "-I #{Config::CONFIG['sitearchdir']} -fPIC"
24         end
25
26         def so
27                 "#{@dir}/#{@name}.so"
28         end
29
30         def objects
31                 Dir["#{@dir}/*.c"].map { |f| f.sub(/\.[^.]+$/, ".o") }
32         end
33 end