简体   繁体   中英

How to get rebar to run 'make' for a dependency?

One of my dependencies doesn't use rebar -- it uses a Makefile. How do I get rebar to run this Makefile, rather than attempting to compile the source itself?

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. Then you could add either a pre or post compile hook to run make in that dependency directory. The rebar generate command should still be able to pick up any Erlang apps built there, assuming they have OTP file structure.

If you use rebar through make , you can add this kind of code to your 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 .

This snippet is from erl.mk https://github.com/fenollp/erl-mk/blob/master/erl.mk#L17-L21

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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