summaryrefslogtreecommitdiff
path: root/lib/mkmf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mkmf.rb')
-rw-r--r--lib/mkmf.rb29
1 files changed, 26 insertions, 3 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 380e660233..fcda97ce38 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -1233,6 +1233,29 @@ def winsep(s)
s.tr('/', '\\')
end
+# Converts native path to format acceptable in Makefile
+#
+# Internal use only.
+#
+if !CROSS_COMPILING
+ case CONFIG['build_os']
+ when 'mingw32'
+ def mkintpath(path)
+ # mingw uses make from msys and it needs special care
+ # converts from C:\some\path to /C/some/path
+ path = path.dup
+ path.tr!('\\', '/')
+ path.sub!(/\A([A-Za-z]):(?=\/)/, '/\1')
+ path
+ end
+ end
+end
+unless defined?(mkintpath)
+ def mkintpath(path)
+ path
+ end
+end
+
def configuration(srcdir)
mk = []
vpath = %w[$(srcdir) $(topdir) $(hdrdir)]
@@ -1255,9 +1278,9 @@ if $extmk
"top_srcdir = " + $top_srcdir.sub(%r"\A#{Regexp.quote($topdir)}/", "$(topdir)/")
end
}
-srcdir = #{srcdir.gsub(/\$\((srcdir)\)|\$\{(srcdir)\}/) {CONFIG[$1||$2]}.quote}
-topdir = #{($extmk ? CONFIG["topdir"] : $topdir).quote}
-hdrdir = #{$extmk ? CONFIG["hdrdir"].quote : '$(topdir)'}
+srcdir = #{srcdir.gsub(/\$\((srcdir)\)|\$\{(srcdir)\}/) {mkintpath(CONFIG[$1||$2])}.quote}
+topdir = #{mkintpath($extmk ? CONFIG["topdir"] : $topdir).quote}
+hdrdir = #{$extmk ? mkintpath(CONFIG["hdrdir"]).quote : '$(topdir)'}
VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])}
}
if $extmk