Permalink
Browse files

Add `make install` task

To change the install path, simply override the `INSTALL_PATH`:

    $ make INSTALL_PATH=/opt/local install
  • Loading branch information...
1 parent 8cede65 commit 131db13763cf6a464163e5f418e89b5052ce8053 @devinus committed Nov 19, 2012
Showing with 18 additions and 6 deletions.
  1. +18 −6 Makefile
View
@@ -1,9 +1,10 @@
-REBAR:=$(shell echo `pwd`/rebar)
-ELIXIRC:=bin/elixirc --debug-info --ignore-module-conflict $(ELIXIRC_OPTS)
-ERLC:=erlc -I lib/elixir/include
-ERL:=erl -I lib/elixir/include -noshell -env ERL_LIBS $ERL_LIBS:lib
-VERSION:=0.7.1
-RELEASE_FLAG:=.release
+REBAR := $(shell echo `pwd`/rebar)
+ELIXIRC := bin/elixirc --debug-info --ignore-module-conflict $(ELIXIRC_OPTS)
+ERLC := erlc -I lib/elixir/include
+ERL := erl -I lib/elixir/include -noshell -env ERL_LIBS $ERL_LIBS:lib
+VERSION := 0.7.1.dev
+RELEASE_FLAG := .release
+INSTALL_PATH := /usr/local
.PHONY: 1
.NOTPARALLEL: compile
@@ -68,6 +69,17 @@ $(eval $(call APP_TEMPLATE,eex,EEx))
$(eval $(call APP_TEMPLATE,mix,Mix))
$(eval $(call APP_TEMPLATE,iex,IEx))
+install: compile
+ @ echo "==> elixir (install)"
+ for dir in lib/*; do \
+ install -m755 -d $(INSTALL_PATH)/lib/elixir/$$dir/ebin; \
+ install -m644 $$dir/ebin/* $(INSTALL_PATH)/lib/elixir/$$dir/ebin; \
+ done
+ install -m755 -d $(INSTALL_PATH)/lib/elixir/bin
+ install -m755 $(filter-out %.bat, $(wildcard bin/*)) $(INSTALL_PATH)/lib/elixir/bin
+ install -m755 -d $(INSTALL_PATH)/bin
+ ln -sf $(INSTALL_PATH)/lib/elixir/bin/* $(INSTALL_PATH)/bin
+
clean:
@ cd lib/elixir && $(REBAR) clean
rm -rf $(RELEASE_FLAG)

0 comments on commit 131db13

Please sign in to comment.