Project

General

Profile

Actions

Feature #22408

open

Use GNU make instead of nmake for mswin builds

Feature #22408: Use GNU make instead of nmake for mswin builds
1

Added by hsbt (Hiroshi SHIBATA) about 13 hours ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:126936]

Description

The mswin build uses nmake, whose dialect is restrictive. It cannot run jobs in parallel, has no VPATH, and its substitution $(VAR:a=b) cannot contain macros. nmake 14.30 (VS 2022) added functions such as $(subst) that can, but we cannot use them while the VS 2017 and 2019 toolsets, which come with older nmake, are supported. Keeping common.mk and win32/Makefile.sub working with it depends on nobu alone, and nobu has said he would like to drop nmake if he could.

I have no preference between nmake and GNU make, because I can keep either one working with a coding agent. But -j with GNU make would speed up the build, which is very attractive. https://github.com/ruby/ruby/pull/19214 adds win32/GNUmakefile.sub, and make exam passes with it. These are the times to build Ruby after configure.bat, from one run each.

nmake GNU make
My machine, 16 jobs 565 s 131 s
GitHub Actions windows-2025-vs2026, 4 jobs 616 s 343 s

make check took about the same time as nmake check on GitHub Actions (602 s and 550 s), because the tests already run in parallel. Switching does not reduce the Windows specific makefiles, since GNUmakefile.sub only takes the place of Makefile.sub.

GNU make has no official Windows binary. win32/install-gnumake.cmd downloads the GNU release, checks its SHA256, and builds make.exe with cl.exe in about 15 seconds. configure.bat itself still runs nmake.

win32\install-gnumake.cmd
set PATH=%CD%\.gnumake;%PATH%
win32\configure.bat
ruby win32\mkgnumakefile.rb
make -j16

A Ruby built this way records --with-make-prog=make in RbConfig::CONFIG["configure_args"], so gem install runs make for C extensions. The release package will ship the same script, and make install will put the make.exe next to ruby.exe so that gem install finds it.

I am unsure whether to keep nmake alongside GNU make or to replace it right away. I would like to hear opinions. My proposal is to support both in Ruby 4.1 and, if nothing goes wrong, to make GNU make the only option in Ruby 4.2.

No data to display

Actions

Also available in: PDF Atom