Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recursive make in subdirectories

Tags:

How can I order make command in the Makefile to execute recursively in all subdirectories make commands (defined in the Makefile in the subdirectories)?

like image 765
Alberto Avatar asked Feb 12 '12 14:02

Alberto


People also ask

What is recursive make?

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.

How do I invoke a makefiles in subdirectories?

# 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`.

How can I list subdirectories recursively?

Linux recursive directory listing using ls -R command. The -R option passed to the ls command to list subdirectories recursively.

What is $@ in makefile?

$@ 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.


1 Answers

  1. Read Recursive Use of Make chapter of GNU Make manual.
  2. Learn Peter Miller's Recursive Make Considered Harmful article.
  3. ...
  4. PROFIT!!!

P.S. A code snippet from my answer to a different yet related question could be used as a rough approximation.

like image 74
Eldar Abusalimov Avatar answered Sep 16 '22 16:09

Eldar Abusalimov