automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

depcomp testing (was: depcomp: support newer HP compilers)


From: Ralf Wildenhues
Subject: depcomp testing (was: depcomp: support newer HP compilers)
Date: Wed, 4 Jan 2006 20:10:11 +0100
User-agent: Mutt/1.5.9i

Hi Alexandre,

* Alexandre Duret-Lutz wrote on Wed, Jan 04, 2006 at 01:11:25AM CET:
> 
>  RW> Note that ia64hp style, unlike tru64, removes all possible tmpdepfiles
>  RW> with this patch.  It may be useful to change tru64 style to do this as
>  RW> well.
> 
> I confess I can't see why it's useful, although it certainly is harmless.

Remember that Automake outputs
   rm -rf .libs _libs
for `make clean' because the number of libtool leftovers is, um, not
very sharply defined?  I'm trying to improve the latter a bit; also
there are a few proposed changes to autoconf/automake to have `clean'
remove more potential compiler leftover, independendly of libtool.
(I'm not targeting the removal of the `rm -rf .libs _libs', at least
not in the near future.)

>  RW> I will try to rewrite a couple of the tests I used so they are suitable
>  RW> for inclusion in Automake test suite.
> 
> This would be sweet.  If you have a way to detect this compiler
> it should be really easy to duplicate depcomp5.test.

Well, first here's a couple of general depcomp tests that expose better
than the current ones do.  These are not tests specifically for ia64hp,
but general tests for depcomp functionality.  They are not as strong as
they could be: some `make' implementations cause rebuilds of parts of
the targets for a couple of times (seen in the subdir-objects part),
so their triggering isn't proof that dependency tracking works well,
but it's better than nothing.  (One could think about throwing in a
couple of `sleep 1; $MAKE'.)

I don't know how to detect this particular compiler in a good way, but
I haven't looked very hard either.

Below, there's also a hack for depmodes hp/gcc to not output `foo.c :'
lines.  It's a hack because `grep -v "^$source$"' is bad when $source
contains regex-active characters, but was the simplest I could come up
with.  Better suggestions welcome.  The tests expose the failure on
HPUX non-ia64.

Cheers,
Ralf

        * lib/depcomp (hp, gcc depmode): Do not output a dummy
        dependency for the primary source file.

        * tests/depcomp6.test, tests/depcomp7.test: New tests,
        for general `depcomp' functionality, with and without
        `subdir-objects', with and without `libtool'.
        * tests/Makefile.am: Adjusted.

Index: lib/depcomp
===================================================================
RCS file: /cvs/automake/automake/lib/depcomp,v
retrieving revision 1.55
diff -u -r1.55 depcomp
--- lib/depcomp 9 Jul 2005 09:24:40 -0000       1.55
+++ lib/depcomp 4 Jan 2006 20:08:31 -0000
@@ -134,7 +134,9 @@
 ## dummy dependencies for each header file.  Too bad gcc doesn't do
 ## this for us directly.
   tr ' ' '
-' < "$tmpdepfile" |
+' < "$tmpdepfile" | 
+## Do not add dummy dependencies for the source file
+    grep -v "^$source$" |
 ## Some versions of gcc put a space before the `:'.  On the theory
 ## that the space means something, we add a space to the output as
 ## well.
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.591
diff -u -r1.591 Makefile.am
--- tests/Makefile.am   30 Jun 2005 21:19:47 -0000      1.591
+++ tests/Makefile.am   4 Jan 2006 20:08:31 -0000
@@ -189,6 +189,8 @@
 depcomp3.test \
 depcomp4.test \
 depcomp5.test \
+depcomp6.test \
+depcomp7.test \
 depdist.test \
 depend.test \
 depend2.test \
