@@ -191,19 +191,29 @@ defmodule Mix.Tasks.Deps.Compile do
191191 Mix . raise "\" #{ manager } \" installation failed"
192192 end
193193
194- defp do_make ( % { opts: opts } = dep , config ) do
195- os_type = :os . type
194+ defp do_make ( dep , config ) do
195+ command = make_command ( dep )
196+ do_command ( dep , config , command , true , [ { "IS_DEP" , "1" } ] )
197+ end
198+
199+ defp make_command ( dep ) do
200+ makefile_win? = makefile_win? ( dep )
196201
197202 command =
198- cond do
199- match? ( { :win32 , _ } , os_type ) and File . regular? ( Path . join ( opts [ :dest ] , "Makefile.win" ) ) ->
203+ case :os . type do
204+ { :win32 , _ } when makefile_win? ->
200205 "nmake /F Makefile.win"
201- match? ( { :unix , type } when type in [ :freebsd , :openbsd ] , os_type ) ->
206+ { :unix , type } when type in [ :freebsd , :openbsd ] ->
202207 "gmake"
203- true ->
208+ _ ->
204209 "make"
205210 end
206- do_command ( dep , config , command , true , [ { "IS_DEP" , "1" } ] )
211+
212+ if erlang_mk? ( dep ) do
213+ "#{ command } clean && #{ command } "
214+ else
215+ command
216+ end
207217 end
208218
209219 defp do_compile ( % Mix.Dep { opts: opts } = dep , config ) do
@@ -248,4 +258,12 @@ defmodule Mix.Tasks.Deps.Compile do
248258 req
249259 end
250260 end
261+
262+ defp erlang_mk? ( % Mix.Dep { opts: opts } ) do
263+ File . regular? ( Path . join ( opts [ :dest ] , "erlang.mk" ) )
264+ end
265+
266+ defp makefile_win? ( % Mix.Dep { opts: opts } ) do
267+ File . regular? ( Path . join ( opts [ :dest ] , "Makefile.win" ) )
268+ end
251269end
0 commit comments