automake
[Top][All Lists]
Advanced

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

problems with recursive make target


From: johnwohlbier
Subject: problems with recursive make target
Date: Mon, 29 Jun 2009 19:36:09 +0000

I need separate targets to build tests and to execute tests, so check-local alone is not enough. Our machines allow compiling on the "frontend" and running on the "backend," so I'd like a recursive make target called "tests" that only compiles the tests, then I'll use check-local for test execution with autotest. Following this http://www.freesoftwaremagazine.com/books/agaal/catalog_of_reusable_solutions I tried the following.

My directory structure is
top/
top/lib
top/lib/pika_comm
top/lib/pika_comm/test
top/lib/pika_utilities
top/lib/pika_utilities/test

in top/Makefile.am
SUBDIRS = ${CELLDIR} lib
# provide a separate recursive target for making tests
tests : all
for dir in $(SUBDIRS); do \
cd $$dir && $(MAKE) $(AM_MAKEFLAGS) $@ || exit 1; \
done

.PHONY : tests

in top/lib/Makefile.am
SUBDIRS = pika_comm pika_utilities
# provide a separate recursive target for making tests
tests : all
echo `pwd`;
for dir in $(SUBDIRS); do \
cd $$dir && $(MAKE) $(AM_MAKEFLAGS) $@ || exit 1; \
done
echo `pwd`;
.PHONY : tests

in top/lib/pika_comm/Makefile.am
tests : all
cd test && $(MAKE) $(AM_MAKEFLAGS) $@ || exit 1;
.PHONY : tests

in top/lib/pika_comm/test/Makefile.am (note the absence of $@ in this make command, as I just want this to do "make" on the test sources)
tests :
$(MAKE) $(AM_MAKEFLAGS) || exit 1
.PHONY : tests

and similarly for top/lib/pika_utilities(/test)

For some reason this is not working. I believe what is happening is that when I issue make tests (after properly building all, if needed) it descends down into pika_comm/test, makes the test executables, but then does not properly change back to top/lib/. Here is some make output showing this (all has already been built so isn't built again):

address@hidden build]$ make tests
Making all in lib
make[1]: Entering directory `/users/wohlbier/MPMC/pika/build/lib'
Making all in pika_comm
make[2]: Entering directory `/users/wohlbier/MPMC/pika/build/lib/pika_comm'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/users/wohlbier/MPMC/pika/build/lib/pika_comm'
Making all in pika_utilities
make[2]: Entering directory `/users/wohlbier/MPMC/pika/build/lib/pika_utilities'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/users/wohlbier/MPMC/pika/build/lib/pika_utilities'
make[2]: Entering directory `/users/wohlbier/MPMC/pika/build/lib'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/users/wohlbier/MPMC/pika/build/lib'
make[1]: Leaving directory `/users/wohlbier/MPMC/pika/build/lib'
make[1]: Entering directory `/users/wohlbier/MPMC/pika/build'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/users/wohlbier/MPMC/pika/build'
for dir in lib; do \
cd $dir && make tests || exit 1; \
done
make[1]: Entering directory `/users/wohlbier/MPMC/pika/build/lib'
Making all in pika_comm
make[2]: Entering directory `/users/wohlbier/MPMC/pika/build/lib/pika_comm'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/users/wohlbier/MPMC/pika/build/lib/pika_comm'
Making all in pika_utilities
make[2]: Entering directory `/users/wohlbier/MPMC/pika/build/lib/pika_utilities'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/users/wohlbier/MPMC/pika/build/lib/pika_utilities'
make[2]: Entering directory `/users/wohlbier/MPMC/pika/build/lib'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/users/wohlbier/MPMC/pika/build/lib'
echo `pwd`;
/users/wohlbier/MPMC/pika/build/lib
for dir in pika_comm pika_utilities; do \
cd $dir && make tests || exit 1; \
done
make[2]: Entering directory `/users/wohlbier/MPMC/pika/build/lib/pika_comm'
cd test && make tests || exit 1;
make[3]: Entering directory `/users/wohlbier/MPMC/pika/build/lib/pika_comm/test'
make || exit 1
make[4]: Entering directory `/users/wohlbier/MPMC/pika/build/lib/pika_comm/test'
make[4]: Nothing to be done for `all'.
make[4]: Leaving directory `/users/wohlbier/MPMC/pika/build/lib/pika_comm/test' make[3]: Leaving directory `/users/wohlbier/MPMC/pika/build/lib/pika_comm/test'
make[2]: Leaving directory `/users/wohlbier/MPMC/pika/build/lib/pika_comm'
/bin/sh: line 1: cd: pika_utilities: No such file or directory
make[1]: *** [tests] Error 1
make[1]: Leaving directory `/users/wohlbier/MPMC/pika/build/lib'
make: *** [tests] Error 1
address@hidden build]$


Any ideas anyone?


reply via email to

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