Clean up dependencies after failed compile
If gcc's preprocessor chokes, it leaves an empty dependency file behind, and doesn't touch the object file. If an old object file exists, and is newer than the .c file, make will then consider the object file up-to-date. This can lead to nasty version errors.
This commit is contained in:
parent
4a0732375d
commit
adbcdf4335
1 changed files with 6 additions and 1 deletions
7
Make.mk
7
Make.mk
|
@ -233,7 +233,12 @@ dist: dist-source dist-client dist-info
|
||||||
# addition to %.o.
|
# addition to %.o.
|
||||||
ifeq ($(how_to_dep),fast)
|
ifeq ($(how_to_dep),fast)
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(COMPILE.c) -MT $@ -MMD -MP $(OUTPUT_OPTION) $<
|
$(COMPILE.c) -MT $@ -MMD -MP $(OUTPUT_OPTION) $< \
|
||||||
|
|| { rm -f $(@:.o=.d) $@; false; }
|
||||||
|
# Why the rm? If gcc's preprocessor chokes, it leaves an empty
|
||||||
|
# dependency file behind, and doesn't touch the object file. If an
|
||||||
|
# old object file exists, and is newer than the .c file, make will
|
||||||
|
# then consider the object file up-to-date.
|
||||||
endif
|
endif
|
||||||
ifeq ($(how_to_dep),depcomp)
|
ifeq ($(how_to_dep),depcomp)
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue