Re: [PATCH] kbuild: drop FORCE from PHONY targets

From: Andy Lutomirski
Date: Mon Mar 14 2016 - 00:45:25 EST


On Sun, Mar 13, 2016 at 9:36 PM, Masahiro Yamada
<yamada.masahiro@xxxxxxxxxxxxx> wrote:
> 2016-03-14 13:28 GMT+09:00 Andy Lutomirski <luto@xxxxxxxxxxxxxx>:
>> On Sun, Mar 13, 2016 at 9:08 PM, Masahiro Yamada
>> <yamada.masahiro@xxxxxxxxxxxxx> wrote:
>>>
>>> Hi Andy
>>>
>>> 2016-03-14 9:39 GMT+09:00 Andy Lutomirski <luto@xxxxxxxxxxxxxx>:
>>> > On Mar 12, 2016 4:14 PM, "Masahiro Yamada"
>>> > <yamada.masahiro@xxxxxxxxxxxxx> wrote:
>>> >>
>>> >> These targets are marked as PHONY. No need to add FORCE to their
>>> >> dependency.
>>> >
>>> > If this is, in fact, correct, can you update
>>> > Documentation/kbuild/makefiles.txt as well?
>>>
>>> Which line do you want me to update?
>>>
>>
>> All the references to FORCE should probably mention .PHONY as an alternative.
>
> I do not get your point.
>
> All the examples in the makefile.txt correctly reference to FORCE.
> They are not PHONY targets.
> No need to update.

But they could be. For example:

$(obj)/image: vmlinux FORCE
$(call if_changed,objcopy)

could be:

.PHONY: $(obj)/image
$(obj)/image: vmlinux
$(call if_changed,objcopy)

I would at least change:

Note: It is a typical mistake to forget the FORCE prerequisite.

to:

Note: if-changed is only useful if make executes it, which won't
happen if it determines that the inputs have not changed since the
output was built. This can be avoided by specifying FORCE as a
prerequisite or by making declaring the output as .PHONY.

--Andy

>
>
>
>
> --
> Best Regards
> Masahiro Yamada



--
Andy Lutomirski
AMA Capital Management, LLC