Subject: bug#19961: check-local is kind of like check-hook

From: Shahbaz Youssefi <[email-masked]>
Date: Mon, 2 Mar 2015 13:17:12 +0100

On Mon, Mar 2, 2015 at 12:18 AM, Peter Johansson <[email-masked]> wrote:
> On 02/28/2015 02:07 AM, Shahbaz Youssefi wrote:
>>
>> To align this with the other -local rules, why not generate it like this?
>>
>> check-am: all-am check-local
>>      $(MAKE) $(AM_MAKEFLAGS) check-TESTS
>
> I think it would be a mistake to change this rule. Some projects might rely
> on the fact that 'check-local' depends on 'all-am' and 'check-local' might
> e.g. run some of the programs built within 'all-am'.
>

Fair enough. Wouldn't something like this address that issue?

check-local: all-am

check-am: check-local
     $(MAKE) $(AM_MAKEFLAGS) check-TESTS

>
> With my Automake the rule looks like:
>
> check-am: all-am
>     $(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS) $(check_DATA)
>     $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local
>
> so you could move your check_kernelmodule into check_DATA with something
> like (untested)
>
> check_DATA = kernelmodule.timestamp
>
> kernelmodule.timestamp:
>     @echo "*******************************************"
>     @echo "*******************************************"
>     @echo "I want this to be called before the check"
>     @echo "*******************************************"
>     @echo "*******************************************"
>

Ok, I haven't seen check_DATA before (is that new in Automake 1.15?).
This could be a solution of course, although a bit strange, since the
kernel module is not really "data".

I do have a related suggestion nevertheless. You see, no matter how
many scenarios you think about, there is always some use-case that's
going to be desired by someone but is unforeseen. Why not just create
a general rule? My suggestion is to have for each target X, the
following two targets:

- X-pre is guaranteed to run before X
- X-post is guaranteed to run after X

This way, regardless of the target, anyone with whatever strange,
foreseen or unforeseen scenario, can use these two to extend the
operation of the target.

Kampai,
Shahbaz