[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Order-only prerequisites
From: |
Henrik Carlqvist |
Subject: |
Re: Order-only prerequisites |
Date: |
Wed, 7 Jun 2023 06:50:39 +0200 |
> Consider this makefile:
>
> .PHONY: a b
> a:; @echo a
> b:; @echo b
> b: | a
Your problem with this Makefile is that it never creates any files a or b.
This means that your order only prerequisite on a allways has to be made.
> % make b a
> a
> b
> make: Nothing to be done for 'a'.
>
> Correct order, but the last message seems strange.
First as a (order-only) prerequisite for b, a is made. Then b is made. Then
make was asked to make a but it does remember that a already has been made and
prints out that nothing to be done.
If your Makefile would have created the file a the order-only prerequisite
would have made sense. It would then mean that b would depend upon the
existance of a but it would not care about the timestamp of a. So if a exist
and is newer than b there is no need to remake b of a is a order-only
prerequisite.
> If so, is there another way to achieve what I want?
This totally depends upon what you want.
regards Henrik