Makefile 1.55 KB
Newer Older
1 2 3
#
# Copyright (c) 2011 The Chromium OS Authors.
#
4
# SPDX-License-Identifier:	GPL-2.0+
5 6 7 8 9
#

# This Makefile builds the internal U-Boot fdt if CONFIG_OF_CONTROL is
# enabled. See doc/README.fdt-control for more details.

10 11
DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
ifeq ($(DEVICE_TREE),)
12
DEVICE_TREE := unset
13
endif
14

15 16 17
ARCH_PATH := arch/$(ARCH)/dts
dtb_depends := arch-dtbs

18 19
ifneq ($(EXT_DTB),)
DTB := $(EXT_DTB)
20
else
21 22
DTB := $(ARCH_PATH)/$(DEVICE_TREE).dtb
dtb_depends += $(DTB:.dtb=.dts)
23
endif
24

25 26 27
$(obj)/dt-spl.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
	$(call if_changed,fdtgrep)

28
$(obj)/dt.dtb: $(DTB) FORCE
29
	$(call if_changed,shipped)
30

31
targets += dt.dtb dt-spl.dtb
32

33 34 35 36
$(DTB): $(dtb_depends)
ifeq ($(EXT_DTB),)
	$(Q)$(MAKE) $(build)=$(ARCH_PATH) $@
endif
37 38 39 40 41 42 43 44 45
	$(Q)test -e $@ || (						\
	echo >&2;							\
	echo >&2 "Device Tree Source is not correctly specified.";	\
	echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'";		\
	echo >&2 "or build with 'DEVICE_TREE=<device_tree>' argument";	\
	echo >&2;							\
	/bin/false)

arch-dtbs:
46
	$(Q)$(MAKE) $(build)=$(ARCH_PATH) dtbs
47

48
.SECONDARY: $(obj)/dt.dtb.S $(obj)/dt-spl.dtb.S
49

50 51 52 53 54 55 56

ifeq ($(CONFIG_SPL_BUILD),y)
obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
# support "out-of-tree" build for dtb-spl
$(obj)/dt-spl.dtb.o: $(obj)/dt-spl.dtb.S FORCE
	$(call if_changed_dep,as_o_S)
else
57
obj-$(CONFIG_OF_EMBED) := dt.dtb.o
58
endif
59

60
dtbs: $(obj)/dt.dtb $(obj)/dt-spl.dtb
61
	@:
62

63
clean-files := dt.dtb.S dt-spl.dtb.S
64 65

# Let clean descend into dts directories
66
subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts