How to call a Makefile located in another directory?

I am trying to do this:

I want to call make (a Makefile exists in some other directory, the path abc can be used) from a shell script located in another directory. How can I do it?

Since the shell script does not allow me to cd into the Makefile directory and execute make , how can I write a shell command (by specifying the path to the Makefile that must be executed) to execute make ?

+8
linux shell makefile
source share
1 answer

GNU make accepts many options , especially -C to change the directory before running, and -f to provide a Makefile .

Assemble them accordingly.

Consider using remake to facilitate debugging (especially with -x ) issues related to the Makefile . With GNU make version 4 or higher, also use make --trace ...

+12
source share

All Articles