Call make before cargo build


Hi all,

I have a makefile

to run in order to build a library before to call cargo. Is there any way to do this ?

I tried but no success. Is the right way?

Thanks a lot.


What did you try in


To run make but I don’t know from where the commands started form are run.


Yes, right way. You can try use crate to simpify things. If you see errors, post them here.


Another solution may be to do it in the opposite order: call cargo build from the makefile.


Actually, I solved it using an env variable which is passed to the makefile, and allow conditional compilation:

    // compile luacall library: OS dependant
    if cfg!(target_os = "linux") {
        // makefile is using a special env variable
                .env("LUA_DIR", lua_dir)
                .args(&["-f", "src/lua/luacall_linux.mak"])
                .expect("failed to make!");

and it works pretty well (at least for Linux !)