Skip to content

Instantly share code, notes, and snippets.

@dysinger
Created November 2, 2009 15:56
Show Gist options
  • Select an option

  • Save dysinger/224242 to your computer and use it in GitHub Desktop.

Select an option

Save dysinger/224242 to your computer and use it in GitHub Desktop.
Simple Erlang Build File
#!/usr/bin/env escript
%% -*- erlang -*-
main([]) -> build(compile);
main(Tasks) -> [build(list_to_atom(Task)) || Task <- Tasks].
build(clean) ->
[ok = file:delete(X) || X <- filelib:wildcard(filename:join("ebin","*"))],
ok = file:del_dir("ebin");
build(compile) ->
file:make_dir("ebin"),
[{ok,_} = file:copy(X,filename:join("ebin",filename:basename(X))) ||
X <- filelib:wildcard(filename:join("src","*.app"))],
[case lfe_comp:file(X,[report,{outdir,"ebin"}]) of
error -> halt(1);
{ok,_} -> ok
end || X <- filelib:wildcard(filename:join("src","*.lfe"))];
build(X) -> io:format("Unknown build target -> ~s~n",[X]).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment