Rookie Rookie - 4 years ago 120
Bash Question

How to call Makefile located in other directory?

I am trying to do this:

I want to call a make (

exists in some other directory,
path can be used) from a shell script located in a different directory. How do I do this?

Since shell scripting does not allow me to
into the
directory and execute
, how can I write the shell command (by giving path to the
to be executed) to execute

Answer Source

GNU make accepts many options, notably -C to change directory before running, and -f for giving the Makefile to follow.

Combine them appropriately.

Consider using remake to ease debugging (notably with -x) of Makefile related issues. With GNU make version 4 or better, also use make --trace...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download