How can I order make
command in the Makefile to execute recursively in all subdirectories make
commands (defined in the Makefile in the subdirectories)?
Recursive use of make means using make as a command in a makefile. This technique is useful when you want separate makefiles for various subsystems that compose a larger system.
# Register all subdirectories in the project's root directory. SUBDIRS := $(wildcard */.) # Recurse `make` into each subdirectory. $(SUBDIRS): FORCE $(MAKE) -C $@ # A target without prerequisites and a recipe, and there is no file named `FORCE`.
Linux recursive directory listing using ls -R command. The -R option passed to the ls command to list subdirectories recursively.
$@ is the name of the target being generated, and $< the first prerequisite (usually a source file). You can find a list of all these special variables in the GNU Make manual.
P.S. A code snippet from my answer to a different yet related question could be used as a rough approximation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With