alistair23-linux/drivers/of
Masahiro Yamada 54a702f705 kbuild: mark $(targets) as .SECONDARY and remove .PRECIOUS markers
GNU Make automatically deletes intermediate files that are updated
in a chain of pattern rules.

Example 1) %.dtb.o <- %.dtb.S <- %.dtb <- %.dts
Example 2) %.o <- %.c <- %.c_shipped

A couple of makefiles mark such targets as .PRECIOUS to prevent Make
from deleting them, but the correct way is to use .SECONDARY.

  .SECONDARY
    Prerequisites of this special target are treated as intermediate
    files but are never automatically deleted.

  .PRECIOUS
    When make is interrupted during execution, it may delete the target
    file it is updating if the file was modified since make started.
    If you mark the file as precious, make will never delete the file
    if interrupted.

Both can avoid deletion of intermediate files, but the difference is
the behavior when Make is interrupted; .SECONDARY deletes the target,
but .PRECIOUS does not.

The use of .PRECIOUS is relatively rare since we do not want to keep
partially constructed (possibly corrupted) targets.

Another difference is that .PRECIOUS works with pattern rules whereas
.SECONDARY does not.

  .PRECIOUS: $(obj)/%.lex.c

works, but

  .SECONDARY: $(obj)/%.lex.c

has no effect.  However, for the reason above, I do not want to use
.PRECIOUS which could cause obscure build breakage.

The targets specified as .SECONDARY must be explicit.  $(targets)
contains all targets that need to include .*.cmd files.  So, the
intermediates you want to keep are mostly in there.  Therefore, mark
$(targets) as .SECONDARY.  It means primary targets are also marked
as .SECONDARY, but I do not see any drawback for this.

I replaced some .SECONDARY / .PRECIOUS markers with 'targets'.  This
will make Kbuild search for non-existing .*.cmd files, but this is
not a noticeable performance issue.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Frank Rowand <frowand.list@gmail.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
2018-04-07 19:04:02 +09:00
..
unittest-data kbuild: mark $(targets) as .SECONDARY and remove .PRECIOUS markers 2018-04-07 19:04:02 +09:00
address.c of: Add missing I/O range exception for indirect-IO devices 2018-04-04 08:42:47 -05:00
base.c of: cache phandle nodes to reduce cost of of_find_node_by_phandle() 2018-03-07 14:50:09 -06:00
device.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
dynamic.c of: overlay: do not include path in full_name of added nodes 2018-03-05 15:38:34 -06:00
fdt.c of/fdt: use memblock_virt_alloc for early alloc 2018-01-08 08:24:34 -06:00
fdt_address.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
irq.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
Kconfig of: change overlay apply input data from unflattened to FDT 2018-03-04 00:29:24 -08:00
kobj.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
Makefile PCI: Move OF-related PCI functions into PCI core 2018-01-17 17:36:39 -06:00
of_mdio.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-01-11 22:13:42 -05:00
of_net.c of_net: Implement of_get_nvmem_mac_address helper 2018-03-30 10:40:18 -04:00
of_numa.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
of_private.h of: cache phandle nodes to reduce cost of of_find_node_by_phandle() 2018-03-07 14:50:09 -06:00
of_reserved_mem.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
overlay.c of: overlay: Fix forgotten reference to of_overlay_apply() 2018-03-17 18:18:38 -05:00
pdt.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
platform.c ARM: SoC driver updates for 4.16 2018-02-01 16:35:31 -08:00
property.c device property: Constify device_get_match_data() 2018-02-12 10:41:11 +01:00
resolver.c of: cache phandle nodes to reduce cost of of_find_node_by_phandle() 2018-03-07 14:50:09 -06:00
unittest.c of: unittest: fix an error code in of_unittest_apply_overlay() 2018-03-19 22:52:40 -05:00