blob: e699def70855ff38f9a50aacea72042b88a5d8ec [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001#
Antonio Nino Diaz9d7726c2019-03-19 10:59:11 +00002# Copyright (c) 2018-2019, Arm Limited. All rights reserved.
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7# TFTF Version
8VERSION_MAJOR := 2
Sandrine Bailleux1fc347d2019-03-20 13:58:28 +01009VERSION_MINOR := 1
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020010
11################################################################################
12# Default values for build configurations, and their dependencies
13################################################################################
14
15include defaults.mk
16
17PLAT := ${DEFAULT_PLAT}
18
19# Assertions enabled for DEBUG builds by default
20ENABLE_ASSERTIONS := ${DEBUG}
21
22################################################################################
23# Checkpatch script options
24################################################################################
25
26CHECKCODE_ARGS := --no-patch
27# Do not check the coding style on imported library files or documentation files
28INC_LIB_DIRS_TO_CHECK := $(sort $(filter-out \
Ambroise Vincenta2ede622019-02-11 14:34:26 +000029 include/lib/libc, \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020030 $(wildcard include/lib/*)))
31LIB_DIRS_TO_CHECK := $(sort $(filter-out \
32 lib/compiler-rt \
Ambroise Vincenta2ede622019-02-11 14:34:26 +000033 lib/libc, \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020034 $(wildcard lib/*)))
35ROOT_DIRS_TO_CHECK := $(sort $(filter-out \
36 lib \
37 include \
38 docs \
39 %.md \
40 %.rst, \
41 $(wildcard *)))
42CHECK_PATHS := ${ROOT_DIRS_TO_CHECK} \
43 ${INC_LIB_DIRS_TO_CHECK} \
44 ${LIB_DIRS_TO_CHECK}
45
46ifeq (${V},0)
47 Q=@
48else
49 Q=
50endif
51export Q
52
53ifneq (${DEBUG}, 0)
54 BUILD_TYPE := debug
55 # Use LOG_LEVEL_INFO by default for debug builds
56 LOG_LEVEL := 40
57else
58 BUILD_TYPE := release
59 # Use LOG_LEVEL_ERROR by default for release builds
60 LOG_LEVEL := 20
61endif
62
63# Default build string (git branch and commit)
64ifeq (${BUILD_STRING},)
65 BUILD_STRING := $(shell git log -n 1 --pretty=format:"%h")
66endif
67
68VERSION_STRING := v${VERSION_MAJOR}.${VERSION_MINOR}(${PLAT},${BUILD_TYPE}):${BUILD_STRING}
69
70BUILD_BASE := ./build
71BUILD_PLAT := ${BUILD_BASE}/${PLAT}/${BUILD_TYPE}
72
73PLAT_MAKEFILE := platform.mk
74# Generate the platforms list by recursively searching for all directories
75# under /plat containing a PLAT_MAKEFILE. Append each platform with a `|`
76# char and strip out the final '|'.
77PLATFORMS := $(shell find plat/ -name '${PLAT_MAKEFILE}' -print0 | \
78 sed -r 's%[^\x00]*\/([^/]*)\/${PLAT_MAKEFILE}\x00%\1|%g' | \
79 sed -r 's/\|$$//')
80
81# Convenience function for adding build definitions
82# $(eval $(call add_define,BAR_DEFINES,FOO)) will have:
83# -DFOO if $(FOO) is empty; -DFOO=$(FOO) otherwise
84# inside the BAR_DEFINES variable.
85define add_define
86$(1) += -D$(2)$(if $(value $(2)),=$(value $(2)),)
87endef
88
89# Convenience function for verifying option has a boolean value
90# $(eval $(call assert_boolean,FOO)) will assert FOO is 0 or 1
91define assert_boolean
92$(and $(patsubst 0,,$(value $(1))),$(patsubst 1,,$(value $(1))),$(error $(1) must be boolean))
93endef
94
95ifeq (${PLAT},)
96 $(error "Error: Unknown platform. Please use PLAT=<platform name> to specify the platform")
97endif
98PLAT_PATH := $(shell find plat/ -wholename '*/${PLAT}')
99PLAT_MAKEFILE_FULL := ${PLAT_PATH}/${PLAT_MAKEFILE}
100ifeq ($(wildcard ${PLAT_MAKEFILE_FULL}),)
101 $(error "Error: Invalid platform. The following platforms are available: ${PLATFORMS}")
102endif
103
104.PHONY: all
105all: msg_start
106
107.PHONY: msg_start
108msg_start:
109 @echo "Building ${PLAT}"
Sandrine Bailleux043d5362018-10-03 17:05:59 +0200110 @echo "Selected set of tests: ${TESTS}"
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200111
112# Include test images makefiles.
113include tftf/framework/framework.mk
114include tftf/tests/tests.mk
115include fwu/ns_bl1u/ns_bl1u.mk
116include fwu/ns_bl2u/ns_bl2u.mk
Antonio Nino Diaz9d7726c2019-03-19 10:59:11 +0000117include spm/cactus_mm/cactus_mm.mk
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200118include spm/cactus/cactus.mk
Antonio Nino Diaz0b1ab402018-12-05 15:38:39 +0000119include spm/ivy/ivy.mk
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200120
Ambroise Vincenta2ede622019-02-11 14:34:26 +0000121################################################################################
122# Include libc
123################################################################################
124include lib/libc/libc.mk
125
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200126# Include platform specific makefile last because:
127# - the platform makefile may use all previous definitions in this file.
128# - the platform makefile may wish overwriting some of them.
129include ${PLAT_MAKEFILE_FULL}
130
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200131.SUFFIXES:
132
133################################################################################
134# Build options checks
135################################################################################
136$(eval $(call assert_boolean,DEBUG))
137$(eval $(call assert_boolean,ENABLE_ASSERTIONS))
Antonio Nino Diaz2f13f422019-03-13 13:57:39 +0000138$(eval $(call assert_boolean,ENABLE_PAUTH))
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200139$(eval $(call assert_boolean,FIRMWARE_UPDATE))
140$(eval $(call assert_boolean,FWU_BL_TEST))
141$(eval $(call assert_boolean,NEW_TEST_SESSION))
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200142$(eval $(call assert_boolean,USE_NVM))
143
144################################################################################
145# Add definitions to the cpp preprocessor based on the current build options.
146# This is done after including the platform specific makefile to allow the
147# platform to overwrite the default options
148################################################################################
149$(eval $(call add_define,TFTF_DEFINES,ARM_ARCH_MAJOR))
150$(eval $(call add_define,TFTF_DEFINES,ARM_ARCH_MINOR))
151$(eval $(call add_define,TFTF_DEFINES,DEBUG))
152$(eval $(call add_define,TFTF_DEFINES,ENABLE_ASSERTIONS))
Antonio Nino Diaz2f13f422019-03-13 13:57:39 +0000153$(eval $(call add_define,TFTF_DEFINES,ENABLE_PAUTH))
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200154$(eval $(call add_define,TFTF_DEFINES,LOG_LEVEL))
155$(eval $(call add_define,TFTF_DEFINES,NEW_TEST_SESSION))
156$(eval $(call add_define,TFTF_DEFINES,PLAT_${PLAT}))
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200157$(eval $(call add_define,TFTF_DEFINES,USE_NVM))
158
159ifeq (${ARCH},aarch32)
160 $(eval $(call add_define,TFTF_DEFINES,AARCH32))
161else
162 $(eval $(call add_define,TFTF_DEFINES,AARCH64))
163endif
164
165################################################################################
166
167# Assembler, compiler and linker flags shared across all test images.
168COMMON_ASFLAGS :=
169COMMON_CFLAGS :=
170COMMON_LDFLAGS :=
171
172ifeq (${DEBUG},1)
173COMMON_CFLAGS += -g
174COMMON_ASFLAGS += -g -Wa,--gdwarf-2
175endif
176
Joel Hutton87530242019-04-08 15:46:36 +0100177# Set the compiler's target architecture profile based on ARM_ARCH_MINOR option
178ifeq (${ARM_ARCH_MINOR},0)
179march32-directive = -march=armv8-a
180march64-directive = -march=armv8-a
181else
182march32-directive = -march=armv8.${ARM_ARCH_MINOR}-a
183march64-directive = -march=armv8.${ARM_ARCH_MINOR}-a
184endif
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200185
Joel Hutton87530242019-04-08 15:46:36 +0100186COMMON_ASFLAGS_aarch64 := -mgeneral-regs-only ${march64-directive}
187COMMON_CFLAGS_aarch64 := -mgeneral-regs-only -mstrict-align ${march64-directive}
188
189COMMON_ASFLAGS_aarch32 := ${march32-directive}
190COMMON_CFLAGS_aarch32 := ${march32-directive} -mno-unaligned-access
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200191
192COMMON_ASFLAGS += -nostdinc -ffreestanding -Wa,--fatal-warnings \
193 -Werror -Wmissing-include-dirs \
Ambroise Vincenta2ede622019-02-11 14:34:26 +0000194 -D__ASSEMBLY__ $(COMMON_ASFLAGS_$(ARCH)) \
195 ${INCLUDES}
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200196COMMON_CFLAGS += -nostdinc -ffreestanding -Wall -Werror \
197 -Wmissing-include-dirs $(COMMON_CFLAGS_$(ARCH)) \
198 -std=gnu99 -Os
199COMMON_CFLAGS += -ffunction-sections -fdata-sections
200
201# Get the content of CFLAGS user defined value last so they are appended after
202# the options defined in the Makefile
Ambroise Vincenta2ede622019-02-11 14:34:26 +0000203COMMON_CFLAGS += ${CFLAGS} ${INCLUDES}
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200204
205COMMON_LDFLAGS += --fatal-warnings -O1 --gc-sections --build-id=none
206
207CC := ${CROSS_COMPILE}gcc
208CPP := ${CROSS_COMPILE}cpp
209AS := ${CROSS_COMPILE}gcc
210AR := ${CROSS_COMPILE}ar
211LD := ${CROSS_COMPILE}ld
212OC := ${CROSS_COMPILE}objcopy
213OD := ${CROSS_COMPILE}objdump
214NM := ${CROSS_COMPILE}nm
215PP := ${CROSS_COMPILE}gcc
216
217################################################################################
218
Ambroise Vincenta2ede622019-02-11 14:34:26 +0000219TFTF_SOURCES := ${FRAMEWORK_SOURCES} ${TESTS_SOURCES} ${PLAT_SOURCES} ${LIBC_SRCS}
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200220TFTF_INCLUDES += ${PLAT_INCLUDES}
221TFTF_CFLAGS += ${COMMON_CFLAGS}
222TFTF_ASFLAGS += ${COMMON_ASFLAGS}
223TFTF_LDFLAGS += ${COMMON_LDFLAGS}
224
Antonio Nino Diaz2f13f422019-03-13 13:57:39 +0000225ifeq (${ENABLE_PAUTH},1)
226TFTF_CFLAGS += -msign-return-address=non-leaf
227endif
228
Ambroise Vincenta2ede622019-02-11 14:34:26 +0000229NS_BL1U_SOURCES += ${PLAT_SOURCES} ${LIBC_SRCS}
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200230NS_BL1U_INCLUDES += ${PLAT_INCLUDES}
231NS_BL1U_CFLAGS += ${COMMON_CFLAGS}
232NS_BL1U_ASFLAGS += ${COMMON_ASFLAGS}
233NS_BL1U_LDFLAGS += ${COMMON_LDFLAGS}
234
Ambroise Vincenta2ede622019-02-11 14:34:26 +0000235NS_BL2U_SOURCES += ${PLAT_SOURCES} ${LIBC_SRCS}
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200236NS_BL2U_INCLUDES += ${PLAT_INCLUDES}
237NS_BL2U_CFLAGS += ${COMMON_CFLAGS}
238NS_BL2U_ASFLAGS += ${COMMON_ASFLAGS}
239NS_BL2U_LDFLAGS += ${COMMON_LDFLAGS}
240
Antonio Nino Diaz9d7726c2019-03-19 10:59:11 +0000241CACTUS_MM_SOURCES += ${LIBC_SRCS}
242CACTUS_MM_INCLUDES += ${PLAT_INCLUDES}
243CACTUS_MM_CFLAGS += ${COMMON_CFLAGS}
244CACTUS_MM_ASFLAGS += ${COMMON_ASFLAGS}
245CACTUS_MM_LDFLAGS += ${COMMON_LDFLAGS}
246
Ambroise Vincenta2ede622019-02-11 14:34:26 +0000247CACTUS_SOURCES += ${LIBC_SRCS}
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200248CACTUS_INCLUDES += ${PLAT_INCLUDES}
249CACTUS_CFLAGS += ${COMMON_CFLAGS}
250CACTUS_ASFLAGS += ${COMMON_ASFLAGS}
251CACTUS_LDFLAGS += ${COMMON_LDFLAGS}
252
Ambroise Vincenta2ede622019-02-11 14:34:26 +0000253IVY_SOURCES += ${LIBC_SRCS}
Antonio Nino Diaz0b1ab402018-12-05 15:38:39 +0000254IVY_INCLUDES += ${PLAT_INCLUDES}
255IVY_CFLAGS += ${COMMON_CFLAGS}
256IVY_ASFLAGS += ${COMMON_ASFLAGS}
257IVY_LDFLAGS += ${COMMON_LDFLAGS}
258
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200259.PHONY: locate-checkpatch
260locate-checkpatch:
261ifndef CHECKPATCH
262 $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/script/checkpatch.pl")
263else
264ifeq (,$(wildcard ${CHECKPATCH}))
265 $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/script/checkpatch.pl")
266endif
267endif
268
269.PHONY: clean
270clean:
271 @echo " CLEAN"
272 ${Q}rm -rf ${BUILD_PLAT}
273 ${MAKE} -C el3_payload clean
274
275.PHONY: realclean distclean
276realclean distclean:
277 @echo " REALCLEAN"
278 ${Q}rm -rf ${BUILD_BASE}
279 ${Q}rm -f ${CURDIR}/cscope.*
280 ${MAKE} -C el3_payload distclean
281
282.PHONY: checkcodebase
283checkcodebase: locate-checkpatch
284 @echo " CHECKING STYLE"
285 @if test -d .git ; then \
Ambroise Vincenta2ede622019-02-11 14:34:26 +0000286 git ls-files | grep -E -v 'libc|docs|\.md|\.rst' | \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200287 while read GIT_FILE ; \
288 do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \
289 done ; \
290 else \
291 find . -type f -not -iwholename "*.git*" \
292 -not -iwholename "*build*" \
Ambroise Vincenta2ede622019-02-11 14:34:26 +0000293 -not -iwholename "*libc*" \
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200294 -not -iwholename "*docs*" \
295 -not -iwholename "*.md" \
296 -not -iwholename "*.rst" \
297 -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \
298 fi
299
300.PHONY: checkpatch
301checkpatch: locate-checkpatch
302 @echo " CHECKING STYLE"
303 ${Q}COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \
304 for commit in `git rev-list $$COMMON_COMMIT..HEAD`; do \
305 printf "\n[*] Checking style of '$$commit'\n\n"; \
306 git log --format=email "$$commit~..$$commit" \
307 -- ${CHECK_PATHS} | ${CHECKPATCH} - || true; \
308 git diff --format=email "$$commit~..$$commit" \
309 -- ${CHECK_PATHS} | ${CHECKPATCH} - || true; \
310 done
311
312ifneq (${FIRMWARE_UPDATE},1)
313.PHONY: ns_bl1u ns_bl2u
314ns_bl1u ns_bl2u:
315 @echo "ERROR: Can't build $@ because Firmware Update is not supported \
316 on this platform."
317 @exit 1
318endif
319
320ifneq (${ARCH}-${PLAT},aarch64-fvp)
Antonio Nino Diaz9d7726c2019-03-19 10:59:11 +0000321.PHONY: cactus_mm
322cactus_mm:
323 @echo "ERROR: $@ is supported only on AArch64 FVP."
324 @exit 1
325
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200326.PHONY: cactus
327cactus:
328 @echo "ERROR: $@ is supported only on AArch64 FVP."
329 @exit 1
Antonio Nino Diaz0b1ab402018-12-05 15:38:39 +0000330
331.PHONY: ivy
332ivy:
333 @echo "ERROR: $@ is supported only on AArch64 FVP."
334 @exit 1
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200335endif
336
337MAKE_DEP = -Wp,-MD,$(DEP) -MT $$@
338
339define MAKE_C
340
341$(eval OBJ := $(1)/$(patsubst %.c,%.o,$(notdir $(2))))
342$(eval DEP := $(patsubst %.o,%.d,$(OBJ)))
343
344$(OBJ) : $(2)
345 @echo " CC $$<"
346 $$(Q)$$(CC) $$($(3)_CFLAGS) ${$(3)_INCLUDES} ${$(3)_DEFINES} -DIMAGE_$(3) $(MAKE_DEP) -c $$< -o $$@
347
348-include $(DEP)
349endef
350
351
352define MAKE_S
353
354$(eval OBJ := $(1)/$(patsubst %.S,%.o,$(notdir $(2))))
355$(eval DEP := $(patsubst %.o,%.d,$(OBJ)))
356
357$(OBJ) : $(2)
358 @echo " AS $$<"
359 $$(Q)$$(AS) $$($(3)_ASFLAGS) ${$(3)_INCLUDES} ${$(3)_DEFINES} -DIMAGE_$(3) $(MAKE_DEP) -c $$< -o $$@
360
361-include $(DEP)
362endef
363
364
365define MAKE_LD
366
367$(eval DEP := $(1).d)
368
369$(1) : $(2)
370 @echo " PP $$<"
371 $$(Q)$$(AS) $$($(3)_ASFLAGS) ${$(3)_INCLUDES} ${$(3)_DEFINES} -P -E $(MAKE_DEP) -o $$@ $$<
372
373-include $(DEP)
374endef
375
376
377define MAKE_OBJS
378 $(eval C_OBJS := $(filter %.c,$(2)))
379 $(eval REMAIN := $(filter-out %.c,$(2)))
380 $(eval $(foreach obj,$(C_OBJS),$(call MAKE_C,$(1),$(obj),$(3))))
381
382 $(eval S_OBJS := $(filter %.S,$(REMAIN)))
383 $(eval REMAIN := $(filter-out %.S,$(REMAIN)))
384 $(eval $(foreach obj,$(S_OBJS),$(call MAKE_S,$(1),$(obj),$(3))))
385
386 $(and $(REMAIN),$(error Unexpected source files present: $(REMAIN)))
387endef
388
389
390# NOTE: The line continuation '\' is required in the next define otherwise we
391# end up with a line-feed characer at the end of the last c filename.
392# Also bare this issue in mind if extending the list of supported filetypes.
393define SOURCES_TO_OBJS
394 $(notdir $(patsubst %.c,%.o,$(filter %.c,$(1)))) \
395 $(notdir $(patsubst %.S,%.o,$(filter %.S,$(1))))
396endef
397
398define uppercase
399$(shell echo $(1) | tr '[:lower:]' '[:upper:]')
400endef
401
402define MAKE_IMG
403 $(eval IMG_PREFIX := $(call uppercase, $(1)))
404 $(eval BUILD_DIR := ${BUILD_PLAT}/$(1))
405 $(eval SOURCES := $(${IMG_PREFIX}_SOURCES))
406 $(eval OBJS := $(addprefix $(BUILD_DIR)/,$(call SOURCES_TO_OBJS,$(SOURCES))))
407 $(eval LINKERFILE := $(BUILD_DIR)/$(1).ld)
408 $(eval MAPFILE := $(BUILD_DIR)/$(1).map)
409 $(eval ELF := $(BUILD_DIR)/$(1).elf)
410 $(eval DUMP := $(BUILD_DIR)/$(1).dump)
411 $(eval BIN := $(BUILD_PLAT)/$(1).bin)
412
413 $(eval $(call MAKE_OBJS,$(BUILD_DIR),$(SOURCES),${IMG_PREFIX}))
414 $(eval $(call MAKE_LD,$(LINKERFILE),$(${IMG_PREFIX}_LINKERFILE),${IMG_PREFIX}))
415
416$(BUILD_DIR) :
417 $$(Q)mkdir -p "$$@"
418
419$(ELF) : $(OBJS) $(LINKERFILE)
420 @echo " LD $$@"
421 @echo 'const char build_message[] = "Built : "__TIME__", "__DATE__; \
422 const char version_string[] = "${VERSION_STRING}";' | \
423 $$(CC) $$(${IMG_PREFIX}_CFLAGS) ${${IMG_PREFIX}_INCLUDES} ${${IMG_PREFIX}_DEFINES} -c -xc - -o $(BUILD_DIR)/build_message.o
424 $$(Q)$$(LD) -o $$@ $$(${IMG_PREFIX}_LDFLAGS) -Map=$(MAPFILE) \
425 -T $(LINKERFILE) $(BUILD_DIR)/build_message.o $(OBJS)
426
427$(DUMP) : $(ELF)
428 @echo " OD $$@"
429 $${Q}$${OD} -dx $$< > $$@
430
431$(BIN) : $(ELF)
432 @echo " BIN $$@"
433 $$(Q)$$(OC) -O binary $$< $$@
434 @echo
435 @echo "Built $$@ successfully"
436 @echo
437
438.PHONY : $(1)
439$(1) : $(BUILD_DIR) $(BIN) $(DUMP)
440
441all : $(1)
442
443endef
444
445$(AUTOGEN_DIR):
446 $(Q)mkdir -p "$@"
447
448$(AUTOGEN_DIR)/tests_list.c $(AUTOGEN_DIR)/tests_list.h: $(AUTOGEN_DIR) ${TESTS_FILE} ${PLAT_TESTS_SKIP_LIST}
449 @echo " AUTOGEN $@"
450 tools/generate_test_list/generate_test_list.pl $(AUTOGEN_DIR)/tests_list.c $(AUTOGEN_DIR)/tests_list.h ${TESTS_FILE} $(PLAT_TESTS_SKIP_LIST)
451
452$(eval $(call MAKE_IMG,tftf))
453
454ifeq ($(FIRMWARE_UPDATE), 1)
455 $(eval $(call MAKE_IMG,ns_bl1u))
456 $(eval $(call MAKE_IMG,ns_bl2u))
457endif
458
459ifeq (${ARCH}-${PLAT},aarch64-fvp)
Antonio Nino Diaz9d7726c2019-03-19 10:59:11 +0000460 $(eval $(call MAKE_IMG,cactus_mm))
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200461 $(eval $(call MAKE_IMG,cactus))
Antonio Nino Diaz0b1ab402018-12-05 15:38:39 +0000462 $(eval $(call MAKE_IMG,ivy))
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200463endif
464
465# The EL3 test payload is only supported in AArch64. It has an independent build
466# system.
467.PHONY: el3_payload
468ifneq (${ARCH},aarch32)
469el3_payload: $(BUILD_DIR)
470 ${Q}${MAKE} -C el3_payload PLAT=${PLAT}
471 ${Q}find "el3_payload/build/${PLAT}" -name '*.bin' -exec cp {} "${BUILD_PLAT}" \;
472
473all: el3_payload
474endif
475
476.PHONY: cscope
477cscope:
478 @echo " CSCOPE"
479 ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files
480 ${Q}cscope -b -q -k
481
482.PHONY: help
483help:
Antonio Nino Diaz0b1ab402018-12-05 15:38:39 +0000484 @echo "usage: ${MAKE} PLAT=<${PLATFORMS}> <all|tftf|ns_bl1u|ns_bl2u|cactus|ivy|el3_payload|distclean|clean|checkcodebase|checkpatch>"
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200485 @echo ""
486 @echo "PLAT is used to specify which platform you wish to build."
487 @echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}"
488 @echo ""
489 @echo "Supported Targets:"
490 @echo " all Build all supported binaries for this platform"
491 @echo " (i.e. TFTF and FWU images)"
492 @echo " tftf Build the TFTF image"
493 @echo " ns_bl1u Build the NS_BL1U image"
494 @echo " ns_bl2u Build the NS_BL2U image"
Antonio Nino Diaz0c697f92018-11-30 10:51:26 +0000495 @echo " cactus Build the Cactus image (Test S-EL0 payload) and resource description."
Antonio Nino Diaz9d7726c2019-03-19 10:59:11 +0000496 @echo " cactus_mm Build the Cactus-MM image (Test S-EL0 payload)."
Antonio Nino Diaz0c697f92018-11-30 10:51:26 +0000497 @echo " ivy Build the Ivy image (Test S-EL0 payload) and resource description."
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200498 @echo " el3_payload Build the EL3 test payload"
499 @echo " checkcodebase Check the coding style of the entire source tree"
500 @echo " checkpatch Check the coding style on changes in the current"
501 @echo " branch against BASE_COMMIT (default origin/master)"
502 @echo " clean Clean the build for the selected platform"
503 @echo " cscope Generate cscope index"
504 @echo " distclean Remove all build artifacts for all platforms"
505 @echo ""
506 @echo "note: most build targets require PLAT to be set to a specific platform."
507 @echo ""
508 @echo "example: build all targets for the FVP platform:"
509 @echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all"