This is the mail archive of the
automake@gnu.org
mailing list for the automake project.
interaction with dependency tracking and subdir-objects
- To: automake at gnu dot org
- Subject: interaction with dependency tracking and subdir-objects
- From: Robert Collins <robert dot collins at itdomain dot com dot au>
- Date: 16 Aug 2001 19:45:59 +1000
- List-Id: Discussion list for automake <automake.gnu.org>
The following:
AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = foo
foo_SOURCES = $(top_srcdir)/main.c
is legal AFAIK, and while the $(top_srcdir) is somewhat redundant, it
could get used when including some common rules via an automake
include..
unfortunately it generates the following dependency file path:
.deps/$(top_srcdir)/main.Po, which can fail in VPATH builds.
as a result I'd like to propose that dependencies get placed in
the same relative directory as the source file resides, not the same
directory as the Makefile.
ie for this case $(top_builddir)/.deps/main.c
thoughts?
Rob
#!/bin/sh
# Test for $(top_srcdir) with dependencies.
. $srcdir/defs || exit 1
cat >main.c <<EOF
int main() { return 0; }
EOF
cat >Makefile.am <<EOF
AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = foo
foo_SOURCES = \$(top_srcdir)/main.c
EOF
cat >configure.in <<EOF
AC_INIT(main.c)
AC_CONFIG_AUX_DIR(.)
AM_INIT_AUTOMAKE(test_am, 1.0)
AC_PROG_CC
AM_PROG_CC_C_O
AC_OUTPUT(Makefile)
EOF
# Fail gracefully if no autoconf.
$needs_autoconf
# Likewise for gcc.
(gcc -v) > /dev/null 2>&1 || exit 77
touch README NEWS AUTHORS ChangeLog
mkdir build
# We use gcc and not gcc -traditional as the latter fails on some
# Linux boxes (Red Hat 5.1 in particular).
$ACLOCAL \
&& $AUTOCONF \
&& $AUTOMAKE -a || exit 1
cd build \
&& CC='gcc' ../configure \
&& $MAKE || exit 1