Namdak Tonpa 7 лет назад
Родитель
Сommit
234548875d
6 измененных файлов с 18 добавлено и 5 удалено
  1. 1 1
      include/mad.hrl
  2. BIN
      mad
  3. 6 3
      src/compile/mad_compile.erl
  4. 9 0
      src/compile/mad_cubical.erl
  5. 1 1
      src/compile/mad_yecc.erl
  6. 1 0
      src/mad_utils.erl

+ 1 - 1
include/mad.hrl

@@ -1 +1 @@
--define(VERSION,"1b48b6").
+-define(VERSION,"ca88d4").


+ 6 - 3
src/compile/mad_compile.erl

@@ -38,8 +38,10 @@ dep(Cwd, _Conf, ConfigFile, Name) ->
     DepsRes = bool(deps(Cwd, Conf, ConfigFile, Deps)),
 
     SrcDir = filename:join([mad_utils:src(DepPath)]),
-    AllFiles = files(SrcDir,".yrl") ++ 
-               files(SrcDir,".xrl") ++ 
+    PrivDir = filename:join([mad_utils:priv(DepPath)]),
+    PrivFiles = files(PrivDir,".ctt"),
+    AllFiles = files(SrcDir,".yrl") ++
+               files(SrcDir,".xrl") ++
                files(SrcDir,".erl") ++ % comment this to build with erlc/1
                files(SrcDir,".app.src"),
     Files = case mad_utils:get_value(erl_first_files, Conf1, []) of
@@ -65,7 +67,7 @@ dep(Cwd, _Conf, ConfigFile, Name) ->
             code:replace_path(Name,EbinDir),
 
             Opts = mad_utils:get_value(erl_opts, Conf1, []),
-            FilesStatus = compile_files(Files,IncDir, EbinDir, Opts,Includes),
+            FilesStatus = compile_files(Files++PrivFiles,IncDir, EbinDir, Opts,Includes),
             DTLStatus = mad_dtl:compile(DepPath,Conf1),
             PortStatus = lists:any(fun(X)->X end,mad_port:compile(DepPath,Conf1)),
             % io:format("Status: ~p~n",[[Name,FilesStatus,DTLStatus,PortStatus,DepsRes]]),
@@ -82,6 +84,7 @@ compile_files([File|Files],Inc,Bin,Opt,Deps) ->
          X -> mad:info("Compilation Error: ~p~n",[{X,File}]), true end.
 
 module("erl")      -> mad_erl;
+module("ctt")      -> mad_cubical;
 module("erl.src")  -> mad_utils;
 module("yrl")      -> mad_yecc;
 module("xrl")      -> mad_leex;

+ 9 - 0
src/compile/mad_cubical.erl

@@ -0,0 +1,9 @@
+-module(mad_cubical).
+-copyright('Maxim Sokhatsky').
+-compile(export_all).
+
+compile(File,Inc,Bin,Opt,Deps) ->
+    {_,_,Msg} = sh:run("cubical -b " ++ File),
+    case binary:match(Msg,[<<"successfully!">>]) of
+                   nomatch -> io:format("Error: ~p~n",[Msg]), true;
+                   _ -> io:format("OK: ~p.~n",[filename:basename(File)]), false end.

+ 1 - 1
src/compile/mad_yecc.erl

@@ -8,6 +8,6 @@ compile(File,Inc,Bin,Opt,Deps) ->
     ErlFile = yrl_to_erl(File),
     Compiled = mad_compile:is_compiled(ErlFile,File),
     if Compiled == false ->
-        yecc:file(File),
+        yecc:file(File,[{verbose,true}]),
         mad_erl:compile(ErlFile,Inc,Bin,Opt,Deps); true -> false end.
 

+ 1 - 0
src/mad_utils.erl

@@ -25,6 +25,7 @@ consult(File) ->
 src(Dir) -> filename:join(Dir, "src").
 include(Dir) -> filename:join(Dir, "include").
 ebin(Dir) -> filename:join(Dir, "ebin").
+priv(Dir) -> filename:join(Dir, "priv").
 deps(File) -> get_value(deps, consult(File), []).
 
 get_value(Key, Opts, undefined) -> get_value(Key, Opts, []);