Skip to content

Mix runs Makefile on Win10 when Makefile.win is also present, except if also present in root. #4841

@drathier

Description

@drathier

I have a dependency that contains a Makefile and a Makefile.win. As per the docs, nmake /F Makefile.win should be called on Windows, and make should be called on other OS:es.

However, when I run mix test on Windows 10 (in intellij, cygwin, mingw and cmd), it executes make instead, which of course fails. Manually running nmake /F Makefile.win inside the dependeny's root folder works perfectly. The build runs without hiccups on Travis CI and Mac, where it can use make.

The source code for mix deps.compile has this relevant check:

command = if match?({:win32, _}, :os.type) and File.regular?("Makefile.win") do
  "nmake /F Makefile.win"
else
  "make"
end

The condition is true on windows in iex, in the dependency's root folder. It's not true from the project root, since there's no Makefile.win there. Adding a bogus Makefile.win in the project root makes the dependency compile as expected, so it seems like mix is being executed in the project root, while the code expects it to be executed in the dependency's root folder.

$ mix --version
Erlang/OTP 18 [erts-7.2.1] [64-bit] [smp:8:8] [async-threads:10]
Mix 1.3.0

$ elixirc --version
Erlang/OTP 18 [erts-7.2.1] [64-bit] [smp:8:8] [async-threads:10]
Elixir 1.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions