[Top][All Lists]

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

Re: $(EXEEXT) in TESTS required?

From: Bruno Haible
Subject: Re: $(EXEEXT) in TESTS required?
Date: Mon, 23 Jan 2006 21:51:57 +0100
User-agent: KMail/1.5

[For the automake people: The problem is that a Makefile.am snippet like

     TESTS = test-lock
     check_PROGRAMS = test-lock
     test_LOCK_LDFLAGS = -lmyspeciallib

when cross-compiling to mingw on a Unix system with 'wine', will cause
"make check" to build 'test-lock', rather than 'test-lock.exe', thus
executing a compile and link command line that ignores the specific
CPPFLAGS and LDFLAGS. The thread started at

Ralf Wildenhues wrote:
> Now I wonder how to best "fix" this in Automake:
> - document the fact that $(EXEEXT) should be used in `TESTS', for the
>   benefit of cross-compilation,
> - have Automake rewrite TESTS to add $(EXEEXT) where appropriate (is
>   this possible in all cases?),

I'm in favour of the second choice, and I claim that it is possible in all
cases. Why? Look at the currently generated tests/Makefile.in:

noinst_PROGRAMS =
check_PROGRAMS = test-lock$(EXEEXT)

TESTS = test-lock

check-am: all-am
        $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
        $(MAKE) $(AM_MAKEFLAGS) check-TESTS

check-TESTS: $(TESTS)
        @failed=0; all=0; xfail=0; xpass=0; skip=0; \

What you see is:
1) $(TESTS) occurs as a dependency in a target.
2) automake has rewritten the check_PROGRAMS variable.

From 1) I conclude that the TESTS variable cannot contain shell escapes
like backquoted commands,
since they wouldn't work as target dependencies anyway.

Therefore automake can indeed add a variable am_TESTS_DEPENDENCIES
that is constructed from TESTS by adding $(EXEEXT) to all elements that
also occur in the original value of check_PROGRAMS (and maybe also
noinst_PROGRAMS - why not?). Then change

check-TESTS: $(TESTS)



and you're done.

From 2) I conclude that it would even be acceptable to change the TESTS
variable itself, to assume the contents of am_TESTS_DEPENDENCIES.


reply via email to

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