Skip to content

Commit e109400

Browse files
committed
Win32: Fix sub make commands
`cmd.exe` built-in `cd` does not recognize slashes as path separators, replace to backslashes.
1 parent 3a2d1fe commit e109400

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

ext/extmk.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -817,9 +817,9 @@ def mf.macro(name, values, max = 70)
817817
if $gnumake == "yes"
818818
submake = "$(MAKE) -C $(@D)"
819819
else
820-
submake = "cd $(@D) && "
821-
config_string("exec") {|str| submake << str << " "}
822-
submake << "$(MAKE)"
820+
submake = ["cd", (sep ? "$(@D:/=#{sep})" : "$(@D)"), "&&"]
821+
config_string("exec") {|str| submake << str}
822+
submake = (submake << "$(MAKE)").join(" ")
823823
end
824824
targets.each do |tgt|
825825
exts.each do |d|

template/exts.mk.tmpl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,14 @@ def self.column
110110
w
111111
end
112112
objext = RbConfig::CONFIG["OBJEXT"]
113+
sep = RbConfig::CONFIG['BUILD_FILE_SEPARATOR']
114+
sep = nil if sep and sep.empty?
113115
if gnumake
114116
submake = "$(MAKE) -C $(@D)"
115117
else
116-
submake = "cd $(@D) && "
117-
exec = RbConfig::CONFIG["exec"] and !exec.empty? and submake << exec << " "
118-
submake << "$(MAKE)"
118+
submake = ["cd", (sep ? "$(@D:/=#{sep})" : "$(@D)"), "&&"]
119+
exec = RbConfig::CONFIG["exec"] and !exec.empty? and submake << exec
120+
submake = (submake << "$(MAKE)").join(" ")
119121
mflags = " $(MFLAGS)"
120122
end
121123
-%>

0 commit comments

Comments
 (0)