Skip to content

Commit a7f9241

Browse files
committed
kbuild: add %.dtb.S and %.dtb to 'targets' automatically
Another common pattern that consists of chained commands is to compile a DTB as binary data into the kernel image or a module. It is used in several places in the source tree. Support it in the core Makefile. $(call if_changed,dt_S_dtb) is more suitable than $(call cmd,dt_S_dtb) in case cmd_dt_S_dtb is changed in the future. Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Frank Rowand <[email protected]>
1 parent b23d1a2 commit a7f9241

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

drivers/of/unittest-data/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ obj-$(CONFIG_OF_OVERLAY) += overlay.dtb.o \
2121
overlay_bad_symbol.dtb.o \
2222
overlay_base.dtb.o
2323

24-
targets += $(foreach suffix, dtb dtb.S, $(patsubst %.dtb.o,%.$(suffix),$(obj-y)))
25-
2624
# enable creation of __symbols__ node
2725
DTC_FLAGS_overlay += -@
2826
DTC_FLAGS_overlay_bad_phandle += -@

scripts/Makefile.build

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,11 @@ targets := $(filter-out $(PHONY), $(targets))
544544
intermediate_targets = $(foreach sfx, $(2), \
545545
$(patsubst %$(strip $(1)),%$(sfx), \
546546
$(filter %$(strip $(1)), $(targets))))
547+
# %.dtb.o <- %.dtb.S <- %.dtb <- %.dts
547548
# %.lex.o <- %.lex.c <- %.l
548549
# %.tab.o <- %.tab.[ch] <- %.y
549-
targets += $(call intermediate_targets, .lex.o, .lex.c) \
550+
targets += $(call intermediate_targets, .dtb.o, .dtb.S .dtb) \
551+
$(call intermediate_targets, .lex.o, .lex.c) \
550552
$(call intermediate_targets, .tab.o, .tab.c .tab.h)
551553

552554
# Descending

scripts/Makefile.lib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ cmd_dt_S_dtb= \
279279
echo '.balign STRUCT_ALIGNMENT'; \
280280
) > $@
281281

282-
$(obj)/%.dtb.S: $(obj)/%.dtb
283-
$(call cmd,dt_S_dtb)
282+
$(obj)/%.dtb.S: $(obj)/%.dtb FORCE
283+
$(call if_changed,dt_S_dtb)
284284

285285
quiet_cmd_dtc = DTC $@
286286
cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \

0 commit comments

Comments
 (0)