xref: /openbmc/u-boot/dts/Makefile (revision 9fc2ed40)
1#
2# Copyright (c) 2011 The Chromium OS Authors.
3#
4# SPDX-License-Identifier:	GPL-2.0+
5#
6
7# This Makefile builds the internal U-Boot fdt if CONFIG_OF_CONTROL is
8# enabled. See doc/README.fdt-control for more details.
9
10DEVICE_TREE ?= $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
11ifeq ($(DEVICE_TREE),)
12DEVICE_TREE := unset
13endif
14
15DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
16
17quiet_cmd_copy = COPY    $@
18      cmd_copy = cp $< $@
19
20$(obj)/dt.dtb: $(DTB) FORCE
21	$(call if_changed,copy)
22
23targets += dt.dtb
24
25$(DTB): arch-dtbs
26	$(Q)test -e $@ || (						\
27	echo >&2;							\
28	echo >&2 "Device Tree Source is not correctly specified.";	\
29	echo >&2 "Please define 'CONFIG_DEFAULT_DEVICE_TREE'";		\
30	echo >&2 "or build with 'DEVICE_TREE=<device_tree>' argument";	\
31	echo >&2;							\
32	/bin/false)
33
34arch-dtbs:
35	$(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
36
37.SECONDARY: $(obj)/dt.dtb.S
38
39obj-$(CONFIG_OF_EMBED) := dt.dtb.o
40
41dtbs: $(obj)/dt.dtb
42	@:
43
44clean-files := dt.dtb.S
45
46# Let clean descend into dts directories
47subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/sandbox/dts ../arch/x86/dts
48