From c2f8d4e6a07a4a76dc904403db6e26d0f8d17534 Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Mon, 7 Jun 2010 17:55:13 -0700 Subject: [PATCH] added install target to makefile, stages into code:lib_dir() --- makefile | 3 +++ priv/jsx | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index d01d450..ca14dbf 100644 --- a/makefile +++ b/makefile @@ -10,4 +10,7 @@ examples: force clean: ./priv/jsx clean +install: clean compile + ./priv/jsx install + force: \ No newline at end of file diff --git a/priv/jsx b/priv/jsx index b1b2136..67c0291 100755 --- a/priv/jsx +++ b/priv/jsx @@ -6,6 +6,8 @@ main(Args) -> ; ["examples"|Opts] -> examples(Opts) ; ["test"|Opts] -> test(Opts) ; ["clean"|Opts] -> clean(Opts) + ; ["install"|Opts] -> install(Opts) + ; ["uninstall"|Opts] -> uninstall(Opts) end. compile([]) -> @@ -50,6 +52,17 @@ test(Path) -> clean([]) -> [ file:delete(Filename) || Filename <- filelib:wildcard("ebin/*.beam") ]. - +install([]) -> + os:cmd("mkdir -p " ++ appdir()), + os:cmd("cp -r " ++ "ebin " ++ appdir()). + +uninstall([]) -> + os:cmd("rm -rf " ++ appdir()). + +appdir() -> + {ok, [{application, jsx, AppInfo}]} = file:consult("ebin/jsx.app"), + code:lib_dir() ++ "/jsx-" ++ proplists:get_value(vsn, AppInfo). + + \ No newline at end of file