From: Tom Tromey Date: Thu, 1 Oct 1998 01:31:05 +0000 (+0000) Subject: * depend2.am (%.o): Handle deleted header file problem. X-Git-Tag: Release-1-3d~57 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=d81bb6d82ddef6b15ab1b51a2dc51781b8f23173;p=automake.git * depend2.am (%.o): Handle deleted header file problem. (%.lo): Likewise. --- diff --git a/ChangeLog b/ChangeLog index 9c8c1ce1..5dfbc93a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ Thu Oct 1 00:51:51 1998 Tom Tromey + * depend2.am (%.o): Handle deleted header file problem. + (%.lo): Likewise. + * texinfos.am (install-info-am): Handle case where INFO_DEPS is empty. Reported by Andrew Cagney. (uninstall-info): Likewise. diff --git a/NEWS b/NEWS index 3dd3bb18..d9d1d2e1 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ New in 1.3b: * Support for latest autoconf, including support for objext * Can now put `.' in SUBDIRS to control build order * `include' command +* Dependency tracking no long susceptible to deleted header file problem * Bug fixes New in 1.3: diff --git a/depend2.am b/depend2.am index 09cb938d..7e4c6a3f 100644 --- a/depend2.am +++ b/depend2.am @@ -26,12 +26,30 @@ ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). - $(@PFX@COMPILE) -Wp,-MD,.deps/$(*F).P -c $< + $(@PFX@COMPILE) -Wp,-MD,.deps/$(*F).p -c $< +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + @-tr '\\ ' '\n\n' < .deps/$(*F).p \ +## The very first nondeleted line is always the primary source file. +## No need for that, so we remove it too via `1d'. + | sed -e '/^$$/ d' -e '/:$$/ d' -e 1d -e 's/$$/:/' > .deps/$(*F).P; \ + rm .deps/$(*F).p %.lo: %@EXT@ @echo '$(LT@PFX@COMPILE) -c $<'; \ ## See above to understand implementation weirdness. $(LT@PFX@COMPILE) -Wp,-MD,.deps/$(*F).p -c $< @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ - < .deps/$(*F).p > .deps/$(*F).P - @-rm -f .deps/$(*F).p + < .deps/$(*F).p > .deps/$(*F).P; \ +## See above to understand deleted header file trick. + tr '\\ ' '\n\n' < .deps/$(*F).p \ +## The very first nondeleted line is always the primary source file. +## No need for that, so we remove it too via `1d'. + | sed -e '/^$$/ d' -e '/:$$/ d' -e 1d -e 's/$$/:/' \ +## Note subtle difference: here we append to the .P file. + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).p diff --git a/lib/am/depend2.am b/lib/am/depend2.am index 09cb938d..7e4c6a3f 100644 --- a/lib/am/depend2.am +++ b/lib/am/depend2.am @@ -26,12 +26,30 @@ ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). - $(@PFX@COMPILE) -Wp,-MD,.deps/$(*F).P -c $< + $(@PFX@COMPILE) -Wp,-MD,.deps/$(*F).p -c $< +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + @-tr '\\ ' '\n\n' < .deps/$(*F).p \ +## The very first nondeleted line is always the primary source file. +## No need for that, so we remove it too via `1d'. + | sed -e '/^$$/ d' -e '/:$$/ d' -e 1d -e 's/$$/:/' > .deps/$(*F).P; \ + rm .deps/$(*F).p %.lo: %@EXT@ @echo '$(LT@PFX@COMPILE) -c $<'; \ ## See above to understand implementation weirdness. $(LT@PFX@COMPILE) -Wp,-MD,.deps/$(*F).p -c $< @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ - < .deps/$(*F).p > .deps/$(*F).P - @-rm -f .deps/$(*F).p + < .deps/$(*F).p > .deps/$(*F).P; \ +## See above to understand deleted header file trick. + tr '\\ ' '\n\n' < .deps/$(*F).p \ +## The very first nondeleted line is always the primary source file. +## No need for that, so we remove it too via `1d'. + | sed -e '/^$$/ d' -e '/:$$/ d' -e 1d -e 's/$$/:/' \ +## Note subtle difference: here we append to the .P file. + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).p