1999-01-20 07:59:39 +03:00
|
|
|
# module to create Makefile for extension modules
|
1998-01-16 15:19:09 +03:00
|
|
|
# invoke like: ruby -r mkmf extconf.rb
|
|
|
|
|
|
|
|
require 'rbconfig'
|
1999-01-20 07:59:39 +03:00
|
|
|
require 'find'
|
1998-01-16 15:19:09 +03:00
|
|
|
|
1999-12-06 12:04:03 +03:00
|
|
|
CONFIG = Config::MAKEFILE_CONFIG
|
1998-01-16 15:19:09 +03:00
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
SRC_EXT = ["c", "cc", "m", "cxx", "cpp", "C"]
|
|
|
|
|
1998-01-16 15:19:09 +03:00
|
|
|
$config_cache = CONFIG["compile_dir"]+"/ext/config.cache"
|
|
|
|
|
|
|
|
$srcdir = CONFIG["srcdir"]
|
1999-08-13 09:45:20 +04:00
|
|
|
$libdir = CONFIG["libdir"]+"/ruby/"+CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
|
1998-01-16 15:19:09 +03:00
|
|
|
$archdir = $libdir+"/"+CONFIG["arch"]
|
|
|
|
|
|
|
|
if File.exist? $archdir + "/ruby.h"
|
|
|
|
$hdrdir = $archdir
|
|
|
|
elsif File.exist? $srcdir + "/ruby.h"
|
|
|
|
$hdrdir = $srcdir
|
|
|
|
else
|
|
|
|
STDERR.print "can't find header files for ruby.\n"
|
|
|
|
exit 1
|
|
|
|
end
|
1999-08-13 09:45:20 +04:00
|
|
|
$topdir = $hdrdir
|
|
|
|
$hdrdir.gsub!('/', '\\') if RUBY_PLATFORM =~ /mswin32/
|
1998-01-16 15:19:09 +03:00
|
|
|
|
|
|
|
CFLAGS = CONFIG["CFLAGS"]
|
1999-08-13 09:45:20 +04:00
|
|
|
if RUBY_PLATFORM == "m68k-human"
|
1998-01-16 15:19:09 +03:00
|
|
|
CFLAGS.gsub!(/-c..-stack=[0-9]+ */, '')
|
1999-08-13 09:45:20 +04:00
|
|
|
elsif RUBY_PLATFORM =~ /-nextstep|-rhapsody/
|
|
|
|
CFLAGS.gsub!( /-arch\s\w*/, '' )
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
1999-08-13 09:45:20 +04:00
|
|
|
if /win32|djgpp|mingw32|m68k-human|i386-os2_emx/i =~ RUBY_PLATFORM
|
1999-01-20 07:59:39 +03:00
|
|
|
$null = open("nul", "w")
|
|
|
|
else
|
|
|
|
$null = open("/dev/null", "w")
|
|
|
|
end
|
1999-08-13 09:45:20 +04:00
|
|
|
LINK = "#{CONFIG['CC']} -o conftest -I#{$hdrdir} #{CFLAGS} -I#{CONFIG['includedir']} %s #{CONFIG['LDFLAGS']} %s conftest.c %s %s #{CONFIG['LIBS']}"
|
|
|
|
CPP = "#{CONFIG['CPP']} -E -I#{$hdrdir} #{CFLAGS} -I#{CONFIG['includedir']} %s %s conftest.c"
|
1999-01-20 07:59:39 +03:00
|
|
|
|
|
|
|
$orgerr = $stderr.dup
|
|
|
|
$orgout = $stdout.dup
|
|
|
|
def xsystem command
|
|
|
|
if $DEBUG
|
|
|
|
print command, "\n"
|
|
|
|
return system(command)
|
|
|
|
end
|
|
|
|
$stderr.reopen($null)
|
|
|
|
$stdout.reopen($null)
|
|
|
|
r = system(command)
|
|
|
|
$stderr.reopen($orgerr)
|
|
|
|
$stdout.reopen($orgout)
|
|
|
|
return r
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
def try_link0(src, opt="")
|
|
|
|
cfile = open("conftest.c", "w")
|
|
|
|
cfile.print src
|
|
|
|
cfile.close
|
|
|
|
xsystem(format(LINK, $CFLAGS, $LDFLAGS, opt, $LOCAL_LIBS))
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
def try_link(src, opt="")
|
|
|
|
begin
|
|
|
|
try_link0(src, opt)
|
|
|
|
ensure
|
|
|
|
system "rm -f conftest*"
|
|
|
|
end
|
1999-01-20 07:59:39 +03:00
|
|
|
end
|
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
def try_cpp(src, opt="")
|
|
|
|
cfile = open("conftest.c", "w")
|
|
|
|
cfile.print src
|
|
|
|
cfile.close
|
|
|
|
begin
|
|
|
|
xsystem(format(CPP, $CFLAGS, opt))
|
|
|
|
ensure
|
|
|
|
system "rm -f conftest*"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def egrep_cpp(pat, src, opt="")
|
|
|
|
cfile = open("conftest.c", "w")
|
|
|
|
cfile.print src
|
|
|
|
cfile.close
|
|
|
|
begin
|
|
|
|
xsystem(format(CPP+"|egrep #{pat}", $CFLAGS, opt))
|
|
|
|
ensure
|
|
|
|
system "rm -f conftest*"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def try_run(src, opt="")
|
|
|
|
begin
|
|
|
|
if try_link0(src, opt)
|
|
|
|
if xsystem("./conftest")
|
|
|
|
true
|
|
|
|
else
|
|
|
|
false
|
|
|
|
end
|
|
|
|
else
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
ensure
|
|
|
|
system "rm -f conftest*"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def install_rb(mfile, srcdir = nil)
|
|
|
|
libdir = "lib"
|
|
|
|
libdir = srcdir + "/" + libdir if srcdir
|
1999-01-20 07:59:39 +03:00
|
|
|
path = []
|
|
|
|
dir = []
|
1999-08-13 09:45:20 +04:00
|
|
|
Find.find(libdir) do |f|
|
1999-01-20 07:59:39 +03:00
|
|
|
next unless /\.rb$/ =~ f
|
1999-08-13 09:45:20 +04:00
|
|
|
f = f[libdir.length+1..-1]
|
1999-01-20 07:59:39 +03:00
|
|
|
path.push f
|
|
|
|
dir |= File.dirname(f)
|
|
|
|
end
|
|
|
|
for f in dir
|
|
|
|
next if f == "."
|
1999-08-13 09:45:20 +04:00
|
|
|
mfile.printf "\t@$(RUBY) -r ftools -e 'File::makedirs(*ARGV)' $(libdir)/%s\n", f
|
1999-01-20 07:59:39 +03:00
|
|
|
end
|
|
|
|
for f in path
|
1999-08-13 09:45:20 +04:00
|
|
|
mfile.printf "\t@$(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0644, true)' lib/%s $(libdir)/%s\n", f, f
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def append_library(libs, lib)
|
|
|
|
if /mswin32/ =~ RUBY_PLATFORM
|
|
|
|
lib + ".lib " + libs
|
|
|
|
else
|
|
|
|
"-l" + lib + " " + libs
|
1999-01-20 07:59:39 +03:00
|
|
|
end
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
|
|
|
|
1999-01-20 07:59:39 +03:00
|
|
|
def have_library(lib, func="main")
|
1998-01-16 15:19:09 +03:00
|
|
|
printf "checking for %s() in -l%s... ", func, lib
|
|
|
|
STDOUT.flush
|
|
|
|
|
1999-01-20 07:59:39 +03:00
|
|
|
if func && func != ""
|
1999-08-13 09:45:20 +04:00
|
|
|
libs = append_library($libs, lib)
|
|
|
|
if /mswin32/ =~ RUBY_PLATFORM
|
|
|
|
r = try_link(<<"SRC", libs)
|
|
|
|
#include <windows.h>
|
|
|
|
#include <winsock.h>
|
1998-01-16 15:19:09 +03:00
|
|
|
int main() { return 0; }
|
1999-08-13 09:45:20 +04:00
|
|
|
int t() { #{func}(); return 0; }
|
|
|
|
SRC
|
|
|
|
unless r
|
|
|
|
r = try_link(<<"SRC", libs)
|
|
|
|
#include <windows.h>
|
|
|
|
#include <winsock.h>
|
|
|
|
int main() { return 0; }
|
|
|
|
int t() { void ((*p)()); p = (void ((*)()))#{func}; return 0; }
|
|
|
|
SRC
|
1999-01-20 07:59:39 +03:00
|
|
|
end
|
1998-01-16 15:19:09 +03:00
|
|
|
else
|
1999-08-13 09:45:20 +04:00
|
|
|
r = try_link(<<"SRC", libs)
|
|
|
|
int main() { return 0; }
|
|
|
|
int t() { #{func}(); return 0; }
|
|
|
|
SRC
|
|
|
|
end
|
|
|
|
unless r
|
|
|
|
print "no\n"
|
|
|
|
return false
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
1999-08-13 09:45:20 +04:00
|
|
|
else
|
|
|
|
libs = append_library($libs, lib)
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
$libs = libs
|
1999-08-13 09:45:20 +04:00
|
|
|
print "yes\n"
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
def find_library(lib, func, *paths)
|
|
|
|
printf "checking for %s() in -l%s... ", func, lib
|
|
|
|
STDOUT.flush
|
|
|
|
|
|
|
|
ldflags = $LDFLAGS
|
|
|
|
libs = append_library($libs, lib)
|
|
|
|
until try_link(<<"SRC", libs)
|
|
|
|
int main() { return 0; }
|
|
|
|
int t() { #{func}(); return 0; }
|
|
|
|
SRC
|
|
|
|
if paths.size == 0
|
|
|
|
$LDFLAGS = ldflags
|
|
|
|
print "no\n"
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
$LDFLAGS = ldflags + " -L"+paths.shift
|
|
|
|
end
|
|
|
|
$libs = libs
|
1998-01-16 15:19:09 +03:00
|
|
|
print "yes\n"
|
1999-08-13 09:45:20 +04:00
|
|
|
return true
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
def have_func(func)
|
|
|
|
printf "checking for %s()... ", func
|
|
|
|
STDOUT.flush
|
|
|
|
|
|
|
|
libs = $libs
|
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
if /mswin32/ =~ RUBY_PLATFORM
|
|
|
|
r = try_link(<<"SRC", libs)
|
|
|
|
#include <windows.h>
|
|
|
|
#include <winsock.h>
|
|
|
|
int main() { return 0; }
|
|
|
|
int t() { #{func}(); return 0; }
|
|
|
|
SRC
|
|
|
|
unless r
|
|
|
|
r = try_link(<<"SRC", libs)
|
|
|
|
#include <windows.h>
|
|
|
|
#include <winsock.h>
|
|
|
|
int main() { return 0; }
|
|
|
|
int t() { void ((*p)()); p = (void ((*)()))#{func}; return 0; }
|
|
|
|
SRC
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
1999-08-13 09:45:20 +04:00
|
|
|
else
|
|
|
|
r = try_link(<<"SRC", libs)
|
|
|
|
int main() { return 0; }
|
|
|
|
int t() { #{func}(); return 0; }
|
|
|
|
SRC
|
|
|
|
end
|
|
|
|
unless r
|
|
|
|
print "no\n"
|
|
|
|
return false
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
|
|
|
$defs.push(format("-DHAVE_%s", func.upcase))
|
|
|
|
print "yes\n"
|
1999-08-13 09:45:20 +04:00
|
|
|
return true
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
def have_header(header)
|
|
|
|
printf "checking for %s... ", header
|
|
|
|
STDOUT.flush
|
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
unless try_cpp(<<"SRC")
|
|
|
|
#include <#{header}>
|
|
|
|
SRC
|
|
|
|
print "no\n"
|
|
|
|
return false
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
2000-01-05 07:41:21 +03:00
|
|
|
header.tr!("a-z\055./", "A-Z___")
|
1998-01-16 15:19:09 +03:00
|
|
|
$defs.push(format("-DHAVE_%s", header))
|
|
|
|
print "yes\n"
|
1999-08-13 09:45:20 +04:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
def arg_config(config, default=nil)
|
|
|
|
unless defined? $configure_args
|
|
|
|
$configure_args = {}
|
|
|
|
for arg in CONFIG["configure_args"].split + ARGV
|
|
|
|
next unless /^--/ =~ arg
|
|
|
|
if /=/ =~ arg
|
|
|
|
$configure_args[$`] = $'
|
|
|
|
else
|
|
|
|
$configure_args[arg] = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
$configure_args.fetch(config, default)
|
|
|
|
end
|
|
|
|
|
|
|
|
def with_config(config, default=nil)
|
|
|
|
unless /^--with-/ =~ config
|
|
|
|
config = '--with-' + config
|
|
|
|
end
|
|
|
|
arg_config(config, default)
|
|
|
|
end
|
|
|
|
|
|
|
|
def enable_config(config, default=nil)
|
|
|
|
if arg_config("--enable-"+config, default)
|
|
|
|
true
|
|
|
|
elsif arg_config("--disable-"+config, false)
|
|
|
|
false
|
|
|
|
else
|
|
|
|
default
|
|
|
|
end
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
def create_header()
|
|
|
|
print "creating extconf.h\n"
|
|
|
|
STDOUT.flush
|
|
|
|
if $defs.length > 0
|
|
|
|
hfile = open("extconf.h", "w")
|
|
|
|
for line in $defs
|
|
|
|
line =~ /^-D(.*)/
|
|
|
|
hfile.printf "#define %s 1\n", $1
|
|
|
|
end
|
|
|
|
hfile.close
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
def dir_config(target)
|
|
|
|
dir = with_config("%s-dir"%target)
|
|
|
|
if dir
|
|
|
|
idir = " -I"+dir+"/include"
|
|
|
|
ldir = " -L"+dir+"/lib"
|
|
|
|
end
|
|
|
|
unless idir
|
|
|
|
dir = with_config("%s-include"%target)
|
|
|
|
idir = " -I"+dir if dir
|
|
|
|
end
|
|
|
|
unless ldir
|
|
|
|
dir = with_config("%s-lib"%target)
|
|
|
|
ldir = " -L"+dir if dir
|
|
|
|
end
|
|
|
|
|
|
|
|
$CFLAGS += idir if idir
|
|
|
|
$LDFLAGS += ldir if ldir
|
|
|
|
end
|
|
|
|
|
1998-01-16 15:19:09 +03:00
|
|
|
def create_makefile(target)
|
|
|
|
print "creating Makefile\n"
|
1999-08-13 09:45:20 +04:00
|
|
|
system "rm -f conftest*"
|
1998-01-16 15:19:09 +03:00
|
|
|
STDOUT.flush
|
1999-08-13 09:45:20 +04:00
|
|
|
if CONFIG["DLEXT"] == $OBJEXT
|
1998-01-16 15:19:09 +03:00
|
|
|
libs = $libs.split
|
|
|
|
for lib in libs
|
|
|
|
lib.sub!(/-l(.*)/, '"lib\1.a"')
|
|
|
|
end
|
|
|
|
$defs.push(format("-DEXTLIB='%s'", libs.join(",")))
|
|
|
|
end
|
1999-01-20 07:59:39 +03:00
|
|
|
$DLDFLAGS = CONFIG["DLDFLAGS"]
|
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
if RUBY_PLATFORM =~ /beos/
|
1999-01-20 07:59:39 +03:00
|
|
|
$libs = $libs + " -lruby"
|
|
|
|
$DLDFLAGS = $DLDFLAGS + " -L" + CONFIG["prefix"] + "/lib"
|
|
|
|
end
|
1998-01-16 15:19:09 +03:00
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
defflag = ''
|
|
|
|
if RUBY_PLATFORM =~ /cygwin/
|
|
|
|
if File.exist? target + ".def"
|
|
|
|
defflag = "--def=" + target + ".def"
|
|
|
|
end
|
|
|
|
$libs = $libs + " " + CONFIG["LIBRUBYARG"]
|
|
|
|
$DLDFLAGS = $DLDFLAGS + " -L$(topdir)"
|
|
|
|
end
|
|
|
|
|
1999-01-20 07:59:39 +03:00
|
|
|
unless $objs then
|
1999-08-13 09:45:20 +04:00
|
|
|
$objs = []
|
|
|
|
for f in Dir["*.{#{SRC_EXT.join(%q{,})}}"]
|
|
|
|
f = File.basename(f)
|
|
|
|
f.sub!(/(#{SRC_EXT.join(%q{|})})$/, $OBJEXT)
|
|
|
|
$objs.push f
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
$objs = $objs.join(" ")
|
|
|
|
|
|
|
|
mfile = open("Makefile", "w")
|
|
|
|
mfile.print <<EOMF
|
|
|
|
SHELL = /bin/sh
|
|
|
|
|
|
|
|
#### Start of system configuration section. ####
|
|
|
|
|
|
|
|
srcdir = #{$srcdir}
|
1999-08-13 09:45:20 +04:00
|
|
|
topdir = #{$topdir}
|
1998-01-16 15:19:09 +03:00
|
|
|
hdrdir = #{$hdrdir}
|
|
|
|
|
1999-01-20 07:59:39 +03:00
|
|
|
CC = #{CONFIG["CC"]}
|
1998-01-16 15:19:09 +03:00
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
CFLAGS = #{CONFIG["CCDLFLAGS"]} -I$(hdrdir) #{CFLAGS} #{$CFLAGS} -I#{CONFIG["includedir"]} #{$defs.join(" ")}
|
1999-01-20 07:59:39 +03:00
|
|
|
CXXFLAGS = $(CFLAGS)
|
|
|
|
DLDFLAGS = #{$DLDFLAGS} #{$LDFLAGS}
|
1999-08-13 09:45:20 +04:00
|
|
|
LDSHARED = #{CONFIG["LDSHARED"]} #{defflag}
|
1998-01-16 15:19:09 +03:00
|
|
|
|
2000-01-05 07:41:21 +03:00
|
|
|
RUBY_INSTALL_NAME = #{CONFIG["RUBY_INSTALL_NAME"]}
|
|
|
|
|
1998-01-16 15:19:09 +03:00
|
|
|
prefix = #{CONFIG["prefix"]}
|
|
|
|
exec_prefix = #{CONFIG["exec_prefix"]}
|
1999-01-20 07:59:39 +03:00
|
|
|
libdir = #{$libdir}
|
|
|
|
archdir = #{$archdir}
|
1998-01-16 15:19:09 +03:00
|
|
|
|
|
|
|
#### End of system configuration section. ####
|
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
LOCAL_LIBS = #{$LOCAL_LIBS} #{$local_flags}
|
1998-01-16 15:19:09 +03:00
|
|
|
LIBS = #{$libs}
|
|
|
|
OBJS = #{$objs}
|
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
TARGET = #{target}
|
|
|
|
DLLIB = $(TARGET).#{CONFIG["DLEXT"]}
|
1998-01-16 15:19:09 +03:00
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
RUBY = #{CONFIG["ruby_install_name"]}
|
1998-01-16 15:19:09 +03:00
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
EXEEXT = #{CONFIG["EXEEXT"]}
|
1998-01-16 15:19:09 +03:00
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
all: $(DLLIB)
|
1998-01-16 15:19:09 +03:00
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
clean:; @rm -f *.#{$OBJEXT} *.so *.sl *.a $(DLLIB)
|
|
|
|
@rm -f $(TARGET).lib $(TARGET).exp
|
1998-01-16 15:19:09 +03:00
|
|
|
@rm -f Makefile extconf.h conftest.*
|
1999-08-13 09:45:20 +04:00
|
|
|
@rm -f core ruby$(EXEEXT) *~
|
1998-01-16 15:19:09 +03:00
|
|
|
|
|
|
|
realclean: clean
|
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
install: $(archdir)/$(DLLIB)
|
1998-01-16 15:19:09 +03:00
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
$(archdir)/$(DLLIB): $(DLLIB)
|
|
|
|
@$(RUBY) -r ftools -e 'File::makedirs(*ARGV)' $(libdir) $(archdir)
|
|
|
|
@$(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0555, true)' $(DLLIB) $(archdir)/$(DLLIB)
|
1998-01-16 15:19:09 +03:00
|
|
|
EOMF
|
1999-01-20 07:59:39 +03:00
|
|
|
install_rb(mfile)
|
1998-01-16 15:19:09 +03:00
|
|
|
mfile.printf "\n"
|
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
if CONFIG["DLEXT"] != $OBJEXT
|
1998-01-16 15:19:09 +03:00
|
|
|
mfile.printf <<EOMF
|
1999-08-13 09:45:20 +04:00
|
|
|
$(DLLIB): $(OBJS)
|
|
|
|
$(LDSHARED) $(DLDFLAGS) -o $(DLLIB) $(OBJS) $(LIBS) $(LOCAL_LIBS)
|
1998-01-16 15:19:09 +03:00
|
|
|
EOMF
|
1999-08-13 09:45:20 +04:00
|
|
|
elsif not File.exist?(target + ".c") and not File.exist?(target + ".cc")
|
|
|
|
mfile.print "$(DLLIB): $(OBJS)\n"
|
|
|
|
case RUBY_PLATFORM
|
1998-01-16 15:19:09 +03:00
|
|
|
when "m68k-human"
|
1999-08-13 09:45:20 +04:00
|
|
|
mfile.printf "ar cru $(DLLIB) $(OBJS)\n"
|
1998-01-16 15:19:09 +03:00
|
|
|
else
|
1999-08-13 09:45:20 +04:00
|
|
|
mfile.printf "ld $(DLDFLAGS) -r -o $(DLLIB) $(OBJS)\n"
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if File.exist?("depend")
|
|
|
|
dfile = open("depend", "r")
|
|
|
|
mfile.printf "###\n"
|
|
|
|
while line = dfile.gets()
|
1999-08-13 09:45:20 +04:00
|
|
|
mfile.printf "%s", line.gsub(/\.o/, ".#{$OBJEXT}")
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
|
|
|
dfile.close
|
|
|
|
end
|
|
|
|
mfile.close
|
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
if RUBY_PLATFORM =~ /beos/
|
|
|
|
if RUBY_PLATFORM =~ /^powerpc/ then
|
|
|
|
deffilename = "ruby.exp"
|
|
|
|
else
|
|
|
|
deffilename = "ruby.def"
|
|
|
|
end
|
|
|
|
print "creating #{deffilename}\n"
|
|
|
|
open(deffilename, "w") do |file|
|
|
|
|
file.print("EXPORTS\n") if RUBY_PLATFORM =~ /^i/
|
1999-01-20 07:59:39 +03:00
|
|
|
file.print("Init_#{target}\n")
|
|
|
|
end
|
|
|
|
end
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
$OBJEXT = CONFIG["OBJEXT"]
|
1998-01-16 15:19:09 +03:00
|
|
|
$objs = nil
|
1999-08-13 09:45:20 +04:00
|
|
|
$libs = "-lc"
|
|
|
|
$local_flags = ""
|
|
|
|
case RUBY_PLATFORM
|
|
|
|
when /cygwin|beos|openstep|nextstep|rhapsody/
|
|
|
|
$libs = ""
|
|
|
|
when /mswin32/
|
|
|
|
$libs = ""
|
|
|
|
$local_flags = "rubymw.lib -link /LIBPATH:$(topdir) /EXPORT:Init_$(TARGET)"
|
|
|
|
end
|
|
|
|
$LOCAL_LIBS = ""
|
1998-01-16 15:19:09 +03:00
|
|
|
$defs = []
|
1999-08-13 09:45:20 +04:00
|
|
|
|
|
|
|
dir = with_config("opt-dir")
|
|
|
|
if dir
|
|
|
|
idir = "-I"+dir+"/include"
|
|
|
|
ldir = "-L"+dir+"/lib"
|
|
|
|
end
|
|
|
|
unless idir
|
|
|
|
dir = with_config("opt-include")
|
|
|
|
idir = "-I"+dir if dir
|
|
|
|
end
|
|
|
|
unless ldir
|
|
|
|
dir = with_config("opt-lib")
|
|
|
|
ldir = "-L"+dir if dir
|
|
|
|
end
|
|
|
|
|
|
|
|
$CFLAGS = idir || ""
|
|
|
|
$LDFLAGS = ldir || ""
|