I am trying to do this:
I want to call a make (Makefile exists in some other directory, abc 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 cd into the Makefile directory and execute make, how can I write the shell command (by giving path to the Makefile to be executed) to execute make?
GNU
makeaccepts many options, notably-Cto change directory before running, and-ffor giving theMakefileto follow.Combine them appropriately.
Consider using remake to ease debugging (notably with
-x) ofMakefilerelated issues. With GNU make version 4 or better, also usemake --trace…You could have your own executable shell script (e.g. in your
$HOME/bin/which would be in your$PATH) which uses bothcdandmake).You could consider other build automation tools (ninja perhaps)
Read also P.Miller’s paper Recursive Make considered harmful