mad_erl.erl 525 B

12345678910111213141516
  1. -module(mad_erl).
  2. -compile(export_all).
  3. -define(COMPILE_OPTS(Inc, Ebin, Opts), [report, {i, Inc}, {outdir, Ebin}] ++ Opts).
  4. erl_to_beam(Bin, F) -> filename:join(Bin, filename:basename(F, ".erl") ++ ".beam").
  5. compile(File,Inc,Bin,Opt) ->
  6. BeamFile = erl_to_beam(Bin, File),
  7. Compiled = mad_compile:is_compiled(BeamFile, File),
  8. if Compiled =:= false ->
  9. io:format("Compiling ~s~n\r", [File]),
  10. Opts1 = ?COMPILE_OPTS(Inc, Bin, Opt),
  11. compile:file(File, Opts1),
  12. ok;
  13. true -> ok end.