[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: order-only prerequisites don't behave as I'd have expected after rea
From: |
Stefano Lattarini |
Subject: |
Re: order-only prerequisites don't behave as I'd have expected after reading the documentation |
Date: |
Tue, 12 Jun 2012 09:59:12 +0200 |
On 06/12/2012 02:06 AM, Philip Guenther wrote:
> On Mon, Jun 11, 2012 at 12:53 PM, Stefano Lattarini
> <address@hidden> wrote:
> ...
>> I was hoping to be able to the order-only prerequisites to enforce ordering
>> between .PHONY targets. At this point, I guess I should state the problem
>> I am trying to solve rather than just the attempts I've made at solving it.
>>
>> Is there an easy, scalable way to specify in a GNUmakefile that, whenever
>> two given targets T1 and T2 (either phony or not) are to be updated, T1's
>> recipe must be executed before T2's, all without declaring any dependency
>> of T2 on T1? So that for example, assuming T1 and T2 are both phony:
>>
>> $ make T1 # Only run T1's recipe
>> $ make T1 # Only run T2's recipe
>
> (I think you meant "make T2" there...)
>
Yes, sorry.
>
>> $ make T2 T1 # Run T1's recipe, then T2's recipe
>> $ make -j8 T2 T1 # Again, run T1's recipe, then T2's recipe
>
> I think I would use a test on $(MAKECMDGOALS) to make T1 a
> prerequisite of T2 if and only if T1 is a goal, say...
>
> ifneq ($(filter T1,${MAKECMDGOALS}),)
> T2: T1
> endif
>
Not good enough; the "order dependency" I want between T1 and T2 should
have to work also when they are updated as dependencies of other targets:
$ cat Makefile
all: T1 T2
...
$ make all # Ought to work executing T1 before T2.
Regards,
Stefano
Re: order-only prerequisites don't behave as I'd have expected after reading the documentation, Paul Smith, 2012/06/12