Emake, makiefile or...? Thank you!
Here is the Makefile and Emakefile I usually use with make (origin unknown).
Makefile:
ERL=erl
APPFILE=myApp.app
all: ebin/$(APPFILE)
$(ERL) -make
ebin/$(APPFILE): src/$(APPFILE)
cp $< $@
Emakefile:
{"src/*", [debug_info, {outdir, "ebin"}, {i, "include"}]}.
I use a Rakefile calling an Emakefile. Rakefile for flexibility and Emakefile for speed !
This build system is quite powerful, see erl_rake
on GitHub
Generates .app files, builds releases automatically, runs EUnit test. And given it's build around a Rakefile, I've added easily pushing release to AWS and run my tests with etap instead.
I customized an old version on for my github projects.
We use a similar Emakefile as well.
{"src/*", [debug_info, {outdir, "ebin"}, {i, "include"}]}.
I use the erlang make functionality to run tests after succesful compilation.
Makefile extract:
all: compile
compile:
erlc -o ebin +debug_info erl_make.erl
erl -pa ./ebin -eval "erl_make:make(development)" -s init stop -noshell
erl_make.erl
-module(erl_make).
-export([make/1]).
make(Mode) ->
case make:all([{d, Mode}]) of
error ->
error;
_ ->
test_suite:test()
end.
I propose my own tool :) Eake ... is very similar to rake from Ruby environment:
http://github.com/andrzejsliwa/eake
or
http://andrzejsliwa.com/2009/05/28/eake-narzedzie-budowania-dla-erlanga-bazujace-na-rake/
Here is example eakefile
-module(eakefile). -compile([export_all]). -import(eake, [task/3, namespace/3, run_target/2, run/1]). execute() -> [ namespace(db, "test", [ task(migrate, "That is migration", fun(Params) -> io:format("in migration params: ~w", [Params]), run_target('db:rollback', []) end), task(rollback, "That is rollback", fun(_) -> io:format("in rollback"), run("ls") end) ]) ].
and this is example using:
$ eake db:migrate $ eake db:migrate db:rollback $ eake db:migrate=[1,atom] $ eake db:migrate=name
Use Sinan for building and Faxien for installing! Check out erlware.org. They are way better than a make file and provide ease of distribution. They are both in heavy active development and will be featured in: http://www.manning.com/logan/