5 MAKEFLAGS += -rR --no-print-directory
7 ALL_ARCHES := $(patsubst src/%,%,$(wildcard src/*))
10 all: $(foreach i,$(ALL_ARCHES),all_$(i))
13 clean: $(foreach i,$(ALL_ARCHES),clean_$(i))
16 # o use make's built-in rules and variables
17 # (this increases performance and avoids hard-to-debug behaviour);
18 # o print "Entering directory ...";
19 MAKEFLAGS += -rR --no-print-directory
21 # To put more focus on warnings, be less verbose as default
22 # Use 'make V=1' to see the full commands
24 ifeq ("$(origin V)", "command line")
32 # ---------------------------------------------------------------------------
34 # Normally, we echo the whole command before executing it. By making
35 # that echo $($(quiet)$(cmd)), we now have the possibility to set
36 # $(quiet) to choose other forms of output instead, e.g.
38 # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
39 # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
41 # If $(quiet) is empty, the whole command will be printed.
42 # If it is set to "quiet_", only the short version will be printed.
43 # If it is set to "silent_", nothing will be printed at all, since
44 # the variable $(silent_cmd_cc_o_c) doesn't exist.
46 # A simple variant is to prefix commands with $(Q) - that's useful
47 # for commands that shall be hidden in non-verbose mode.
51 # If KBUILD_VERBOSE equals 0 then the above command will be hidden.
52 # If KBUILD_VERBOSE equals 1 then the above command is displayed.
54 ifeq ($(KBUILD_VERBOSE),1)
62 # If the user is running make -s (silent mode), suppress echoing of
65 ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
66 ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
70 ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
75 export quiet Q KBUILD_VERBOSE
78 $(Q)$(MAKE) ARCH=$* all_arch
81 $(Q)$(MAKE) ARCH=$* clean_arch
85 ALL_DTS := $(shell find src/* -name \*.dts)
87 ALL_DTB := $(patsubst %.dts,%.dtb,$(ALL_DTS))
89 $(ALL_DTB): ARCH=$(word 2,$(subst /, ,$@))
91 $(Q)$(MAKE) ARCH=$(ARCH) $@
95 ARCH_DTS := $(shell find src/$(ARCH) -name \*.dts)
97 ARCH_DTB := $(patsubst %.dts,%.dtb,$(ARCH_DTS))
102 include scripts/Kbuild.include
104 cmd_files := $(wildcard $(foreach f,$(ARCH_DTB),$(dir $(f)).$(notdir $(f)).cmd))
106 ifneq ($(cmd_files),)
110 quiet_cmd_clean = CLEAN $(obj)
111 cmd_clean = rm -f $(__clean-files)
113 dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
115 dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \
116 -Iinclude -I$(src) -Isrc -Itestcase-data \
119 quiet_cmd_dtc = DTC $@
120 cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
121 $(DTC) -O dtb -o $@ -b 0 \
122 -i $(src) $(DTC_FLAGS) \
123 -d $(depfile).dtc.tmp $(dtc-tmp) ; \
124 cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
126 $(obj)/%.dtb: $(src)/%.dts FORCE
127 $(call if_changed_dep,dtc)
130 all_arch: $(ARCH_DTB)
133 RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
134 -o -name .pc -o -name .hg -o -name .git \) -prune -o
137 clean_arch: __clean-files = $(ARCH_DTB)
140 @find . $(RCS_FIND_IGNORE) \
144 \) -type f -print | xargs rm -f
150 @echo " all: Build all device tree binaries for all architectures"
151 @echo " clean: Clean all generated files"
153 @echo " all_<ARCH>: Build all device tree binaries for <ARCH>"
154 @echo " clean_<ARCH>: Clean all generated files for <ARCH>"
156 @echo " src/<ARCH>/<DTS>.dtb Build a single device tree binary"
158 @echo "Architectures: $(ALL_ARCHES)"