aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--ext/extmk.rb3
-rw-r--r--lib/mkmf.rb21
3 files changed, 22 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 7b50360437..125b65bc03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Sep 10 18:26:52 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb, lib/mkmf.rb ($INCFLAGS): new var for -I$(topdir).
+
+ * lib/mkmf.rb: add #define WIN32_LEAN_AND_MEAN to improve compile
+ times.
+
Tue Sep 10 17:16:14 2002 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/Makefile.sub (miniruby): shouldn't link $(EXTOBJS).
diff --git a/ext/extmk.rb b/ext/extmk.rb
index ca46e25beb..25153fe208 100644
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -41,7 +41,7 @@ require 'find'
require 'ftools'
require 'shellwords'
-$topdir = $hdrdir = File.expand_path(".")
+$topdir = File.expand_path(".")
$top_srcdir = srcdir
Object.class_eval do remove_method :create_makefile end
@@ -374,6 +374,7 @@ def extmake(target)
$CPPFLAGS = CONFIG['CPPFLAGS']
$LDFLAGS = ""
$LIBPATH = [$libdir]
+ $INCFLAGS = "-I#{$topdir}"
dir_config("opt")
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index fb2ce78ee7..1e6a144818 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -68,7 +68,7 @@ else
STDERR.print "can't find header files for ruby.\n"
exit 1
end
-$topdir = $top_srcdir = $hdrdir
+$topdir = $hdrdir
# $hdrdir.gsub!('/', '\\') if RUBY_PLATFORM =~ /mswin32|bccwin32/
CFLAGS = CONFIG["CFLAGS"]
@@ -89,9 +89,9 @@ else
CPPOUTFILE = '-o conftest.i'
end
-$LINK = "#{CONFIG['CC']} #{OUTFLAG}conftest -I#{$hdrdir} -I#{$top_srcdir} #{CFLAGS} %s %s #{CONFIG['LDFLAGS']} %s conftest.c %s %s #{CONFIG['LIBS']}"
-$CC = "#{CONFIG['CC']} -c #{CONFIG['CPPFLAGS']} %s -I#{$hdrdir} -I#{$top_srcdir} #{CFLAGS} %s %s conftest.c"
-$CPP = "#{CONFIG['CPP']} #{CONFIG['CPPFLAGS']} %s -I#{$hdrdir} -I#{$top_srcdir} #{CFLAGS} %s %s %s conftest.c"
+$LINK = "#{CONFIG['CC']} #{OUTFLAG}conftest %s -I#{$hdrdir} %s #{CFLAGS} %s #{CONFIG['LDFLAGS']} %s conftest.c %s %s #{CONFIG['LIBS']}"
+$CC = "#{CONFIG['CC']} -c #{CONFIG['CPPFLAGS']} %s -I#{$hdrdir} %s #{CFLAGS} %s %s conftest.c"
+$CPP = "#{CONFIG['CPP']} #{CONFIG['CPPFLAGS']} %s -I#{$hdrdir} %s #{CFLAGS} %s %s %s conftest.c"
def rm_f(*files)
targets = []
@@ -175,7 +175,7 @@ def try_link0(src, opt="")
$LIBPATH.each {|d| $LDFLAGS << " -L" + d}
end
begin
- xsystem(format($LINK, $CFLAGS, $CPPFLAGS, $LDFLAGS, opt, $LOCAL_LIBS))
+ xsystem(format($LINK, $INCFLAGS, $CPPFLAGS, $CFLAGS, $LDFLAGS, opt, $LOCAL_LIBS))
ensure
$LDFLAGS = ldflags
ENV['LIB'] = ORIG_LIBPATH if /mswin32|bccwin32/ =~ RUBY_PLATFORM
@@ -198,7 +198,7 @@ def try_compile(src, opt="")
cfile.print src
cfile.close
begin
- xsystem(format($CC, $CPPFLAGS, $CFLAGS, opt))
+ xsystem(format($CC, $INCFLAGS, $CPPFLAGS, $CFLAGS, opt))
ensure
rm_f "conftest*"
end
@@ -209,7 +209,7 @@ def try_cpp(src, opt="")
cfile.print src
cfile.close
begin
- xsystem(format($CPP, $CPPFLAGS, $CFLAGS, CPPOUTFILE, opt))
+ xsystem(format($CPP, $INCFLAGS, $CPPFLAGS, $CFLAGS, CPPOUTFILE, opt))
ensure
rm_f "conftest*"
end
@@ -220,7 +220,7 @@ def egrep_cpp(pat, src, opt="")
cfile.print src
cfile.close
begin
- xpopen(format($CPP, $CFLAGS, $CPPFLAGS, '', opt)) do |f|
+ xpopen(format($CPP, $INCFLAGS, $CPPFLAGS, $CFLAGS, '', opt)) do |f|
if Regexp === pat
puts(" ruby -ne 'print if /#{pat.source}/'")
f.grep(pat) {|l|
@@ -335,6 +335,7 @@ def have_library(lib, func="main")
return true
end
r = try_link(<<"SRC", libs)
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock.h>
int main() { return 0; }
@@ -342,6 +343,7 @@ int t() { #{func}(); return 0; }
SRC
unless r
r = try_link(<<"SRC", libs)
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock.h>
int main() { return 0; }
@@ -395,6 +397,7 @@ def have_func(func, header=nil)
src =
if /mswin32|bccwin32|mingw/ =~ RUBY_PLATFORM
r = <<"SRC"
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock.h>
SRC
@@ -445,6 +448,7 @@ def have_struct_member(type, member, header=nil)
src =
if /mswin32|bccwin32|mingw/ =~ RUBY_PLATFORM
r = <<"SRC"
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock.h>
SRC
@@ -856,6 +860,7 @@ $CFLAGS = with_config("cflags", arg_config("CFLAGS", ""))
$CPPFLAGS = with_config("cppflags", arg_config("CPPFLAGS", ""))
$LDFLAGS = with_config("ldflags", arg_config("LDFLAGS", ""))
$LIBPATH = []
+$INCFLAGS = ""
dir_config("opt")