FINALNAME=$(NAME)_$(CONFIG) OBJECTS := $(patsubst %.c,obj/$(CONFIG)/%.o,$(filter %.c,$(SRCS))) OBJECTS += $(patsubst %.cpp,obj/$(CONFIG)/%.o,$(filter %.cpp,$(SRCS))) OBJECTS += $(patsubst %.s,obj/$(CONFIG)/%.o,$(filter %.s,$(SRCS))) $(BINDIR)/$(FINALNAME).elf: $(OBJDIR)/ $(BINDIR)/ $(OBJECTS) $(LD) $(LDFLAGS) $(LIBS) $(OBJECTS) -o $@ clean-products: -rm $(BINDIR)/$(FINALNAME).elf -rm -rf obj