I am trying to make some sub directories in a makefile. I know how to do it using a rule for each sub-directory. I am looking for the syntax that will do it using one rule for all subdirectories (either using a loop or using SUBDIRs list).
For example:
$(dst_dir)/%.o : $(M2M_GENERIC_DIR)/rm/src/%.c
$(TRACE_CC)
$(Q)$(GCC) -c $(CFLAGS) $< -o $@
$(Q)$(GCC) -c $(CFLAGS) -MM -MT $@ -MF $(subst .o,.d,$@) $< -o $(subst .o,.d,$@)
$(dst_dir)/%.o : $(M2M_GENERIC_DIR)/utility/src/%.c
$(TRACE_CC)
$(Q)$(GCC) -c $(CFLAGS) $< -o $@
$(Q)$(GCC) -c $(CFLAGS) -MM -MT $@ -MF $(subst .o,.d,$@) $< -o $(subst .o,.d,$@)
$(dst_dir)/%.o : $(M2M_GENERIC_DIR)/fota/src/%.c
$(TRACE_CC)
$(Q)$(GCC) -c $(CFLAGS) $< -o $@
$(Q)$(GCC) -c $(CFLAGS) -MM -MT $@ -MF $(subst .o,.d,$@) $< -o $(subst .o,.d,$@)
$(dst_dir)/%.o : $(M2M_GENERIC_DIR)/fota/src/lzo/%.c
$(TRACE_CC)
$(Q)$(GCC) -c $(CFLAGS) $< -o $@
$(Q)$(GCC) -c $(CFLAGS) -MM -MT $@ -MF $(subst .o,.d,$@) $< -o $(subst .o,.d,$@)