--- /dev/null   2005-08-03 12:45:51.659987528 +0200
+++ tests/depcomp6.test 2006-01-04 20:52:27.000000000 +0100
@@ -0,0 +1,107 @@
+#! /bin/sh
+# Copyright (C) 2006  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Check dependency generation (non libtool case).
+
+. ./defs || exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_RANLIB
+AC_CONFIG_FILES(sub2/Makefile)
+AC_OUTPUT
+END
+
+mkdir sub sub2 sub2/sub3
+
+cat >Makefile.am <<'END'
+SUBDIRS = sub2
+bin_PROGRAMS = foo
+foo_SOURCES = foo.c sub/bar.c foo.h sub/bar.h
+foo_LDADD = sub2/libbaz.a
+END
+
+cat >sub2/Makefile.am <<'END'
+AUTOMAKE_OPTIONS = subdir-objects
+noinst_LIBRARIES = libbaz.a
+libbaz_a_SOURCES = baz.c sub3/ba3.c baz.h sub3/ba3.h
+END
+
+cat >foo.c <<'END'
+#include "foo.h"
+#include "sub2/baz.h"
+#include <stdlib.h>
+int main() { printf("foo"); return bar() + baz(); }
+END
+
+cat >foo.h <<'END'
+#include <stdio.h>
+#include "sub/bar.h"
+END
+
+cat >sub/bar.c <<'END'
+#include "sub/bar.h"
+int bar() { return 0; }
+END
+
+touch sub2/sub3/ba3.h
+
+cat >sub/bar.h <<'END'
+#include <stdio.h>
+extern int bar();
+END
+
+cat >sub2/baz.c <<'END'
+#include "baz.h"
+int baz() { return 0; }
+END
+
+cat >sub2/baz.h <<'END'
+extern int baz();
+END
+
+cat >sub2/sub3/ba3.c <<'END'
+#include "ba3.h"
+int ba3() { return 0; }
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure --enable-dependency-tracking
+$MAKE 
+
+# check that no bogus `foo.c:' dummy deps have been created
+rm foo.c sub/bar.c
+if $MAKE foo.c; then false; fi
+if $MAKE sub/bar.c; then false; fi
+
+# check that dependency tracking works
+if grep 'depmode=none' Makefile; then :
+else
+  cd sub2
+  sleep 1
+  echo 'choke me' > sub3/ba3.h
+  if $MAKE; then false; fi
+fi
--- /dev/null   2005-08-03 12:45:51.659987528 +0200
+++ tests/depcomp7.test 2006-01-04 20:52:27.000000000 +0100
@@ -0,0 +1,109 @@
+#! /bin/sh
+# Copyright (C) 2006  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Check dependency generation (libtool case).
+
+required='libtoolize'
+. ./defs || exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+AM_PROG_LIBTOOL
+AC_CONFIG_FILES(sub2/Makefile)
+AC_OUTPUT
+END
+
+mkdir sub sub2 sub2/sub3
+
+cat >Makefile.am <<'END'
+SUBDIRS = sub2
+bin_PROGRAMS = foo
+foo_SOURCES = foo.c sub/bar.c foo.h sub/bar.h
+foo_LDADD = sub2/libbaz.la
+END
+
+cat >sub2/Makefile.am <<'END'
+AUTOMAKE_OPTIONS = subdir-objects
+noinst_LTLIBRARIES = libbaz.la
+libbaz_la_SOURCES = baz.c sub3/ba3.c baz.h sub3/ba3.h
+END
+
+cat >foo.c <<'END'
+#include "foo.h"
+#include "sub2/baz.h"
+#include <stdlib.h>
+int main() { printf("foo"); return bar() + baz(); }
+END
+
+cat >foo.h <<'END'
+#include <stdio.h>
+#include "sub/bar.h"
+END
+
+cat >sub/bar.c <<'END'
+#include "sub/bar.h"
+int bar() { return 0; }
+END
+
+touch sub2/sub3/ba3.h
+
+cat >sub/bar.h <<'END'
+#include <stdio.h>
+extern int bar();
+END
+
+cat >sub2/baz.c <<'END'
+#include "baz.h"
+int baz() { return 0; }
+END
+
+cat >sub2/baz.h <<'END'
+extern int baz();
+END
+
+cat >sub2/sub3/ba3.c <<'END'
+#include "ba3.h"
+int ba3() { return 0; }
+END
+
+libtoolize
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure --enable-dependency-tracking
+$MAKE 
+
+# check that no bogus `foo.c:' dummy deps have been created
+rm foo.c sub/bar.c
+if $MAKE foo.c; then false; fi
+if $MAKE sub/bar.c; then false; fi
+
+# check that dependency tracking works
+if grep 'depmode=none' Makefile; then :
+else
+  cd sub2
+  sleep 1
+  echo 'choke me' > sub3/ba3.h
+  if $MAKE; then false; fi
+fi




reply via email to

[Prev in Thread] Current Thread [Next in Thread]