[Top][All Lists]

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

Re: $(EXEEXT) in TESTS required?

From: Simon Josefsson
Subject: Re: $(EXEEXT) in TESTS required?
Date: Fri, 20 Jan 2006 13:58:51 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Ralf Wildenhues <address@hidden> writes:

>> You need mingw to provoke the bug,
> Not quite.  You need to cross-compile to MinGW on a non-.exe system to
> provoke the bug.


>> test-gc$(EXEEXT): $(test_gc_OBJECTS) $(test_gc_DEPENDENCIES) 
>>      @rm -f test-gc$(EXEEXT)
>>      $(LINK) $(test_gc_LDFLAGS) $(test_gc_OBJECTS) $(test_gc_LDADD) $(LIBS)
>> So if TESTS only contain test-gc, that rule won't be invoked.
> Automake outputs rules like this when it encounters check_PROGRAMS:
> | check-am: all-am
> |         $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
> |         $(MAKE) $(AM_MAKEFLAGS) check-TESTS
> The first rule builds test-gc.exe, and both Cygwin and MinGW are
> designed so that the target `test-gc' is satisfied by the file
> `test-gc.exe', so the second rule will not fail.
> *snip test with `TESTS = test-gc$(EXEEXT)'*
>> Now, I remove $(EXEEXT) from tests/Makefile.am.
> You should also `make clean' before this:
>> address@hidden:/tmp/testdir$ make check
> then you could see that test-gc.exe is successfully rebuilt before this
> error is encountered:
>> Making check in lib
> *snip*
>> make[4]: Entering directory `/tmp/testdir/tests'
>> i586-mingw32msvc-gcc -g -O2    test-gc.c   -o test-gc
>> test-gc.c:26:16: gc.h: No such file or directory

Yes, right.

> 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?),
> - simply document the fact that checking in the cross-compile setup
>   won't work.
> I dislike the last one, using wine here looks like a nice solution to
> me.  The second one looks like it could also allow Automake to get rid
> of the
>         $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
> rule completely, given that rewriting is possible.

I strongly dislike the last one; wine is very useful here.

The second one seem fine.  If it is impossible to add $(EXEEXT)
reliably to TESTS, perhaps a new name could be used.  While at it, if
it is possible to reduce the redundancy in statements like:

TESTS += test-gc$(EXEEXT)
check_PROGRAMS += test-gc

that would be useful.

How about simply:

tests_PROGRAMS += test-gc

it would infer the source code as test-gc.c and infer the TESTS
addition as test-gc$(EXEEXT).  If you have more source code files for
test-gc, just add them as:

test_gc_SOURCES = test-gc.c foo.c

Or something, I'm not really sure.  I have always found this
redundancy a bit disturbing though.


reply via email to

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