1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/extmk.rb (extmake): keep directory names in Makefile as macros.

* lib/mkmf.rb (configuration, create_makefile): ditto.

* lib/mkmf.rb (CXX_EXT): separate C++ extensions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-04-07 14:59:24 +00:00
parent 138b4c427c
commit 9ea857d7ee
3 changed files with 31 additions and 15 deletions

View file

@ -1,3 +1,11 @@
Thu Apr 7 23:58:40 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/extmk.rb (extmake): keep directory names in Makefile as macros.
* lib/mkmf.rb (configuration, create_makefile): ditto.
* lib/mkmf.rb (CXX_EXT): separate C++ extensions.
Thu Apr 7 17:24:17 2005 Shugo Maeda <shugo@ruby-lang.org> Thu Apr 7 17:24:17 2005 Shugo Maeda <shugo@ruby-lang.org>
* eval.c (rb_call0): "return" event hook should be always executed * eval.c (rb_call0): "return" event hook should be always executed

View file

@ -102,6 +102,8 @@ def extmake(target)
Dir.chdir target Dir.chdir target
top_srcdir = $top_srcdir top_srcdir = $top_srcdir
topdir = $topdir topdir = $topdir
mk_srcdir = CONFIG["srcdir"]
mk_topdir = CONFIG["topdir"]
prefix = "../" * (target.count("/")+1) prefix = "../" * (target.count("/")+1)
$hdrdir = $top_srcdir = relative_from(top_srcdir, prefix) $hdrdir = $top_srcdir = relative_from(top_srcdir, prefix)
$topdir = prefix + $topdir $topdir = prefix + $topdir
@ -115,6 +117,9 @@ def extmake(target)
unless $ignore unless $ignore
Config::CONFIG["srcdir"] = $srcdir Config::CONFIG["srcdir"] = $srcdir
Config::CONFIG["topdir"] = $topdir Config::CONFIG["topdir"] = $topdir
CONFIG["hdrdir"] = ($hdrdir == top_srcdir) ? top_srcdir : "$(topdir)/"+top_srcdir
CONFIG["srcdir"] = "$(hdrdir)/ext/#{$mdir}"
CONFIG["topdir"] = $topdir
begin begin
if (!(ok &&= extract_makefile(makefile)) || if (!(ok &&= extract_makefile(makefile)) ||
!(t = modified?(makefile, MTIMES)) || !(t = modified?(makefile, MTIMES)) ||
@ -140,14 +145,12 @@ def extmake(target)
rm_f "conftest*" rm_f "conftest*"
config = $0 config = $0
$0 = $PROGRAM_NAME $0 = $PROGRAM_NAME
Config::CONFIG["srcdir"] = $top_srcdir
Config::CONFIG["topdir"] = topdir
end end
end end
ok = yield(ok) if block_given? ok = yield(ok) if block_given?
unless ok unless ok
open(makefile, "w") do |f| open(makefile, "w") do |f|
f.print dummy_makefile($srcdir) f.print dummy_makefile(CONFIG["srcdir"])
end end
return true return true
end end
@ -175,6 +178,10 @@ def extmake(target)
end end
ensure ensure
Config::CONFIG["srcdir"] = $top_srcdir Config::CONFIG["srcdir"] = $top_srcdir
Config::CONFIG["topdir"] = topdir
CONFIG["srcdir"] = mk_srcdir
CONFIG["topdir"] = mk_topdir
CONFIG.delete("hdrdir")
$hdrdir = $top_srcdir = top_srcdir $hdrdir = $top_srcdir = top_srcdir
$topdir = topdir $topdir = topdir
Dir.chdir dir Dir.chdir dir

View file

@ -8,10 +8,11 @@ require 'shellwords'
CONFIG = Config::MAKEFILE_CONFIG CONFIG = Config::MAKEFILE_CONFIG
ORIG_LIBPATH = ENV['LIB'] ORIG_LIBPATH = ENV['LIB']
SRC_EXT = %w[c cc m cxx cpp] CXX_EXT = %w[cc cxx cpp]
if /mswin|bccwin|mingw|msdosdjgpp|human|os2/ !~ CONFIG['build_os'] if /mswin|bccwin|mingw|msdosdjgpp|human|os2/ !~ CONFIG['build_os']
SRC_EXT.concat(%w[C]) CXX_EXT.concat(%w[C])
end end
SRC_EXT = %w[c m] << CXX_EXT
$static = $config_h = nil $static = $config_h = nil
unless defined? $configure_args unless defined? $configure_args
@ -847,8 +848,8 @@ SHELL = /bin/sh
#### Start of system configuration section. #### #### Start of system configuration section. ####
srcdir = #{srcdir} srcdir = #{srcdir}
topdir = #{$topdir} topdir = #{$extmk ? CONFIG["topdir"] : $topdir}
hdrdir = #{$extmk ? $hdrdir : '$(topdir)'} hdrdir = #{$extmk ? CONFIG["hdrdir"] : '$(topdir)'}
VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])} VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])}
} }
drive = File::PATH_SEPARATOR == ';' ? /\A\w:/ : /\A/ drive = File::PATH_SEPARATOR == ';' ? /\A\w:/ : /\A/
@ -938,7 +939,7 @@ def create_makefile(target, srcprefix = nil)
target_prefix = "" target_prefix = ""
end end
srcprefix ||= '$(srcdir)' srcprefix ||= CONFIG['srcdir']
Config::expand(srcdir = srcprefix.dup) Config::expand(srcdir = srcprefix.dup)
if not $objs if not $objs
@ -979,7 +980,7 @@ def create_makefile(target, srcprefix = nil)
dllib = target ? "$(TARGET).#{CONFIG['DLEXT']}" : "" dllib = target ? "$(TARGET).#{CONFIG['DLEXT']}" : ""
staticlib = target ? "$(TARGET).#$LIBEXT" : "" staticlib = target ? "$(TARGET).#$LIBEXT" : ""
mfile = open("Makefile", "wb") mfile = open("Makefile", "wb")
mfile.print configuration(srcdir) mfile.print configuration(srcprefix)
mfile.print %{ mfile.print %{
libpath = #{$LIBPATH.join(" ")} libpath = #{$LIBPATH.join(" ")}
LIBPATH = #{libpath} LIBPATH = #{libpath}
@ -1058,7 +1059,7 @@ site-install-rb: install-rb
mfile.print ".SUFFIXES: .#{SRC_EXT.join(' .')} .#{$OBJEXT}\n" mfile.print ".SUFFIXES: .#{SRC_EXT.join(' .')} .#{$OBJEXT}\n"
mfile.print "\n" mfile.print "\n"
%w[cc cpp cxx C].each do |ext| CXX_EXT.each do |ext|
COMPILE_RULES.each do |rule| COMPILE_RULES.each do |rule|
mfile.printf(rule, ext, $OBJEXT) mfile.printf(rule, ext, $OBJEXT)
mfile.printf("\n\t%s\n\n", COMPILE_CXX) mfile.printf("\n\t%s\n\n", COMPILE_CXX)