The traditional way is to have a Makefile
in each of the subdirectories (part1
, part2
, etc.) allowing you to build them independently. Further, have a Makefile
in the root directory of the project which builds everything. The "root" Makefile
would look something like the following:
all:
+$(MAKE) -C part1
+$(MAKE) -C part2
+$(MAKE) -C part3
Since each line in a make target is run in its own shell, there is no need to worry about traversing back up the directory tree or to other directories.
I suggest taking a look at the GNU make manual section 5.7; it is very helpful.