@@ -191,19 +191,29 @@ defmodule Mix.Tasks.Deps.Compile do
191
191
Mix . raise "\" #{ manager } \" installation failed"
192
192
end
193
193
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 )
196
201
197
202
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? ->
200
205
"nmake /F Makefile.win"
201
- match? ( { :unix , type } when type in [ :freebsd , :openbsd ] , os_type ) ->
206
+ { :unix , type } when type in [ :freebsd , :openbsd ] ->
202
207
"gmake"
203
- true ->
208
+ _ ->
204
209
"make"
205
210
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
207
217
end
208
218
209
219
defp do_compile ( % Mix.Dep { opts: opts } = dep , config ) do
@@ -248,4 +258,12 @@ defmodule Mix.Tasks.Deps.Compile do
248
258
req
249
259
end
250
260
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
251
269
end
0 commit comments