Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARC: [kbuild] Avoid DTB rebuilds if DTS are untouched

Currently, for every ARC kernel build I see the following:

--------------->8-----------------
DTB arch/arc/boot/dts/angel4.dtb.S
AS arch/arc/boot/dts/angel4.dtb.o
LD arch/arc/boot/dts/built-in.o
rm arch/arc/boot/dts/angel4.dtb.S <-- forces rebuild next iter
CHK kernel/config_data.h
--------------->8-----------------

This is because *.dts.S is intermediate file in dtb generation and is by
default deleted by make which needs a ".SECONDARY" hint to NOT do so.

This could have ideally been done in scripts/Makefile.lib - for benefit
of all, however .SECONDARY doesn't seem to work with wildcards.

Thanks to Stephen for suggesting .SECONDARY (vs .PRECIOUS) and making
that work using a non wildcard version in arch makefile.

Thanks to James Hogan for pointing out that *.dtb.S now needs to be
added to clean-files

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>

+3 -1
+3 -1
arch/arc/boot/dts/Makefile
··· 8 8 obj-y += $(builtindtb-y).dtb.o 9 9 targets += $(builtindtb-y).dtb 10 10 11 + .SECONDARY: $(obj)/$(builtindtb-y).dtb.S 12 + 11 13 dtbs: $(addprefix $(obj)/, $(builtindtb-y).dtb) 12 14 13 - clean-files := *.dtb 15 + clean-files := *.dtb *.dtb.S