On Thu, Jun 26, 2014 at 5:02 PM, Martin Dorey <martin.do...@hds.com> wrote:
>> I'm afraid none of this exercise is helpful for solving the problem
>
> Perhaps putting my point in different words will better convey it: you could 
> simply adjust your expectation, to regard this as a failure:
>
> make: Nothing to be done for `foo'.
>
> But...
>
>> To put it concisely: how do I get Make to *fail* if it cannot
>> create one of the targets?
>
> ... if you're really insistent on "get Make to return a non-zero exit status 
> if I haven't told it how to create one of the targets" then, per 
> http://www.gnu.org/software/make/manual/make.html#Last-Resort, you could do:
>
> martind@swiftboat:~/tmp/batrick-2014-06-26$ cat test.mk
> TARGETS = foo
>
> all: $(TARGETS)
>
> $(TARGETS): /etc/passwd
>
> %::; @echo no recipe for $@ 1>&2 && exit 1

Is there a way to get last-resort rules to play nicely with e.g.:

%.o: %.c
    cc -o $@ $<
%: %.o
    ld -o $@ $^ ...

The last-resort rule is preferred over the the %.c -> %.o -> % chain of rules.

-- 
Patrick Donnelly

_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to