diff --git a/firmware-template-gd32/lib/Rules.mk b/firmware-template-gd32/lib/Rules.mk index 90d2497..188f0dd 100644 --- a/firmware-template-gd32/lib/Rules.mk +++ b/firmware-template-gd32/lib/Rules.mk @@ -72,11 +72,13 @@ LIST=lib.list define compile-objects $(info $1) $(BUILD)$1/%.o: $1/%.c - $(CC) $(COPS) -c $$< -o $$@ - + $(CC) -MD -MP $(COPS) -c $$< -o $$@ + $(BUILD)$1/%.o: $1/%.cpp - $(CPP) $(COPS) $(CPPOPS) -c $$< -o $$@ - + $(CPP) -MD -MP $(COPS) $(CPPOPS) -c $$< -o $$@ + +-include $(BUILD)$1/*.d + $(BUILD)$1/%.o: $1/%.S $(CC) $(COPS) -D__ASSEMBLY__ -c $$< -o $$@ endef