简体   繁体   English

如何让rebar为依赖运行'make'?

[英]How to get rebar to run 'make' for a dependency?

One of my dependencies doesn't use rebar -- it uses a Makefile. 我的一个依赖项不使用rebar - 它使用Makefile。 How do I get rebar to run this Makefile, rather than attempting to compile the source itself? 如何让rebar运行此Makefile,而不是尝试编译源本身?

Note that I'd like to continue using rebar for everything else. 请注意,我想继续使用钢筋来完成其他任务。

Looking at the rebar.config example file , you could mark the dependency as raw , meaning it's not compiled by rebar. 查看rebar.config示例文件 ,您可以将依赖项标记为raw ,这意味着它不是由rebar编译的。 Then you could add either a pre or post compile hook to run make in that dependency directory. 然后你可以添加一个pre或post编译钩子来在该依赖项目录中运行make。 The rebar generate command should still be able to pick up any Erlang apps built there, assuming they have OTP file structure. 假设它们具有OTP文件结构,rebar generate命令应该仍然能够获取在那里构建的任何Erlang应用程序。

If you use rebar through make , you can add this kind of code to your Makefile: 如果你通过make使用rebar ,你可以将这种代码添加到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

It checks if $@ has a Makefile then decides whether to use make or rebar . 它检查$@是否有Makefile然后决定是否使用makerebar

This snippet is from erl.mk https://github.com/fenollp/erl-mk/blob/master/erl.mk#L17-L21 这个片段来自erl.mk https://github.com/fenollp/erl-mk/blob/master/erl.mk#L17-L21

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM