1SHELL = /bin/bash 2 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). 15unexport MAKEFILE_LIST 16 17.PHONY: all 18all: 19 20.PHONY: mem_usage 21mem_usage: 22 23# log and load eventual tee config file 24# path is absolute or relative to current source root directory. 25ifdef CFG_OPTEE_CONFIG 26$(info Loading OPTEE configuration file $(CFG_OPTEE_CONFIG)) 27include $(CFG_OPTEE_CONFIG) 28endif 29 30# If $(PLATFORM) is defined and contains a hyphen, parse it as 31# $(PLATFORM)-$(PLATFORM_FLAVOR) for convenience 32ifneq (,$(findstring -,$(PLATFORM))) 33ops := $(join PLATFORM PLATFORM_FLAVOR,$(addprefix =,$(subst -, ,$(PLATFORM)))) 34$(foreach op,$(ops),$(eval override $(op))) 35endif 36 37# Make these default for now 38ARCH ?= arm 39PLATFORM ?= vexpress 40# Default value for PLATFORM_FLAVOR is set in plat-$(PLATFORM)/conf.mk 41ifeq ($O,) 42O := out 43out-dir := $(O)/$(ARCH)-plat-$(PLATFORM) 44else 45out-dir := $(O) 46endif 47 48arch_$(ARCH) := y 49 50ifneq ($V,1) 51q := @ 52cmd-echo := true 53cmd-echo-silent := echo 54else 55q := 56cmd-echo := echo 57cmd-echo-silent := true 58endif 59 60ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 61ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) 62cmd-echo-silent := true 63endif 64else # make-3.8x 65ifneq ($(findstring s, $(MAKEFLAGS)),) 66cmd-echo-silent := true 67endif 68endif 69 70 71include core/core.mk 72 73# Platform config is supposed to assign the targets 74ta-targets ?= user_ta 75 76ifeq ($(CFG_WITH_USER_TA),y) 77define build-ta-target 78ta-target := $(1) 79include ta/ta.mk 80endef 81$(foreach t, $(ta-targets), $(eval $(call build-ta-target, $(t)))) 82endif 83 84include mk/cleandirs.mk 85 86.PHONY: clean 87clean: 88 @$(cmd-echo-silent) ' CLEAN $(out-dir)' 89 $(call do-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 93 94.PHONY: cscope 95cscope: 96 @echo ' CSCOPE .' 97 ${q}rm -f cscope.* 98 ${q}find $(PWD) -name "*.[chSs]" > cscope.files 99 ${q}cscope -b -q -k 100