Browse Source

Fix enoent error in run_setup rule of the makefile
Prior to this change, if user's computer has no `~/.config/rebar3`
path, `make run` would fail and report enoent error.

This change fix the problem I described above.

GilbertWong 6 years atrás
parent
commit
13d33985be
1 changed files with 7 additions and 3 deletions
  1. 7 3
      Makefile

+ 7 - 3
Makefile

@@ -12,7 +12,7 @@ CT_NODE_NAME = emqxct@127.0.0.1
 RUN_NODE_NAME = emqxdebug@127.0.0.1
 
 .PHONY: run
-run: run_setup
+run: run_setup unlock
 	@rebar3 as test get-deps
 	@rebar3 as test auto --name $(RUN_NODE_NAME) --script test/run_emqx.escript
 
@@ -31,7 +31,8 @@ run_setup:
                                    lists:keyreplace(plugins, 1, Term, {plugins, NewPlugins}) \
 	                       end, \
 	             ok = file:write_file(FilePath, [io_lib:format(\"~p.\n\", [I]) || I <- NewTerm]); \
-            _ -> \
+            _Enoent -> \
+		        os:cmd(\"mkdir -p ~/.config/rebar3/ \"), \
 	            NewTerm=[{plugins, [rebar3_auto]}], \
 	            ok = file:write_file(FilePath, [io_lib:format(\"~p.\n\", [I]) || I <- NewTerm]) \
 	     end, \
@@ -41,9 +42,12 @@ run_setup:
 shell:
 	@rebar3 as test auto
 
-compile:
+compile: unlock
 	@rebar3 compile
 
+unlock:
+	@rebar3 unlock
+
 clean: distclean
 
 ## Cuttlefish escript is built by default when cuttlefish app (as dependency) was built