From b6ca3223bbfac5a205689a72aaef76401f8b7453 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 24 Feb 1998 06:25:15 +0000 Subject: [PATCH] more dependency fixes --- depend2.am | 29 ++++++++++++++--------------- lib/am/depend2.am | 29 ++++++++++++++--------------- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/depend2.am b/depend2.am index 4048f26f..09cb938d 100644 --- a/depend2.am +++ b/depend2.am @@ -17,22 +17,21 @@ ## 02111-1307, USA. %.o: %@EXT@ @echo '$(@PFX@COMPILE) -c $<'; \ - DEPENDENCIES_OUTPUT='.deps/$(*F).P'; \ - export DEPENDENCIES_OUTPUT; \ -## Note that using DEPENDENCIES_OUTPUT causes gcc to append to the -## named file. So we truncate it explicitly. - : > .deps/$(*F).P; \ - $(@PFX@COMPILE) -c $< +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -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 $< %.lo: %@EXT@ @echo '$(LT@PFX@COMPILE) -c $<'; \ - DEPENDENCIES_OUTPUT='.deps/$(*F).p'; \ - export DEPENDENCIES_OUTPUT; \ -## Note that using DEPENDENCIES_OUTPUT causes gcc to append to the -## named file. So we truncate it explicitly. - : > .deps/$(*F).p; \ - $(LT@PFX@COMPILE) -c $< - @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' < .deps/$(*F).p | \ - $(AWK) '/:/ { ignore = ++ignoring[$$1]; } ignore == 1 { print }' \ - > .deps/$(*F).P +## 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 diff --git a/lib/am/depend2.am b/lib/am/depend2.am index 4048f26f..09cb938d 100644 --- a/lib/am/depend2.am +++ b/lib/am/depend2.am @@ -17,22 +17,21 @@ ## 02111-1307, USA. %.o: %@EXT@ @echo '$(@PFX@COMPILE) -c $<'; \ - DEPENDENCIES_OUTPUT='.deps/$(*F).P'; \ - export DEPENDENCIES_OUTPUT; \ -## Note that using DEPENDENCIES_OUTPUT causes gcc to append to the -## named file. So we truncate it explicitly. - : > .deps/$(*F).P; \ - $(@PFX@COMPILE) -c $< +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -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 $< %.lo: %@EXT@ @echo '$(LT@PFX@COMPILE) -c $<'; \ - DEPENDENCIES_OUTPUT='.deps/$(*F).p'; \ - export DEPENDENCIES_OUTPUT; \ -## Note that using DEPENDENCIES_OUTPUT causes gcc to append to the -## named file. So we truncate it explicitly. - : > .deps/$(*F).p; \ - $(LT@PFX@COMPILE) -c $< - @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' < .deps/$(*F).p | \ - $(AWK) '/:/ { ignore = ++ignoring[$$1]; } ignore == 1 { print }' \ - > .deps/$(*F).P +## 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 -- 2.43.5