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 17include mk/checkconf.mk 18 19.PHONY: all 20all: 21 22.PHONY: mem_usage 23mem_usage: 24 25# log and load eventual tee config file 26# path is absolute or relative to current source root directory. 27ifdef CFG_OPTEE_CONFIG 28$(info Loading OPTEE configuration file $(CFG_OPTEE_CONFIG)) 29include $(CFG_OPTEE_CONFIG) 30endif 31 32# If $(PLATFORM) is defined and contains a hyphen, parse it as 33# $(PLATFORM)-$(PLATFORM_FLAVOR) for convenience 34ifneq (,$(findstring -,$(PLATFORM))) 35ops := $(join PLATFORM PLATFORM_FLAVOR,$(addprefix =,$(subst -, ,$(PLATFORM)))) 36$(foreach op,$(ops),$(eval override $(op))) 37endif 38 39# Make these default for now 40$(call force,ARCH,arm) 41PLATFORM ?= vexpress 42# Default value for PLATFORM_FLAVOR is set in plat-$(PLATFORM)/conf.mk 43ifeq ($O,) 44O := out 45out-dir := $(O)/$(ARCH)-plat-$(PLATFORM) 46else 47out-dir := $(O) 48endif 49 50arch_$(ARCH) := y 51 52ifneq ($V,1) 53q := @ 54cmd-echo := true 55cmd-echo-silent := echo 56else 57q := 58cmd-echo := echo 59cmd-echo-silent := true 60endif 61 62ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 63ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) 64cmd-echo-silent := true 65endif 66else # make-3.8x 67ifneq ($(findstring s, $(MAKEFLAGS)),) 68cmd-echo-silent := true 69endif 70endif 71 72 73include core/core.mk 74 75# Platform/arch config is supposed to assign the targets 76ta-targets ?= invalid 77default-user-ta-target ?= $(firstword $(ta-targets)) 78 79ifeq ($(CFG_WITH_USER_TA),y) 80include ldelf/ldelf.mk 81define build-ta-target 82ta-target := $(1) 83include ta/ta.mk 84endef 85$(foreach t, $(ta-targets), $(eval $(call build-ta-target, $(t)))) 86 87# Build user TAs included in this git 88define build-user-ta 89ta-mk-file := $(1) 90include ta/mk/build-user-ta.mk 91endef 92$(foreach t, $(wildcard ta/*/user_ta.mk), $(eval $(call build-user-ta,$(t)))) 93endif 94 95include mk/cleandirs.mk 96 97.PHONY: clean 98clean: 99 @$(cmd-echo-silent) ' CLEAN $(out-dir)' 100 $(call do-rm-f, $(cleanfiles)) 101 ${q}dirs="$(call cleandirs-for-rmdir)"; if [ "$$dirs" ]; then $(RMDIR) $$dirs; fi 102 @if [ "$(out-dir)" != "$(O)" ]; then $(cmd-echo-silent) ' CLEAN $(O)'; fi 103 ${q}if [ -d "$(O)" ]; then $(RMDIR) $(O); fi 104 105.PHONY: cscope 106cscope: 107 @echo ' CSCOPE .' 108 ${q}rm -f cscope.* 109 ${q}find $(PWD) -name "*.[chSs]" | grep -v export-ta_ > cscope.files 110 ${q}cscope -b -q -k 111 112.PHONY: checkpatch checkpatch-staging checkpatch-working 113checkpatch: checkpatch-staging checkpatch-working 114 115checkpatch-working: 116 ${q}./scripts/checkpatch.sh 117 118checkpatch-staging: 119 ${q}./scripts/checkpatch.sh --cached 120