我的一个依赖项不使用rebar
——它使用Makefile。如何让rebar
运行这个Makefile,而不是试图编译源代码本身?
请注意,我想继续对其他所有内容使用钢筋。
查看rebar.config示例文件,可以将依赖项标记为raw
,这意味着它不是由钢筋编译的。然后,您可以添加编译前或编译后挂钩,以便在依赖目录中运行make。假设它们具有OTP文件结构,那么rebar generate
命令应该仍然能够拾取在那里构建的任何Erlang应用程序。
如果使用rebar
到make
,则可以将此类代码添加到Makefile中:
@if [[ -f $@/Makefile ]];
then echo 'make -C $@ all' ;
make -C $@ all ;
else echo 'cd $@ && rebar get-deps compile && cd ../..' ;
cd $@ && rebar get-deps compile && cd ../.. ; fi
它检查$@
是否有Makefile,然后决定是使用make
还是rebar
。
此片段来自erl.mk
https://github.com/fenollp/erl-mk/blob/master/erl.mk#L17-L21