@@ -3,7 +3,14 @@ ELIXIRC := bin/elixirc --ignore-module-conflict $(ELIXIRC_OPTS)
33ERLC := erlc -I lib/elixir/include
44ERL := erl -I lib/elixir/include -noshell -pa lib/elixir/ebin
55VERSION := $(strip $(shell cat VERSION) )
6- INSTALL_PATH := /usr/local
6+ Q := @
7+ PREFIX := /usr/local
8+ LIBDIR := lib
9+ INSTALL = install
10+ INSTALL_DIR = $(INSTALL ) -m755 -d
11+ INSTALL_DATA = $(INSTALL ) -m644
12+ INSTALL_PROGRAM = $(INSTALL ) -m755
13+
714
815.PHONY : install compile erlang elixir dialyze test clean docs release_docs release_zip release_erl
916.NOTPARALLEL : compile
@@ -14,15 +21,15 @@ define APP_TEMPLATE
1421$(1 ) : lib/$(1 ) /ebin/Elixir.$(2 ) .beam lib/$(1 ) /ebin/$(1 ) .app
1522
1623lib/$(1 ) /ebin/$(1 ) .app:
17- @ cd lib/$(1 ) && ../../bin/elixir -e "Mix.Server.start_link(:dev)" -r mix.exs -e "Mix.Task.run('compile.app')"
24+ $( Q ) cd lib/$(1 ) && ../../bin/elixir -e "Mix.Server.start_link(:dev)" -r mix.exs -e "Mix.Task.run('compile.app')"
1825
1926lib/$(1 ) /ebin/Elixir.$(2 ) .beam: $(wildcard lib/$(1 ) /lib/* .ex) $(wildcard lib/$(1 ) /lib/* /* .ex) $(wildcard lib/$(1 ) /lib/* /* /* .ex)
2027 @ echo "==> $(1 ) (compile)"
21- @ $$(ELIXIRC ) "lib/$(1 ) /lib/**/*.ex" -o lib/$(1 ) /ebin
28+ $( Q ) $$(ELIXIRC ) "lib/$(1 ) /lib/**/*.ex" -o lib/$(1 ) /ebin
2229
2330test_$(1 ) : $(1 )
2431 @ echo "==> $(1 ) (exunit)"
25- @ cd lib/$(1 ) && ../../bin/elixir -r "test/test_helper.exs" -pr "test/**/*_test.exs";
32+ $( Q ) cd lib/$(1 ) && ../../bin/elixir -r "test/test_helper.exs" -pr "test/**/*_test.exs";
2633endef
2734
2835# ==> Compilation tasks
@@ -35,11 +42,11 @@ default: compile
3542compile : lib/elixir/src/elixir.app.src erlang elixir
3643
3744lib/elixir/src/elixir.app.src : src/elixir.app.src
38- @ rm -rf lib/elixir/src/elixir.app.src
39- @ cp src/elixir.app.src lib/elixir/src/elixir.app.src
45+ $( Q ) rm -rf lib/elixir/src/elixir.app.src
46+ $( Q ) cp src/elixir.app.src lib/elixir/src/elixir.app.src
4047
4148erlang :
42- @ cd lib/elixir && $(REBAR ) compile
49+ $( Q ) cd lib/elixir && $(REBAR ) compile
4350
4451# Since Mix depends on EEx and EEx depends on
4552# Mix, we first compile EEx without the .app
@@ -48,21 +55,21 @@ elixir: kernel lib/eex/ebin/Elixir.EEx.beam mix ex_unit eex iex
4855
4956kernel : $(KERNEL ) VERSION
5057$(KERNEL ) : lib/elixir/lib/* .ex lib/elixir/lib/* /* .ex
51- @ if [ ! -f $( KERNEL) ]; then \
58+ $( Q ) if [ ! -f $( KERNEL) ]; then \
5259 echo " ==> bootstrap (compile)" ; \
5360 $(ERL ) -s elixir_compiler core -s erlang halt; \
5461 fi
5562 @ echo " ==> kernel (compile)" ;
56- @ $(ELIXIRC ) " lib/elixir/lib/**/*.ex" -o lib/elixir/ebin;
57- @ $(MAKE ) unicode
58- @ rm -rf lib/elixir/ebin/elixir.app
59- @ cd lib/elixir && $(REBAR ) compile
63+ $( Q ) $(ELIXIRC ) " lib/elixir/lib/**/*.ex" -o lib/elixir/ebin;
64+ $( Q ) $(MAKE ) unicode
65+ $( Q ) rm -rf lib/elixir/ebin/elixir.app
66+ $( Q ) cd lib/elixir && $(REBAR ) compile
6067
6168unicode : $(UNICODE )
6269$(UNICODE ) : lib/elixir/priv/unicode.ex lib/elixir/priv/UnicodeData.txt lib/elixir/priv/NamedSequences.txt
6370 @ echo " ==> unicode (compile)" ;
6471 @ echo " This step can take up to a minute to compile in order to embed the Unicode database"
65- @ $(ELIXIRC ) lib/elixir/priv/unicode.ex -o lib/elixir/ebin;
72+ $( Q ) $(ELIXIRC ) lib/elixir/priv/unicode.ex -o lib/elixir/ebin;
6673
6774$(eval $(call APP_TEMPLATE,ex_unit,ExUnit))
6875$(eval $(call APP_TEMPLATE,eex,EEx))
@@ -72,16 +79,18 @@ $(eval $(call APP_TEMPLATE,iex,IEx))
7279install : compile
7380 @ echo " ==> elixir (install)"
7481 for dir in lib/* ; do \
75- install -m755 -d $(INSTALL_PATH ) /lib/elixir/$$ dir/ebin; \
76- install -m644 $$ dir/ebin/* $(INSTALL_PATH ) /lib/elixir/$$ dir/ebin; \
82+ $(INSTALL_DIR ) " $( DESTDIR) $( PREFIX) /$( LIBDIR) /elixir/$$ dir/ebin" ; \
83+ $(INSTALL_DATA ) $$ dir/ebin/* " $( DESTDIR) $( PREFIX) /$( LIBDIR) /elixir/$$ dir/ebin" ; \
84+ done
85+ $(INSTALL_DIR ) " $( DESTDIR) $( PREFIX) /$( LIBDIR) /elixir/bin"
86+ $(INSTALL_PROGRAM ) $(filter-out % .bat, $(wildcard bin/* ) ) " $( DESTDIR) $( PREFIX) /$( LIBDIR) /elixir/bin"
87+ $(INSTALL_DIR ) " $( DESTDIR) $( PREFIX) /bin"
88+ for file in " $( DESTDIR) $( PREFIX) " /$( LIBDIR) /elixir/bin/* ; do \
89+ ln -sf " ../$( LIBDIR) /elixir/bin/$$ {file##*/}" " $( DESTDIR) $( PREFIX) /bin/" ; \
7790 done
78- install -m755 -d $(INSTALL_PATH ) /lib/elixir/bin
79- install -m755 $(filter-out % .bat, $(wildcard bin/* ) ) $(INSTALL_PATH ) /lib/elixir/bin
80- install -m755 -d $(INSTALL_PATH ) /bin
81- ln -sf $(INSTALL_PATH ) /lib/elixir/bin/* $(INSTALL_PATH ) /bin
8291
8392clean :
84- @ cd lib/elixir && $(REBAR ) clean
93+ $( Q ) cd lib/elixir && $(REBAR ) clean
8594 rm -rf ebin
8695 rm -rf lib/* /ebin
8796 rm -rf lib/* /test/tmp
@@ -93,7 +102,7 @@ clean:
93102 rm -rf lib/elixir/test/ebin
94103
95104clean_exbeam :
96- @ rm -f lib/* /ebin/Elixir.* .beam
105+ $( Q ) rm -f lib/* /ebin/Elixir.* .beam
97106
98107# ==> Release tasks
99108
@@ -120,38 +129,38 @@ release_docs: docs
120129 mv docs ../elixir-lang.github.com/docs/master
121130
122131release_erl : compile
123- @ rm -rf rel/elixir
124- @ cd rel && ../rebar generate
132+ $( Q ) rm -rf rel/elixir
133+ $( Q ) cd rel && ../rebar generate
125134
126135# ==> Tests tasks
127136
128137test : test_erlang test_elixir
129138
130139test_erlang : compile
131140 @ echo " ==> elixir (eunit)"
132- @ mkdir -p lib/elixir/test/ebin
133- @ $(ERLC ) -pa lib/elixir/ebin -o lib/elixir/test/ebin lib/elixir/test/erlang/* .erl
134- @ $(ERL ) -pa lib/elixir/test/ebin -s test_helper test -s erlang halt;
141+ $( Q ) mkdir -p lib/elixir/test/ebin
142+ $( Q ) $(ERLC ) -pa lib/elixir/ebin -o lib/elixir/test/ebin lib/elixir/test/erlang/* .erl
143+ $( Q ) $(ERL ) -pa lib/elixir/test/ebin -s test_helper test -s erlang halt;
135144 @ echo
136145
137146test_elixir : test_kernel test_ex_unit test_doc_test test_mix test_eex test_iex
138147
139148test_doc_test : compile
140149 @ echo " ==> doctest (exunit)"
141- @ cd lib/elixir && ../../bin/elixir -r " test/doc_test.exs" ;
150+ $( Q ) cd lib/elixir && ../../bin/elixir -r " test/doc_test.exs" ;
142151
143152test_kernel : compile
144153 @ echo " ==> kernel (exunit)"
145- @ cd lib/elixir && ../../bin/elixir -r " test/elixir/test_helper.exs" -pr " test/elixir/**/*_test.exs" ;
154+ $( Q ) cd lib/elixir && ../../bin/elixir -r " test/elixir/test_helper.exs" -pr " test/elixir/**/*_test.exs" ;
146155
147156.dialyzer.base_plt :
148157 @ echo " ==> Adding Erlang/OTP basic applications to a new base PLT"
149- @ dialyzer --output_plt .dialyzer.base_plt --build_plt --apps erts kernel stdlib compiler syntax_tools inets crypto ssl
158+ $( Q ) dialyzer --output_plt .dialyzer.base_plt --build_plt --apps erts kernel stdlib compiler syntax_tools inets crypto ssl
150159
151160dialyze : .dialyzer.base_plt
152- @ rm -f .dialyzer_plt
153- @ cp .dialyzer.base_plt .dialyzer_plt
161+ $( Q ) rm -f .dialyzer_plt
162+ $( Q ) cp .dialyzer.base_plt .dialyzer_plt
154163 @ echo " ==> Adding Elixir to PLT..."
155- @ dialyzer --plt .dialyzer_plt --add_to_plt -r lib/elixir/ebin lib/ex_unit/ebin lib/mix/ebin lib/iex/ebin lib/eex/ebin
164+ $( Q ) dialyzer --plt .dialyzer_plt --add_to_plt -r lib/elixir/ebin lib/ex_unit/ebin lib/mix/ebin lib/iex/ebin lib/eex/ebin
156165 @ echo " ==> Dialyzing Elixir..."
157- @ dialyzer --plt .dialyzer_plt -r lib/elixir/ebin lib/ex_unit/ebin lib/mix/ebin lib/iex/ebin lib/eex/ebin
166+ $( Q ) dialyzer --plt .dialyzer_plt -r lib/elixir/ebin lib/ex_unit/ebin lib/mix/ebin lib/iex/ebin lib/eex/ebin
0 commit comments