diff --git a/.gitignore b/.gitignore index c64c6ae392a..31d284a8d7b 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ Utilities/TestSmbios/Smbios Utilities/TestPeCoff/PeCoff *.o *.o.tmp +*.d *.exe *.gcda *.gcno diff --git a/User/Makefile b/User/Makefile index 93416a4a16a..6761c887736 100644 --- a/User/Makefile +++ b/User/Makefile @@ -238,7 +238,11 @@ OBJS := $(addprefix $(OUT_DIR)/,$(OBJS)) $(OUT_DIR)/%.o: %.c @$(MKDIR) $(OUT_DIR) - $(CC) $(CFLAGS) $< -o $@ + $(CC) -MMD -MT $@ -MF $(OUT_DIR)/$*.d $(CFLAGS) $< -o $@ + +DEP := $(OBJS:%.o=%.d) +DEP_TEST := $(OBJ:%.o=%.d) +-include $(DEP) $(DEP_TEST) all: $(PRODUCT)