[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pr401*.test and BSD make: computing LIBOBJDIR
From: |
Ralf Wildenhues |
Subject: |
Re: pr401*.test and BSD make: computing LIBOBJDIR |
Date: |
Thu, 8 Jun 2006 00:30:18 +0200 |
User-agent: |
Mutt/1.5.11+cvs20060403 |
* Alexandre Duret-Lutz wrote on Tue, Jun 06, 2006 at 09:09:02PM CEST:
> >>> "adl" == Alexandre Duret-Lutz <address@hidden> writes:
>
> $(top_builddir) can be computed statically by Automake if
> needed. I think automake's $topsrcdir (the Perl variable)
> contains exactly the relative path you want. Maybe that's
> simpler and faster ? (i.e., no depout.m4 modification required)
How about this?
(There is still the point that the respective sibling setups don't work
in that they don't properly have build rules for the library; but that
is rather orthogonal to the issues discussed in this thread so far.)
Cheers,
Ralf
* automake.in (handle_LIBOBJS_or_ALLOCA): With subdir-objects,
do not prefix `$(top_builddir)/' aka `./' to nonempty LIBOBJDIR,
to help BSD Make find the files also in a VPATH build.
Also return the same path, possibly prefixed, for correct
depdir computation.
* tests/pr401.test: Update to expose wrong depdir computation.
Rewrite to not use the same file name for library object and
main program.
* tests/pr401b.test, tests/pr401c.test: Likewise.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1622
diff -u -r1.1622 automake.in
--- automake.in 7 Jun 2006 06:01:22 -0000 1.1622
+++ automake.in 7 Jun 2006 22:04:58 -0000
@@ -2175,7 +2172,15 @@
{
if (option 'subdir-objects')
{
- define_variable ('LIBOBJDIR', "\$(top_builddir)/$dir", INTERNAL);
+ # In the top-level Makefile we do not use $(top_builddir), because
+ # we are already there, and since the targets are built without
+ # a $(top_builddir), it helps BSD Make to match them with
+ # dependencies.
+ if ($relative_dir ne '.')
+ {
+ $dir = $topsrcdir . '/' . $dir;
+ }
+ define_variable ('LIBOBJDIR', "$dir", INTERNAL);
$clean_files{"\$($var)"} = MOSTLY_CLEAN;
# If LTLIBOBJS is used, we must also clear LIBOBJS (which might
# be created by libtool as a side-effect of creating LTLIBOBJS).
Index: tests/pr401.test
===================================================================
RCS file: /cvs/automake/automake/tests/pr401.test,v
retrieving revision 1.3
diff -u -r1.3 pr401.test
--- tests/pr401.test 6 Jun 2006 20:42:36 -0000 1.3
+++ tests/pr401.test 7 Jun 2006 22:18:46 -0000
@@ -36,7 +36,7 @@
}
EOF
-cat >src/feep.c <<'EOF'
+cat >src/main.c <<'EOF'
#include <stdio.h>
extern char *feep ();
@@ -76,10 +76,10 @@
EOF
cat >src/Makefile.am <<'EOF'
-check_PROGRAMS = feep
-feep_LDADD = ../lib/libfeep.a
+check_PROGRAMS = main
+main_LDADD = ../lib/libfeep.a
-TESTS = feep
+TESTS = main
EOF
$ACLOCAL
@@ -107,16 +107,18 @@
libfeep_a_SOURCES =
libfeep_a_LIBADD = $(LIBOBJS)
-check_PROGRAMS = feep
-feep_LDADD = libfeep.a
+check_PROGRAMS = main
+main_LDADD = libfeep.a
-TESTS = feep
+TESTS = main
EOF
$ACLOCAL
$AUTOCONF
$AUTOMAKE --add-missing
./configure
+test ! -d src/lib
+test ! -d 'src/$(top_builddir)'
$MAKE
$MAKE check
$MAKE distclean
@@ -136,14 +138,16 @@
lib_libfeep_a_SOURCES =
lib_libfeep_a_LIBADD = $(LIBOBJS)
-check_PROGRAMS = src/feep
-src_feep_SOURCES = src/feep.c
-src_feep_LDADD = lib/libfeep.a
+check_PROGRAMS = src/main
+src_main_SOURCES = src/main.c
+src_main_LDADD = lib/libfeep.a
-TESTS = src/feep
+TESTS = src/main
check-local:
- test -f src/feep.$(OBJEXT)
+ test -f src/main.$(OBJEXT)
+ test -f lib/feep.$(OBJEXT)
+ test ! -f src/$(DEPDIR)/feep.Po
EOF
$ACLOCAL
Index: tests/pr401b.test
===================================================================
RCS file: /cvs/automake/automake/tests/pr401b.test,v
retrieving revision 1.3
diff -u -r1.3 pr401b.test
--- tests/pr401b.test 6 Jun 2006 20:42:36 -0000 1.3
+++ tests/pr401b.test 7 Jun 2006 22:18:46 -0000
@@ -36,7 +36,7 @@
}
EOF
-cat >src/feep.c <<'EOF'
+cat >src/main.c <<'EOF'
#include <stdio.h>
extern char *feep ();
@@ -76,10 +76,10 @@
EOF
cat >src/Makefile.am <<'EOF'
-check_PROGRAMS = feep
-feep_LDADD = ../lib/libfeep.la
+check_PROGRAMS = main
+main_LDADD = ../lib/libfeep.la
-TESTS = feep
+TESTS = main
EOF
libtoolize
@@ -108,16 +108,18 @@
libfeep_la_SOURCES =
libfeep_la_LIBADD = $(LTLIBOBJS)
-check_PROGRAMS = feep
-feep_LDADD = libfeep.la
+check_PROGRAMS = main
+main_LDADD = libfeep.la
-TESTS = feep
+TESTS = main
EOF
$ACLOCAL
$AUTOCONF
$AUTOMAKE --add-missing
./configure
+test ! -d src/lib
+test ! -d 'src/$(top_builddir)'
$MAKE
$MAKE check
$MAKE distclean
@@ -137,14 +139,16 @@
lib_libfeep_la_SOURCES =
lib_libfeep_la_LIBADD = $(LTLIBOBJS)
-check_PROGRAMS = src/feep
-src_feep_SOURCES = src/feep.c
-src_feep_LDADD = lib/libfeep.la
+check_PROGRAMS = src/main
+src_main_SOURCES = src/main.c
+src_main_LDADD = lib/libfeep.la
-TESTS = src/feep
+TESTS = src/main
check-local:
- test -f src/feep.$(OBJEXT)
+ test -f src/main.$(OBJEXT)
+ test -f lib/feep.lo
+ test ! -f src/$(DEPDIR)/feep.Po
EOF
$ACLOCAL
Index: tests/pr401c.test
===================================================================
RCS file: /cvs/automake/automake/tests/pr401c.test,v
retrieving revision 1.3
diff -u -r1.3 pr401c.test
--- tests/pr401c.test 6 Jun 2006 20:42:36 -0000 1.3
+++ tests/pr401c.test 7 Jun 2006 22:18:46 -0000
@@ -39,7 +39,7 @@
}
EOF
-cat >src/feep.c <<'EOF'
+cat >src/main.c <<'EOF'
#include <stdio.h>
extern char *feep ();
@@ -78,10 +78,10 @@
EOF
cat >src/Makefile.am <<'EOF'
-check_PROGRAMS = feep
-feep_LDADD = ../lib/libfeep.a
+check_PROGRAMS = main
+main_LDADD = ../lib/libfeep.a
-TESTS = feep
+TESTS = main
EOF
$ACLOCAL
@@ -109,10 +109,10 @@
libfeep_a_SOURCES =
libfeep_a_LIBADD = $(ALLOCA) $(LIBOBJS) # Add LIBOBJS for fun
-check_PROGRAMS = feep
-feep_LDADD = libfeep.a
+check_PROGRAMS = main
+main_LDADD = libfeep.a
-TESTS = feep
+TESTS = main
EOF
$ACLOCAL
@@ -120,6 +120,8 @@
$AUTOMAKE --add-missing
./configure
$MAKE
+test ! -d src/lib
+test ! -d 'src/$(top_builddir)'
$MAKE check
$MAKE distclean
@@ -138,14 +140,16 @@
lib_libfeep_a_SOURCES =
lib_libfeep_a_LIBADD = $(ALLOCA)
-check_PROGRAMS = src/feep
-src_feep_SOURCES = src/feep.c
-src_feep_LDADD = lib/libfeep.a
+check_PROGRAMS = src/main
+src_main_SOURCES = src/main.c
+src_main_LDADD = lib/libfeep.a
-TESTS = src/feep
+TESTS = src/main
check-local:
- test -f src/feep.$(OBJEXT)
+ test -f src/main.$(OBJEXT)
+ test -f lib/alloca.$(OBJEXT)
+ test ! -f src/$(DEPDIR)/alloca.Po
EOF
$ACLOCAL