automake
[Top][All Lists]
Advanced

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

Re: Splitting "make check" into separate build and run targets


From: Stefano Lattarini
Subject: Re: Splitting "make check" into separate build and run targets
Date: Sat, 17 Nov 2012 12:22:53 +0100

On 11/16/2012 08:38 AM, Björn Stenberg wrote:
> Stefano Lattarini wrote:
>> Couldn't you simply add a 'buil-tests' target that creates
>> all the programs in $(TESTS)?  Something as simple as:
>>
>>     build-tests: $(TESTS)
>>
>> Then run it on the build system, before running "make check" on
>> the embedded target.  Or am I missing something?
> 
> The "check" target depends on the test programs, which in turn depend on their
> source code files.
> 
> I want to install only the test programs and test data on target, leaving
> out the the source and object files. That's why I created a "run" target
> that does not depend on those files being present.
>
You could add a dummy dependency for these missing sources, so that make
won't try to rebuild them (and fail, because there are no rules to do so):

   $ cat Makefile
   all: a.c b.c
        @echo $^
   $ make # Oops, missing deps!
   make: *** No rule to make target `a.c', needed by `all'.  Stop.
   $ echo status = $?
   status = 2
   $  echo 'a.c b.c:' | make -f Makefile -f -  # Lie to make
   a.c b.c
   $ echo status = $?
   status = 0

HTH,
  Stefano



reply via email to

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