How to correctly write Makefile for code with submodules?

Since the submodules depend on the module, you should have a rule to describe that relationship. The module should be compiled first and then the submodules. Anything using the module should simply depend on that, not on the submodules, as one of the design criteria was that the submodules contain the implementation and the module the interface, so that they can be compiled independently.

2 Likes