From 9ea857d7ee2ee9ccb8527751c27422f6dbc9a87b Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 7 Apr 2005 14:59:24 +0000 Subject: [PATCH] * 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 --- ChangeLog | 18 +++++++++++++----- ext/extmk.rb | 13 ++++++++++--- lib/mkmf.rb | 15 ++++++++------- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9643dd1df0..976083fe6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Apr 7 23:58:40 2005 Nobuyoshi Nakada + + * 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 * eval.c (rb_call0): "return" event hook should be always executed @@ -18,7 +26,7 @@ Thu Apr 7 11:49:53 2005 Kouhei Sutou * test/rss/test_maker_dc.rb (test_rss10_multiple): added a test for making multiple Dublin Core items. - + Wed Apr 6 16:06:30 2005 Hirokazu Yamamoto * test/ruby/test_env.rb (test_key): should test ENV.key instead of @@ -57,19 +65,19 @@ Tue Apr 5 15:15:26 2005 Kouhei Sutou * lib/rss/trackback.rb (RSS::TrackBackUtils.new_with_value_if_need): moved to RSS::Utils. - + * lib/rss/utils.rb (RSS::Utils.new_with_value_if_need): moved from RSS::TrackBackUtils. - + * lib/rss/maker/image.rb: fixed invalid argument of add_need_initialize_variable bug. - + * lib/rss/maker/trackback.rb: ditto. * lib/rss/rss.rb (Hash#merge): added for ruby 1.6. - + * lib/rss/rss.rb (RSS::BaseModel.date_writer): changed to accept nil for date value. diff --git a/ext/extmk.rb b/ext/extmk.rb index db4bdf3ce0..d7d4d2fbd2 100644 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -102,6 +102,8 @@ def extmake(target) Dir.chdir target top_srcdir = $top_srcdir topdir = $topdir + mk_srcdir = CONFIG["srcdir"] + mk_topdir = CONFIG["topdir"] prefix = "../" * (target.count("/")+1) $hdrdir = $top_srcdir = relative_from(top_srcdir, prefix) $topdir = prefix + $topdir @@ -115,6 +117,9 @@ def extmake(target) unless $ignore Config::CONFIG["srcdir"] = $srcdir Config::CONFIG["topdir"] = $topdir + CONFIG["hdrdir"] = ($hdrdir == top_srcdir) ? top_srcdir : "$(topdir)/"+top_srcdir + CONFIG["srcdir"] = "$(hdrdir)/ext/#{$mdir}" + CONFIG["topdir"] = $topdir begin if (!(ok &&= extract_makefile(makefile)) || !(t = modified?(makefile, MTIMES)) || @@ -140,14 +145,12 @@ def extmake(target) rm_f "conftest*" config = $0 $0 = $PROGRAM_NAME - Config::CONFIG["srcdir"] = $top_srcdir - Config::CONFIG["topdir"] = topdir end end ok = yield(ok) if block_given? unless ok open(makefile, "w") do |f| - f.print dummy_makefile($srcdir) + f.print dummy_makefile(CONFIG["srcdir"]) end return true end @@ -175,6 +178,10 @@ def extmake(target) end ensure 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 $topdir = topdir Dir.chdir dir diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 5e83eb76b2..841e79c0af 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -8,10 +8,11 @@ require 'shellwords' CONFIG = Config::MAKEFILE_CONFIG 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'] - SRC_EXT.concat(%w[C]) + CXX_EXT.concat(%w[C]) end +SRC_EXT = %w[c m] << CXX_EXT $static = $config_h = nil unless defined? $configure_args @@ -847,8 +848,8 @@ SHELL = /bin/sh #### Start of system configuration section. #### srcdir = #{srcdir} -topdir = #{$topdir} -hdrdir = #{$extmk ? $hdrdir : '$(topdir)'} +topdir = #{$extmk ? CONFIG["topdir"] : $topdir} +hdrdir = #{$extmk ? CONFIG["hdrdir"] : '$(topdir)'} VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])} } drive = File::PATH_SEPARATOR == ';' ? /\A\w:/ : /\A/ @@ -938,7 +939,7 @@ def create_makefile(target, srcprefix = nil) target_prefix = "" end - srcprefix ||= '$(srcdir)' + srcprefix ||= CONFIG['srcdir'] Config::expand(srcdir = srcprefix.dup) if not $objs @@ -979,7 +980,7 @@ def create_makefile(target, srcprefix = nil) dllib = target ? "$(TARGET).#{CONFIG['DLEXT']}" : "" staticlib = target ? "$(TARGET).#$LIBEXT" : "" mfile = open("Makefile", "wb") - mfile.print configuration(srcdir) + mfile.print configuration(srcprefix) mfile.print %{ libpath = #{$LIBPATH.join(" ")} LIBPATH = #{libpath} @@ -1058,7 +1059,7 @@ site-install-rb: install-rb mfile.print ".SUFFIXES: .#{SRC_EXT.join(' .')} .#{$OBJEXT}\n" mfile.print "\n" - %w[cc cpp cxx C].each do |ext| + CXX_EXT.each do |ext| COMPILE_RULES.each do |rule| mfile.printf(rule, ext, $OBJEXT) mfile.printf("\n\t%s\n\n", COMPILE_CXX)