Make tool in Erlang

Sean Hinde <>
Fri May 11 11:54:13 CEST 2001


> 
> On Thu, May 10, 2001 at 08:34:15PM +0200, Salvador Alcaraz wrote:
> > Hello, everybody:
> > 
> > Is there any tool like Make (and makefile) for Erlang?
> 
> use the command  make:all(). in the shell, for example :-)

Or erl -make at the UNIX shell. If you use the OTP directory structure
app-n.n/src, app-n.n/ebin etc you can have an Emakefile in your ebin
directory containing entries like:

'../src/module'.
'../src/module_app'.


then doing erl -make in the ebin directory will build the beam files there
rather than in src. This is quicker that normal makefiles using erlc because
the emulator is only started once.

You might find it useful to also have some functions (examples below)
defined in your user_default.erl.. so for me in an interactive session:

ma(app_name). will remake the erl files in that app based on the Emakefile,
regardless of the current erlang working directory
ma(). makes in the current erlang working dir
cde(app_name). changes erlang CWD to the ebin directory of app..

Happy interactive hacking,
- Sean

---------------------

-module(user_default).
-author('').

-export([cds/1, cde/1, cdp/1, ma/0, ma/1, mevas/0]).

cds(Lib) ->
    cd(Lib, "src").

cde(Lib) ->
    cd(Lib, "ebin").

cdp(Lib) ->
    cd(Lib, "priv").

cd(Lib, Dir) ->
    Lib_path = code:lib_dir(Lib),
    Path = filename:join([Lib_path, Dir]),
    c:cd(Path).

ma(Lib) ->
    {ok, Pwd} = file:get_cwd(),
    cde(Lib),
    ma(),
    file:set_cwd(Pwd).

ma() ->
    make:all([load]).

%% this sort of thing I also find quite useful to rebuild all files in an
interactive session
mevas() ->
    ma(alarms),
    ma(bos),
    ma(events),
    ma(stats),
    ma(metrica),
    ma(http_mgr),
    ma(evas),
    ma(evas_gps),
    ma(tcp_ivr),
    ma(radius),
    ma(db_backup),
    ma(wap).



NOTICE AND DISCLAIMER:
This email (including attachments) is confidential.  If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents.  We cannot accept liability for any breaches of
confidence arising through use of email.  Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions.  We will not accept responsibility for any commitments
made by our employees outside the scope of our business.  We do not warrant
the accuracy or completeness of such information.





More information about the erlang-questions mailing list