xref: /optee_os/Makefile (revision 59c2b6bfacf82fe5066931f45beae153bfac8c6f)
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
41O		?= out/$(ARCH)-plat-$(PLATFORM)
42
43arch_$(ARCH)	:= y
44
45ifneq ($O,)
46out-dir := $O
47endif
48
49ifneq ($V,1)
50q := @
51cmd-echo := true
52cmd-echo-silent := echo
53else
54q :=
55cmd-echo := echo
56cmd-echo-silent := true
57endif
58
59ifneq ($(filter 4.%,$(MAKE_VERSION)),)  # make-4
60ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
61cmd-echo-silent := true
62endif
63else                                    # make-3.8x
64ifneq ($(findstring s, $(MAKEFLAGS)),)
65cmd-echo-silent := true
66endif
67endif
68
69
70include core/core.mk
71
72# Platform config is supposed to assign the targets
73ta-targets ?= user_ta
74
75ifeq ($(CFG_WITH_USER_TA),y)
76define build-ta-target
77ta-target := $(1)
78include ta/ta.mk
79endef
80$(foreach t, $(ta-targets), $(eval $(call build-ta-target, $(t))))
81endif
82
83.PHONY: clean
84clean:
85	@$(cmd-echo-silent) '  CLEAN   .'
86	${q}rm -f $(cleanfiles)
87
88.PHONY: cscope
89cscope:
90	@echo '  CSCOPE  .'
91	${q}rm -f cscope.*
92	${q}find $(PWD) -name "*.[chSs]" > cscope.files
93	${q}cscope -b -q -k
94