mb/purism_librem_cnl/var/*: Drop redundant entries in overridetrees
[coreboot.git] / Makefile
blob4a87d2f54959395d6e05cf56e239d18f0710f2c7
1 ## SPDX-License-Identifier: BSD-3-Clause
3 ifneq ($(words $(CURDIR)),1)
4 $(error Error: Path to the main directory cannot contain spaces)
5 endif
6 top := $(CURDIR)
7 src := src
8 srck := $(top)/util/kconfig
9 obj ?= build
10 override obj := $(subst $(top)/,,$(abspath $(obj)))
11 xcompile ?= $(obj)/xcompile
12 objutil ?= $(obj)/util
13 objk := $(objutil)/kconfig
14 absobj := $(abspath $(obj))
16 additional-dirs :=
18 VBOOT_HOST_BUILD ?= $(abspath $(objutil)/vboot_lib)
20 COREBOOT_EXPORTS := COREBOOT_EXPORTS
21 COREBOOT_EXPORTS += top src srck obj objutil objk
23 DOTCONFIG ?= $(top)/.config
24 KCONFIG_CONFIG = $(DOTCONFIG)
25 KCONFIG_AUTOADS := $(obj)/cb-config.ads
26 KCONFIG_RUSTCCFG := $(obj)/cb-config.rustcfg
27 KCONFIG_AUTOHEADER := $(obj)/config.h
28 KCONFIG_AUTOCONFIG := $(obj)/auto.conf
29 KCONFIG_DEPENDENCIES := $(obj)/auto.conf.cmd
30 KCONFIG_SPLITCONFIG := $(obj)/config/
31 KCONFIG_TRISTATE := $(obj)/tristate.conf
32 KCONFIG_NEGATIVES := 1
33 KCONFIG_WERROR := 1
34 KCONFIG_WARN_UNKNOWN_SYMBOLS := 1
35 KCONFIG_PACKAGE := CB.Config
36 KCONFIG_MAKEFILE_REAL ?= $(objk)/Makefile.real
38 COREBOOT_EXPORTS += KCONFIG_CONFIG KCONFIG_AUTOHEADER KCONFIG_AUTOCONFIG
39 COREBOOT_EXPORTS += KCONFIG_DEPENDENCIES KCONFIG_SPLITCONFIG KCONFIG_TRISTATE
40 COREBOOT_EXPORTS += KCONFIG_NEGATIVES
41 ifeq ($(filter %config,$(MAKECMDGOALS)),)
42 COREBOOT_EXPORTS += KCONFIG_WERROR
43 endif
44 COREBOOT_EXPORTS += KCONFIG_WARN_UNKNOWN_SYMBOLS
45 COREBOOT_EXPORTS += KCONFIG_AUTOADS KCONFIG_PACKAGE
46 COREBOOT_EXPORTS += KCONFIG_RUSTCCFG
48 # Make does not offer a recursive wildcard function, so here's one:
49 rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
50 SYMLINK_LIST = $(call rwildcard,site-local/,symlink.txt)
53 # Directory containing the toplevel Makefile.mk
54 TOPLEVEL := .
56 CONFIG_SHELL := sh
57 KBUILD_DEFCONFIG := configs/defconfig
58 UNAME_RELEASE := $(shell uname -r)
59 HAVE_DOTCONFIG := $(wildcard $(DOTCONFIG))
60 HAVE_KCONFIG_MAKEFILE_REAL := $(wildcard $(KCONFIG_MAKEFILE_REAL))
61 MAKEFLAGS += -rR --no-print-directory
63 # Make is silent per default, but 'make V=1' will show all compiler calls.
64 Q:=@
65 ifneq ($(V),1)
66 ifneq ($(Q),)
67 .SILENT:
68 MAKEFLAGS += -s
69 quiet_errors := 2>/dev/null
70 endif
71 endif
73 # Disable implicit/built-in rules to make Makefile errors fail fast.
74 .SUFFIXES:
76 HOSTCFLAGS := -g
77 HOSTCXXFLAGS := -g
79 HOSTPKG_CONFIG ?= pkg-config
80 COREBOOT_EXPORTS += HOSTPKG_CONFIG
82 PREPROCESS_ONLY := -E -P -x assembler-with-cpp -undef -I .
84 export $(COREBOOT_EXPORTS)
86 all: real-all
88 help_coreboot help::
89 @echo '*** coreboot platform targets ***'
90 @echo ' Use "make [target] V=1" for extra build debug information'
91 @echo ' all - Build coreboot'
92 @echo ' clean - Remove coreboot build artifacts'
93 @echo ' distclean - Remove build artifacts and config files'
94 @echo ' sphinx - Build sphinx documentation for coreboot'
95 @echo ' sphinx-lint - Build sphinx documentation for coreboot with warnings as errors'
96 @echo ' filelist - Show files used in current build'
97 @echo ' printall - print makefile info for debugging'
98 @echo ' gitconfig - set up git to submit patches to coreboot'
99 @echo ' ctags / ctags-project - make ctags file for all of coreboot or current board'
100 @echo ' cscope / cscope-project - make cscope.out file for coreboot or current board'
101 @echo
103 # This include must come _before_ the pattern rules below!
104 # Order _does_ matter for pattern rules.
105 include $(srck)/Makefile.mk
107 # The cases where we don't need fully populated $(obj) lists:
108 # 1. when no .config exists
109 # 2. When no $(obj)/util/kconfig/Makefile.real exists and we're building tools
110 # 3. when make config (in any flavour) is run
111 # 4. when make distclean is run
112 # Don't waste time on reading all Makefile.incs in these cases
113 ifeq ($(strip $(HAVE_DOTCONFIG)),)
114 NOCOMPILE:=1
115 endif
116 ifeq ($(strip $(HAVE_KCONFIG_MAKEFILE_REAL)),)
117 ifneq ($(MAKECMDGOALS),tools)
118 NOCOMPILE:=1
119 endif
120 endif
121 ifneq ($(MAKECMDGOALS),)
122 ifneq ($(filter %config %clean cross% clang iasl lint% help% what-jenkins-does,$(MAKECMDGOALS)),)
123 NOCOMPILE:=1
124 endif
125 ifneq ($(filter %clean lint% help% what-jenkins-does,$(MAKECMDGOALS)),)
126 NOMKDIR:=1
127 UNIT_TEST:=1
128 endif
129 endif
131 ifneq ($(filter help%, $(MAKECMDGOALS)), )
132 NOCOMPILE:=1
133 UNIT_TEST:=1
134 else
135 ifneq ($(filter %-test %-tests %coverage-report, $(MAKECMDGOALS)),)
136 ifneq ($(filter-out %-test %-tests %coverage-report, $(MAKECMDGOALS)),)
137 $(error Cannot mix unit-tests targets with other targets)
138 endif
139 UNIT_TEST:=1
140 NOCOMPILE:=
141 endif
142 endif
144 $(xcompile): util/xcompile/xcompile
145 rm -f $@
146 $< $(XGCCPATH) > $@.tmp
147 \mv -f $@.tmp $@ 2> /dev/null
148 rm -f $@.tmp
150 ifeq ($(NOCOMPILE),1)
151 # We also don't use .xcompile in the no-compile situations, so
152 # provide some reasonable defaults.
153 HOSTCC ?= $(if $(shell type gcc 2>/dev/null),gcc,cc)
154 HOSTCXX ?= g++
156 include $(TOPLEVEL)/Makefile.mk
157 include $(TOPLEVEL)/payloads/Makefile.mk
158 include $(TOPLEVEL)/util/testing/Makefile.mk
159 -include $(TOPLEVEL)/site-local/Makefile.mk
160 -include $(TOPLEVEL)/site-local/Makefile.inc
161 include $(TOPLEVEL)/tests/Makefile.mk
162 printall real-all:
163 @echo "Error: Trying to build, but NOCOMPILE is set." >&2
164 @echo " Please file a bug with the following information:"
165 @echo "- MAKECMDGOALS: $(MAKECMDGOALS)" >&2
166 @echo "- HAVE_DOTCONFIG: $(HAVE_DOTCONFIG)" >&2
167 @echo "- HAVE_KCONFIG_MAKEFILE_REAL: $(HAVE_KCONFIG_MAKEFILE_REAL)" >&2
168 @exit 1
170 else
172 ifneq ($(UNIT_TEST),1)
173 include $(DOTCONFIG)
174 endif
176 # The toolchain requires xcompile to determine the ARCH_SUPPORTED, so we can't
177 # wait for make to generate the file.
178 $(if $(wildcard $(xcompile)),, $(shell \
179 mkdir -p $(dir $(xcompile)) && \
180 util/xcompile/xcompile $(XGCCPATH) > $(xcompile) || rm -f $(xcompile)))
182 include $(xcompile)
184 ifneq ($(XCOMPILE_COMPLETE),1)
185 $(shell rm -f $(xcompile))
186 $(error $(xcompile) deleted because it's invalid. \
187 Restarting the build should fix that, or explain the problem)
188 endif
190 # reproducible builds
191 LANG:=C
192 LC_ALL:=C
193 TZ:=UTC0
194 ifneq ($(NOCOMPILE),1)
195 SOURCE_DATE_EPOCH := $(shell $(top)/util/genbuild_h/genbuild_h.sh . | sed -n 's/^.define COREBOOT_BUILD_EPOCH\>.*"\(.*\)".*/\1/p')
196 endif
197 # don't use COREBOOT_EXPORTS to ensure build steps outside the coreboot build system
198 # are reproducible
199 export LANG LC_ALL TZ SOURCE_DATE_EPOCH
201 ifneq ($(UNIT_TEST),1)
202 include toolchain.mk
203 endif
205 strip_quotes = $(strip $(subst ",,$(subst \",,$(1))))
206 # fix makefile syntax highlighting after strip macro \" "))
208 ifneq ($(NOCOMPILE),1)
209 $(shell rm -f $(CCACHE_STATSLOG))
210 endif
212 # The primary target needs to be here before we include the
213 # other files
215 real-all: real-target
217 # must come rather early
218 .SECONDARY:
219 .SECONDEXPANSION:
220 .DELETE_ON_ERROR:
222 $(KCONFIG_AUTOHEADER): $(KCONFIG_CONFIG) $(objutil)/kconfig/conf
223 $(MAKE) olddefconfig
224 $(MAKE) syncconfig
226 $(KCONFIG_AUTOCONFIG): $(KCONFIG_AUTOHEADER)
227 true
229 $(KCONFIG_AUTOADS): $(KCONFIG_CONFIG) $(KCONFIG_AUTOHEADER) $(objutil)/kconfig/toada
230 $(objutil)/kconfig/toada CB.Config <$< >$@
232 $(obj)/%/$(notdir $(KCONFIG_AUTOADS)): $(KCONFIG_AUTOADS)
233 cp $< $@
235 # Add a new class of source/object files to the build system
236 add-class= \
237 $(eval $(1)-srcs:=) \
238 $(eval $(1)-objs:=) \
239 $(eval classes+=$(1))
241 # Special classes are managed types with special behaviour
242 # On parse time, for each entry in variable $(1)-y
243 # a handler $(1)-handler is executed with the arguments:
244 # * $(1): directory the parser is in
245 # * $(2): current entry
246 add-special-class= \
247 $(eval $(1):=) \
248 $(eval special-classes+=$(1))
250 # Converts one or more source file paths to their corresponding build/ paths.
251 # Only .ads, adb, .c and .S get converted to .o, other files (like .ld) keep
252 # their name.
253 # $1 stage name
254 # $2 file path (list)
255 src-to-obj=\
256 $(patsubst $(obj)/%,$(obj)/$(1)/%,\
257 $(patsubst $(obj)/$(1)/%,$(obj)/%,\
258 $(patsubst 3rdparty/%,$(obj)/%,\
259 $(patsubst src/%,$(obj)/%,\
260 $(patsubst %.ads,%.o,\
261 $(patsubst %.adb,%.o,\
262 $(patsubst %.c,%.o,\
263 $(patsubst %.S,%.o,\
264 $(subst .$(1),,$(2))))))))))
266 # Converts one or more source file paths to the corresponding build/ paths
267 # of their Ada library information (.ali) files.
268 # $1 stage name
269 # $2 file path (list)
270 src-to-ali=\
271 $(patsubst $(obj)/%,$(obj)/$(1)/%,\
272 $(patsubst $(obj)/$(1)/%,$(obj)/%,\
273 $(patsubst 3rdparty/%,$(obj)/%,\
274 $(patsubst src/%,$(obj)/%,\
275 $(patsubst %.ads,%.ali,\
276 $(patsubst %.adb,%.ali,\
277 $(subst .$(1),,\
278 $(filter %.ads %.adb,$(2)))))))))
280 # Clean -y variables, include Makefile.mk & Makefile.inc
281 # Add paths to files in X-y to X-srcs
282 # Add subdirs-y to subdirs
283 includemakefiles= \
284 $(if $(wildcard $(1)), \
285 $(foreach class,classes subdirs $(classes) $(special-classes), $(eval $(class)-y:=)) \
286 $(eval -include $(1)) \
287 $(foreach class,$(classes-y), $(call add-class,$(class))) \
288 $(foreach special,$(special-classes), \
289 $(foreach item,$($(special)-y), $(call $(special)-handler,$(dir $(1)),$(item)))) \
290 $(foreach class,$(classes), \
291 $(eval $(class)-srcs+= \
292 $$(subst $(absobj)/,$(obj)/, \
293 $$(subst $(top)/,, \
294 $$(abspath $$(subst $(dir $(1))/,/,$$(addprefix $(dir $(1)),$$($(class)-y)))))))) \
295 $(eval subdirs+=$$(subst $(CURDIR)/,,$$(wildcard $$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y)))))))
297 # For each path in $(subdirs) call includemakefiles
298 # Repeat until subdirs is empty
299 # TODO: Remove Makefile.inc support
300 evaluate_subdirs= \
301 $(eval cursubdirs:=$(subdirs)) \
302 $(eval subdirs:=) \
303 $(foreach dir,$(cursubdirs), \
304 $(eval $(call includemakefiles,$(dir)/Makefile.mk))) \
305 $(foreach dir,$(cursubdirs), \
306 $(eval $(call includemakefiles,$(dir)/Makefile.inc))) \
307 $(if $(subdirs),$(eval $(call evaluate_subdirs)))
309 # collect all object files eligible for building
310 subdirs:=$(TOPLEVEL)
311 postinclude-hooks :=
313 # Don't iterate through Makefiles under src/ when building tests
314 ifneq ($(UNIT_TEST),1)
315 $(eval $(call evaluate_subdirs))
316 else
317 include $(TOPLEVEL)/tests/Makefile.mk
318 endif
320 ifeq ($(FAILBUILD),1)
321 $(error cannot continue build)
322 endif
324 # Run hooks registered by subdirectories that need to be evaluated after all files have been parsed
325 $(eval $(postinclude-hooks))
327 # Eliminate duplicate mentions of source files in a class
328 $(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs))))
330 ifeq ($(CONFIG_IWYU),y)
331 MAKEFLAGS += -k
332 SAVE_IWYU_OUTPUT := 2>&1 | grep "should\|\#include\|---\|include-list\|^[[:blank:]]\?\'" | tee -a $$(obj)/iwyu.txt
333 endif
335 # Build Kconfig .ads if necessary
336 ifeq ($(CONFIG_ROMSTAGE_ADA),y)
337 romstage-srcs += $(obj)/romstage/$(notdir $(KCONFIG_AUTOADS))
338 endif
339 ifeq ($(CONFIG_RAMSTAGE_ADA),y)
340 ramstage-srcs += $(obj)/ramstage/$(notdir $(KCONFIG_AUTOADS))
341 endif
343 # To track dependencies, we need all Ada specification (.ads) files in
344 # *-srcs. Extract / filter all specification files that have a matching
345 # body (.adb) file here (specifications without a body are valid sources
346 # in Ada).
347 $(foreach class,$(classes),$(eval $(class)-extra-specs := \
348 $(filter \
349 $(addprefix %/,$(patsubst %.adb,%.ads,$(notdir $(filter %.adb,$($(class)-srcs))))), \
350 $(filter %.ads,$($(class)-srcs)))))
351 $(foreach class,$(classes),$(eval $(class)-srcs := \
352 $(filter-out $($(class)-extra-specs),$($(class)-srcs))))
354 $(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class),$($(class)-srcs))))
355 $(foreach class,$(classes),$(eval $(class)-alis:=$(call src-to-ali,$(class),$($(class)-srcs))))
357 # For Ada includes
358 $(foreach class,$(classes),$(eval $(class)-ada-dirs:=$(sort $(dir $(filter %.ads %.adb,$($(class)-srcs)) $($(class)-extra-specs)))))
360 # Save all objs before processing them (for dependency inclusion)
361 originalobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var)))
363 # Call post-processors if they're defined
364 $(foreach class,$(classes),\
365 $(if $(value $(class)-postprocess),$(eval $(call $(class)-postprocess,$($(class)-objs)))))
367 allsrcs:=$(foreach var, $(addsuffix -srcs,$(classes)), $($(var)))
368 allobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var)))
369 alldirs:=$(sort $(abspath $(dir $(allobjs))))
371 # Reads dependencies from an Ada library information (.ali) file
372 # Only basenames (with suffix) are preserved so we have to look the
373 # paths up in $($(stage)-srcs).
374 # $1 stage name
375 # $2 ali file
376 create_ada_deps=$$(if $(2),\
377 gnat.adc \
378 $$(filter \
379 $$(addprefix %/,$$(shell sed -ne's/^D \([^\t]\+\).*$$$$/\1/p' $(2) 2>/dev/null)), \
380 $$($(1)-srcs) $$($(1)-extra-specs)))
382 # macro to define template macros that are used by use_template macro
383 define create_cc_template
384 # $1 obj class
385 # $2 source suffix (c, S, ld, ...)
386 # $3 additional compiler flags
387 # $4 additional dependencies
388 ifn$(EMPTY)def $(1)-objs_$(2)_template
389 de$(EMPTY)fine $(1)-objs_$(2)_template
390 ifn$(EMPTY)eq ($(filter ads adb,$(2)),)
391 $$(call src-to-obj,$1,$$(1).$2): $$(1).$2 $$(call create_ada_deps,$1,$$(call src-to-ali,$1,$$(1).$2)) $(4)
392 @printf " GCC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
393 $(GCC_$(1)) \
394 $$$$(ADAFLAGS_$(1)) $$$$(addprefix -I,$$$$($(1)-ada-dirs)) \
395 $(3) -c -o $$$$@ $$$$<
396 el$(EMPTY)se
397 $$(call src-to-obj,$1,$$(1).$2): $$(1).$2 $(KCONFIG_AUTOHEADER) $(4)
398 @printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
399 $(CC_$(1)) \
400 -MMD $$$$(CPPFLAGS_$(1)) $$$$(CFLAGS_$(1)) -MT $$$$(@) \
401 $(3) -c -o $$$$@ $$$$< $(SAVE_IWYU_OUTPUT)
402 end$(EMPTY)if
403 en$(EMPTY)def
404 end$(EMPTY)if
405 endef
407 filetypes-of-class=$(subst .,,$(sort $(suffix $($(1)-srcs))))
408 $(foreach class,$(classes), \
409 $(foreach type,$(call filetypes-of-class,$(class)), \
410 $(eval $(class)-$(type)-ccopts += $(generic-$(type)-ccopts) $($(class)-generic-ccopts)) \
411 $(if $(generic-objs_$(type)_template_gen),$(eval $(call generic-objs_$(type)_template_gen,$(class))),\
412 $(eval $(call create_cc_template,$(class),$(type),$($(class)-$(type)-ccopts),$($(class)-$(type)-deps))))))
414 foreach-src=$(foreach file,$($(1)-srcs),$(eval $(call $(1)-objs_$(subst .,,$(suffix $(file)))_template,$(basename $(file)))))
415 $(eval $(foreach class,$(classes),$(call foreach-src,$(class))))
417 # To supported complex package initializations, we need to call the
418 # emitted code explicitly. gnatbind gathers all the calls for us
419 # and exports them as a procedure $(stage)_adainit(). Every stage that
420 # uses Ada code has to call it!
421 define gnatbind_template
422 # $1 class
423 $$(obj)/$(1)/b__$(1).adb: $$$$(filter-out $$(obj)/$(1)/b__$(1).ali,$$$$($(1)-alis))
424 @printf " BIND $$(subst $$(obj)/,,$$@)\n"
425 # We have to give gnatbind a simple filename (without leading
426 # path components) so just cd there.
427 cd $$(dir $$@) && \
428 $$(GNATBIND_$(1)) -a -n \
429 --RTS=$$(absobj)/libgnat-$$(ARCH-$(1)-y)/ \
430 -L$(1)_ada -o $$(notdir $$@) \
431 $$(subst $$(dir $$@),,$$^)
432 $$(obj)/$(1)/b__$(1).o: $$(obj)/$(1)/b__$(1).adb
433 @printf " GCC $$(subst $$(obj)/,,$$@)\n"
434 $(GCC_$(1)) $$(ADAFLAGS_$(1)) -c -o $$@ $$<
435 $(1)-objs += $$(obj)/$(1)/b__$(1).o
436 $($(1)-alis): %.ali: %.o ;
437 endef
439 $(eval $(foreach class,$(filter-out libgnat-%,$(classes)), \
440 $(if $($(class)-alis),$(call gnatbind_template,$(class)))))
442 DEPENDENCIES += $(addsuffix .d,$(basename $(allobjs)))
443 -include $(DEPENDENCIES)
445 printall:
446 @$(foreach class,$(classes), echo $(class)-objs: $($(class)-objs) | tr ' ' '\n'; echo; )
447 @echo alldirs: $(alldirs) | tr ' ' '\n'; echo
448 @echo allsrcs: $(allsrcs) | tr ' ' '\n'; echo
449 @echo DEPENDENCIES: $(DEPENDENCIES) | tr ' ' '\n'; echo
450 @$(foreach class,$(special-classes),echo $(class):'$($(class))' | tr ' ' '\n'; echo; )
451 endif
453 ifndef NOMKDIR
454 $(shell mkdir -p $(KCONFIG_SPLITCONFIG) $(objk)/lxdialog $(additional-dirs) $(alldirs))
455 endif
457 $(obj)/project_filelist.txt:
458 if [ -z "$(wildcard $(obj)/coreboot.rom)" ]; then \
459 echo "*** Error: Project must be built before generating file list ***"; \
460 exit 1; \
462 find $(obj) -path "$(obj)/util" -prune -o -path "$(obj)/external" -prune -o -name "*.d" -exec cat {} \; | \
463 sed "s|$(top)/||" | sed 's/[:\\]/ /g' | sed 's/ /\n/g' | sort | uniq | \
464 grep -v '\.o$$' > $(obj)/project_filelist.txt
466 filelist: $(obj)/project_filelist.txt
467 printf "\nFiles used in build:\n"
468 cat $(obj)/project_filelist.txt
470 #works with either exuberant ctags or ctags.emacs
471 ctags-project: clean-ctags $(obj)/project_filelist.txt
472 cat $(obj)/project_filelist.txt | \
473 xargs ctags -o tags
475 cscope-project: clean-cscope $(obj)/project_filelist.txt
476 cat $(obj)/project_filelist.txt | xargs cscope -b
478 cscope:
479 cscope -bR
481 sphinx:
482 $(MAKE) -C Documentation sphinx
484 sphinx-lint:
485 $(MAKE) SPHINXOPTS=-W -C Documentation sphinx
487 symlink:
488 @echo "Creating Symbolic Links.."; \
489 for link in $(SYMLINK_LIST); do \
490 SYMLINK=`cat $$link`; \
491 REALPATH=`realpath $$link`; \
492 if [ -L "$$SYMLINK" ]; then \
493 continue; \
494 elif [ ! -e "$$SYMLINK" ]; then \
495 echo -e "\tLINK $$SYMLINK -> $$(dirname $$REALPATH)"; \
496 ln -s $$(dirname $$REALPATH) $$SYMLINK; \
497 else \
498 echo -e "\tFAILED: $$SYMLINK exists"; \
499 fi \
500 done
502 clean-symlink:
503 @echo "Deleting symbolic link";\
504 EXISTING_SYMLINKS=`find -L ./src -xtype l | grep -v 3rdparty`; \
505 for link in $$EXISTING_SYMLINKS; do \
506 echo -e "\tUNLINK $$link"; \
507 rm "$$link"; \
508 done
510 clean-for-update:
511 rm -rf $(obj) .xcompile
513 clean: clean-for-update clean-utils clean-payloads
514 rm -f .ccwrap
516 clean-cscope:
517 rm -f cscope.out
519 clean-ctags:
520 rm -f tags
522 clean-utils:
523 $(foreach tool, $(TOOLLIST), \
524 $(MAKE) -C util/$(tool) clean MFLAGS= MAKEFLAGS= ;)
526 distclean-utils:
527 $(foreach tool, $(TOOLLIST), \
528 $(MAKE) -C util/$(tool) distclean MFLAGS= MAKEFLAGS= ; \
529 rm -f /util/$(tool)/junit.xml;)
531 distclean: clean clean-ctags clean-cscope distclean-payloads distclean-utils
532 rm -f .config .config.old ..config.tmp* .kconfig.d .tmpconfig* .ccwrap .xcompile
533 rm -rf coreboot-builds coreboot-builds-chromeos
534 rm -f abuild*.xml junit.xml* util/lint/junit.xml
536 .PHONY: $(PHONY) clean clean-for-update clean-cscope cscope distclean sphinx sphinx-lint
537 .PHONY: ctags-project cscope-project clean-ctags symlink clean-symlink