From 3ad09d87325a64e5619268f4afa20a7adb9eeabf Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Thu, 18 Oct 2012 16:29:21 +0200 Subject: [PATCH] depcomp: make some code more self-documenting * lib/depcomp (make_dummy_makefile): With the help of this function. Use it throughout. Signed-off-by: Stefano Lattarini --- lib/depcomp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/depcomp b/lib/depcomp index adda121..0f37d09 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -74,6 +74,14 @@ set_base_from () base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } +# If no dependency file was actually created by the compiler invocation, +# we still have to create a dummy depfile, to avoid errors with the +# Makefile "include basename.Plo" scheme. +make_dummy_depfile () +{ + echo "#dummy" > "$depfile" +} + # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () @@ -92,9 +100,7 @@ aix_post_process_depfile () } > "$depfile" rm -f "$tmpdepfile" else - # No dependency file was actually created by the compiler invocation. - # No real dependency information will be available. - echo "#dummy" > "$depfile" + make_dummy_depfile fi } @@ -277,10 +283,7 @@ sgi) | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" + make_dummy_depfile fi rm -f "$tmpdepfile" ;; @@ -485,7 +488,7 @@ hp2) p }' "$tmpdepfile" >> "$depfile" else - echo "#dummy" > "$depfile" + make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; -- 2.7.4