3 # It can happen that a makefile calls us, which contains an 'export' directive
4 # or the '.EXPORT_ALL_VARIABLES:' special target. In this case, all the make
5 # variables are added to the environment for each line of the recipes, so that
6 # any sub-makefile can use them.
7 # We have observed this can cause issues such as 'Argument list too long'
8 # errors as the shell runs out of memory.
9 # Since this Makefile won't call any sub-makefiles, and since the commands do
10 # not expect to implicitely obtain any make variable from the environment, we
11 # can safely cancel this export mechanism. Unfortunately, it can't be done
12 # globally, only by name. Let's unexport MAKEFILE_LIST which is by far the
13 # biggest one due to our way of tracking dependencies and compile flags
14 # (we include many *.cmd and *.d files).
15 unexport MAKEFILE_LIST
23 # log and load eventual tee config file
24 # path is absolute or relative to current source root directory.
25 ifdef CFG_OPTEE_CONFIG
26 $(info Loading OPTEE configuration file $(CFG_OPTEE_CONFIG))
27 include $(CFG_OPTEE_CONFIG)
30 # If $(PLATFORM) is defined and contains a hyphen, parse it as
31 # $(PLATFORM)-$(PLATFORM_FLAVOR) for convenience
32 ifneq (,$(findstring -,$(PLATFORM)))
33 ops := $(join PLATFORM PLATFORM_FLAVOR,$(addprefix =,$(subst -, ,$(PLATFORM))))
34 $(foreach op,$(ops),$(eval override $(op)))
37 # Make these default for now
40 # Default value for PLATFORM_FLAVOR is set in plat-$(PLATFORM)/conf.mk
43 out-dir := $(O)/$(ARCH)-plat-$(PLATFORM)
53 cmd-echo-silent := echo
57 cmd-echo-silent := true
60 ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
61 ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
62 cmd-echo-silent := true
65 ifneq ($(findstring s, $(MAKEFLAGS)),)
66 cmd-echo-silent := true
73 # Platform config is supposed to assign the targets
76 ifeq ($(CFG_WITH_USER_TA),y)
77 define build-ta-target
81 $(foreach t, $(ta-targets), $(eval $(call build-ta-target, $(t))))
84 include mk/cleandirs.mk
88 @$(cmd-echo-silent) ' CLEAN $(out-dir)'
89 ${q}rm -f $(cleanfiles)
90 ${q}dirs="$(call cleandirs-for-rmdir)"; if [ "$$dirs" ]; then $(RMDIR) $$dirs; fi
91 @if [ "$(out-dir)" != "$(O)" ]; then $(cmd-echo-silent) ' CLEAN $(O)'; fi
92 ${q}if [ -d "$(O)" ]; then $(RMDIR) $(O); fi
98 ${q}find $(PWD) -name "*.[chSs]" > cscope.files