Is it possible to perform a make clean from the parent directory which also recursively cleans all sub-directories without having to include a makefile in each sub-directory?
For example, currently in my Makefile, I have something like:
SUBDIRS = src, src1
.PHONY: clean subdirs $(SUBDIRS)
clean: $(SUBDIRS)
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c
$(SUBDIRS):
$(MAKE) -C $(SUBDIRS) clean
However, this requires me to have a Makefile in both src and src1. Otherwise, I would get the error
No rule to make target clean
Since I only want to run the command "rm -rf *.o ~ core .depend ..cmd *.ko *.mod.c" in each subdirectory anyways, it seems redundant to have to include a Makefile in every subdirectory with the exact same line for clean. Is there no way to simply have the same clean command run in each of the subdirectories?