blob: 33f434f7056542230a4096e03e162d7d0c083703 [file] [log] [blame]
Pascal Brandb0104772014-06-12 15:56:20 +02001SHELL = /bin/bash
2
Jerome Forissier80b563f2016-12-02 17:54:52 +01003# 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
Pascal Brandb0104772014-06-12 15:56:20 +020017.PHONY: all
18all:
19
Jens Wiklander29f1a452014-08-29 08:26:57 +020020.PHONY: mem_usage
21mem_usage:
22
etienne carrieredde0e232015-02-26 10:29:27 +010023# 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
Jerome Forissier71767a52014-10-29 14:43:11 +010030# 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
Pascal Brandb0104772014-06-12 15:56:20 +020037# Make these default for now
Jens Wiklanderabe38972015-03-09 08:46:51 +010038ARCH ?= arm
Jerome Forissiera75f2e12015-07-07 19:07:50 +020039PLATFORM ?= vexpress
Jerome Forissier9fc53172016-08-23 11:20:21 +020040# Default value for PLATFORM_FLAVOR is set in plat-$(PLATFORM)/conf.mk
Pascal Brandb0104772014-06-12 15:56:20 +020041O ?= out/$(ARCH)-plat-$(PLATFORM)
42
43arch_$(ARCH) := y
44
Pascal Brandb0104772014-06-12 15:56:20 +020045ifneq ($O,)
Jerome Forissier4334e8d2014-09-08 10:53:42 +020046out-dir := $O
Pascal Brandb0104772014-06-12 15:56:20 +020047endif
48
49ifneq ($V,1)
50q := @
51cmd-echo := true
Jens Wiklander62428632015-04-29 15:05:19 +020052cmd-echo-silent := echo
Pascal Brandb0104772014-06-12 15:56:20 +020053else
54q :=
55cmd-echo := echo
Jens Wiklander62428632015-04-29 15:05:19 +020056cmd-echo-silent := true
Pascal Brandb0104772014-06-12 15:56:20 +020057endif
58
Jens Wiklander62428632015-04-29 15:05:19 +020059ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
60ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
61cmd-echo-silent := true
62endif
63else # make-3.8x
Pascal Brand3dc79b02015-05-28 14:02:47 +020064ifneq ($(findstring s, $(MAKEFLAGS)),)
Jens Wiklander62428632015-04-29 15:05:19 +020065cmd-echo-silent := true
66endif
67endif
68
69
Pascal Brandb0104772014-06-12 15:56:20 +020070include core/core.mk
71
Jens Wiklanderbc33bbd2015-11-11 14:08:26 +010072# Platform config is supposed to assign the targets
73ta-targets ?= user_ta
74
Jens Wiklander6fbac372015-11-05 14:22:05 +010075ifeq ($(CFG_WITH_USER_TA),y)
Jens Wiklanderbc33bbd2015-11-11 14:08:26 +010076define build-ta-target
77ta-target := $(1)
Pascal Brandb0104772014-06-12 15:56:20 +020078include ta/ta.mk
Jens Wiklanderbc33bbd2015-11-11 14:08:26 +010079endef
80$(foreach t, $(ta-targets), $(eval $(call build-ta-target, $(t))))
Jens Wiklander6fbac372015-11-05 14:22:05 +010081endif
Pascal Brandb0104772014-06-12 15:56:20 +020082
83.PHONY: clean
84clean:
Jens Wiklander62428632015-04-29 15:05:19 +020085 @$(cmd-echo-silent) ' CLEAN .'
Pascal Brandb0104772014-06-12 15:56:20 +020086 ${q}rm -f $(cleanfiles)
87
88.PHONY: cscope
89cscope:
Jerome Forissier0047cb62014-09-01 13:41:48 +020090 @echo ' CSCOPE .'
Pascal Brandb0104772014-06-12 15:56:20 +020091 ${q}rm -f cscope.*
92 ${q}find $(PWD) -name "*.[chSs]" > cscope.files
93 ${q}cscope -b -q -k