[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Patch: speed up compilations
From: |
Tom Tromey |
Subject: |
Patch: speed up compilations |
Date: |
05 Jul 2002 16:48:52 -0600 |
This patch changes automake so that dependency-tracking compilations
in gcc3 mode are inlined. This gives us a speedup in this common and
imho important case.
Unfortunately this patch isn't perfect :-(. It regresses cxx2.test,
at least.
Alexandre, what do you think is the best way to fix the resulting
failure? It looks like this:
/home/tromey/gnu/Auto/automake/automake/tests/../lib/am/depend2.am:
am__fastdepCXX does not appear in AM_CONDITIONAL
FAIL: cxx2.test
The problem is that we get the missing AM_CONDITIONAL error before we
get the missing AC_PROG_CXX error. The latter is much more
informative to the user, so just leaving things as-is isn't the best
idea.
Do you even think this is worthwhile? I haven't quantified the
slowdown from using depcomp. I'll put that on my to-do list...
Tom
Index: ChangeLog
from Tom Tromey <address@hidden>
* m4/depend.m4 (_AM_DEPENDENCIES): Compute am__fastdep<compiler>
conditional.
* automake.in (handle_languages): Compute FASTDEP.
* lib/am/depend2.am: Added %FASTDEP% mode.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1317
diff -u -r1.1317 automake.in
--- automake.in 3 Jul 2002 18:50:03 -0000 1.1317
+++ automake.in 5 Jul 2002 22:36:31 -0000
@@ -1717,11 +1717,14 @@
my $AMDEP = (($use_dependencies && $lang->autodep ne 'no')
? 'AMDEP' : 'FALSE');
+ my $FASTDEP = (($use_dependencies && $lang->autodep ne 'no')
+ ? ('am__fastdep' . $fpfx) : 'FALSE');
my %transform = ('EXT' => $ext,
'PFX' => $pfx,
'FPFX' => $fpfx,
'AMDEP' => $AMDEP,
+ 'FASTDEP' => $FASTDEP,
'-c' => $lang->compile_flag || '',
'MORE-THAN-ONE'
=> (count_files_for_language ($lang->name) >
1));
Index: lib/am/depend2.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/depend2.am,v
retrieving revision 1.42
diff -u -r1.42 depend2.am
--- lib/am/depend2.am 26 Mar 2002 09:24:52 -0000 1.42
+++ lib/am/depend2.am 5 Jul 2002 22:36:33 -0000
@@ -29,9 +29,23 @@
## - if deps are on, %AMDEP% is mapped onto AMDEP, and therefore
## the `if AMDEP' chunk is prefix with @AMDEP_TRUE@ just like for any
## other configure-time conditional.
+##
+## We do likewise for %FASTDEP%; this expands to an ordinary
+## configure-time conditional. %FASTDEP% is used to speed up the
+## common case of building a package with gcc 3.x. In this case we
+## can skip the use of depcomp and easily inline the dependency
+## tracking.
?GENERIC?%EXT%.o:
?!GENERIC?%OBJ%: %SOURCE%
+if %FASTDEP%
+## In fast-dep mode, we can always use -o.
+ if %COMPILE% -MT %OBJ% -MD -MP -MF "%DEPBASE%.Tpo" \
+ %-c% -o %OBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \
+ then mv "%DEPBASE%.Tpo" "%DEPBASE%.Po"; \
+ else rm -f "%DEPBASE%.Tpo"; exit 1; \
+ fi
+else !%FASTDEP%
if %AMDEP%
source='%SOURCE%' object='%OBJ%' libtool=no @AMDEPBACKSLASH@
depfile='%DEPBASE%.Po' tmpdepfile='%DEPBASE%.TPo' @AMDEPBACKSLASH@
@@ -39,9 +53,18 @@
endif %AMDEP%
?-o? %COMPILE% %-c% %-o% %OBJ% `test -f '%SOURCE%' || echo
'$(srcdir)/'`%SOURCE%
?!-o? %COMPILE% %-c% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
+endif !%FASTDEP%
?GENERIC?%EXT%.obj:
?!GENERIC?%OBJOBJ%: %SOURCE%
+if %FASTDEP%
+## In fast-dep mode, we can always use -o.
+ if %COMPILE% -MT %OBJOBJ% -MD -MP -MF "%DEPBASE%.Tpo" \
+ %-c% -o %OBJOBJ% `cygpath -w %SOURCE%`; \
+ then mv "%DEPBASE%.Tpo" "%DEPBASE%.Po"; \
+ else rm -f "%DEPBASE%.Tpo"; exit 1; \
+ fi
+else !%FASTDEP%
if %AMDEP%
source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
depfile='%DEPBASE%.Po' tmpdepfile='%DEPBASE%.TPo' @AMDEPBACKSLASH@
@@ -49,15 +72,25 @@
endif %AMDEP%
?-o? %COMPILE% %-c% %-o% %OBJOBJ% `cygpath -w %SOURCE%`
?!-o? %COMPILE% %-c% `cygpath -w %SOURCE%`
+endif !%FASTDEP%
if %?LIBTOOL%
?GENERIC?%EXT%.lo:
?!GENERIC?%LTOBJ%: %SOURCE%
-if %AMDEP%
+if %FASTDEP%
+## In fast-dep mode, we can always use -o.
+ if %COMPILE% -MT %LTOBJ% -MD -MP -MF "%DEPBASE%.Tpo" \
+ %-c% -o %LTOBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% \
+ then mv "%DEPBASE%.Tpo" "%DEPBASE%.Po"; \
+ else rm -f "%DEPBASE%.Tpo"; exit 1; \
+ fi
+else !%FASTDEP%
+if %AMDEP%
source='%SOURCE%' object='%LTOBJ%' libtool=yes @AMDEPBACKSLASH@
depfile='%DEPBASE%.Plo' tmpdepfile='%DEPBASE%.TPlo' @AMDEPBACKSLASH@
$(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
-endif %AMDEP%
+endif %AMDEP%
## We can always use `-o' with Libtool.
%LTCOMPILE% %-c% -o %LTOBJ% `test -f '%SOURCE%' || echo
'$(srcdir)/'`%SOURCE%
+endif !%FASTDEP%
endif %?LIBTOOL%
Index: m4/depend.m4
===================================================================
RCS file: /cvs/automake/automake/m4/depend.m4,v
retrieving revision 1.25
diff -u -r1.25 depend.m4
--- m4/depend.m4 24 May 2002 10:36:16 -0000 1.25
+++ m4/depend.m4 5 Jul 2002 22:36:33 -0000
@@ -107,6 +107,9 @@
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
- Patch: speed up compilations,
Tom Tromey <=