How can I order make
command in the Makefile to execute recursively in all subdirectories make
commands (defined in the Makefile in the subdirectories)
The above answers work well when all of the subdirectories have Makefiles. It is not that difficult to only run make on the directories that contain Makefile, nor is it difficult to restrict the number of levels to recurse. In my sample code, I restrict the search for makefiles to the subdirectories immediately below the parent directory. The filter-out statement (line 2) prevents this Makefile from being included in the recursive makes.
MAKEFILES = $(shell find . -maxdepth 2 -type f -name Makefile)
SUBDIRS = $(filter-out ./,$(dir $(MAKEFILES)))
all:
for dir in $(SUBDIRS); do \
make -C $$dir all; \
done