xref: /rk3399_ARM-atf/Makefile (revision 6331a31a66cdcf53421d3dccd3067f072c6da175)
1#
2# Copyright (c) 2013-2016, ARM Limited and Contributors. All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are met:
6#
7# Redistributions of source code must retain the above copyright notice, this
8# list of conditions and the following disclaimer.
9#
10# Redistributions in binary form must reproduce the above copyright notice,
11# this list of conditions and the following disclaimer in the documentation
12# and/or other materials provided with the distribution.
13#
14# Neither the name of ARM nor the names of its contributors may be used
15# to endorse or promote products derived from this software without specific
16# prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28# POSSIBILITY OF SUCH DAMAGE.
29#
30
31#
32# Trusted Firmware Version
33#
34VERSION_MAJOR			:= 1
35VERSION_MINOR			:= 2
36
37# Default goal is build all images
38.DEFAULT_GOAL			:= all
39
40MAKE_HELPERS_DIRECTORY := make_helpers/
41include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
42include ${MAKE_HELPERS_DIRECTORY}build_env.mk
43
44################################################################################
45# Default values for build configurations
46################################################################################
47
48# Build verbosity
49V				:= 0
50# Debug build
51DEBUG				:= 0
52# Build platform
53DEFAULT_PLAT			:= fvp
54PLAT				:= ${DEFAULT_PLAT}
55# SPD choice
56SPD				:= none
57# Base commit to perform code check on
58BASE_COMMIT			:= origin/master
59# NS timer register save and restore
60NS_TIMER_SWITCH			:= 0
61# By default, BL1 acts as the reset handler, not BL31
62RESET_TO_BL31			:= 0
63# Include FP registers in cpu context
64CTX_INCLUDE_FPREGS		:= 0
65# Determine the version of ARM GIC architecture to use for interrupt management
66# in EL3. The platform port can change this value if needed.
67ARM_GIC_ARCH			:= 2
68# Determine the version of ARM CCI product used in the platform. The platform
69# port can change this value if needed.
70ARM_CCI_PRODUCT_ID		:= 400
71# Flag used to indicate if ASM_ASSERTION should be enabled for the build.
72# This defaults to being present in DEBUG builds only.
73ASM_ASSERTION			:= ${DEBUG}
74# Build option to choose whether Trusted firmware uses Coherent memory or not.
75USE_COHERENT_MEM		:= 1
76# Flag used to choose the power state format viz Extended State-ID or the Original
77# format.
78PSCI_EXTENDED_STATE_ID		:= 0
79# Default FIP file name
80FIP_NAME			:= fip.bin
81# Default FWU_FIP file name
82FWU_FIP_NAME			:= fwu_fip.bin
83# By default, use the -pedantic option in the gcc command line
84DISABLE_PEDANTIC		:= 0
85# Flags to generate the Chain of Trust
86GENERATE_COT			:= 0
87CREATE_KEYS			:= 1
88SAVE_KEYS			:= 0
89# Flags to build TF with Trusted Boot support
90TRUSTED_BOARD_BOOT		:= 0
91# By default, consider that the platform's reset address is not programmable.
92# The platform Makefile is free to override this value.
93PROGRAMMABLE_RESET_ADDRESS	:= 0
94# Build flag to treat usage of deprecated platform and framework APIs as error.
95ERROR_DEPRECATED		:= 0
96# By default, consider that the platform may release several CPUs out of reset.
97# The platform Makefile is free to override this value.
98COLD_BOOT_SINGLE_CPU		:= 0
99# Flag to introduce an infinite loop in BL1 just before it exits into the next
100# image. This is meant to help debugging the post-BL2 phase.
101SPIN_ON_BL1_EXIT		:= 0
102# Build PL011 UART driver in minimal generic UART mode
103PL011_GENERIC_UART		:= 0
104
105
106################################################################################
107# Checkpatch script options
108################################################################################
109
110CHECK_IGNORE		:=	--ignore COMPLEX_MACRO \
111				--ignore GERRIT_CHANGE_ID \
112				--ignore GIT_COMMIT_ID
113CHECKPATCH_ARGS		:=	--no-tree --no-signoff ${CHECK_IGNORE}
114CHECKCODE_ARGS		:=	--no-patch --no-tree --no-signoff ${CHECK_IGNORE}
115# Do not check the coding style on C library files or documentation files
116INCLUDE_DIRS_TO_CHECK	:=	$(sort $(filter-out include/stdlib, $(wildcard include/*)))
117LIB_DIRS_TO_CHECK	:=	$(sort $(filter-out lib/stdlib, $(wildcard lib/*)))
118ROOT_DIRS_TO_CHECK	:=	$(sort $(filter-out lib include docs %.md, $(wildcard *)))
119CHECK_PATHS		:=	${ROOT_DIRS_TO_CHECK} ${INCLUDE_DIRS_TO_CHECK} ${LIB_DIRS_TO_CHECK}
120
121
122################################################################################
123# Process build options
124################################################################################
125
126# Verbose flag
127ifeq (${V},0)
128        Q:=@
129        CHECKCODE_ARGS	+=	--no-summary --terse
130else
131        Q:=
132endif
133export Q
134
135# Process Debug flag
136$(eval $(call add_define,DEBUG))
137ifneq (${DEBUG}, 0)
138        BUILD_TYPE	:=	debug
139        TF_CFLAGS	+= 	-g
140        ASFLAGS		+= 	-g -Wa,--gdwarf-2
141        # Use LOG_LEVEL_INFO by default for debug builds
142        LOG_LEVEL	:=	40
143else
144        BUILD_TYPE	:=	release
145        $(eval $(call add_define,NDEBUG))
146        # Use LOG_LEVEL_NOTICE by default for release builds
147        LOG_LEVEL	:=	20
148endif
149
150# Default build string (git branch and commit)
151ifeq (${BUILD_STRING},)
152        BUILD_STRING	:=	$(shell git log -n 1 --pretty=format:"%h")
153endif
154VERSION_STRING		:=	v${VERSION_MAJOR}.${VERSION_MINOR}(${BUILD_TYPE}):${BUILD_STRING}
155
156# The cert_create tool cannot generate certificates individually, so we use the
157# target 'certificates' to create them all
158ifneq (${GENERATE_COT},0)
159        FIP_DEPS += certificates
160        FWU_FIP_DEPS += fwu_certificates
161endif
162
163
164################################################################################
165# Toolchain
166################################################################################
167
168CC			:=	${CROSS_COMPILE}gcc
169CPP			:=	${CROSS_COMPILE}cpp
170AS			:=	${CROSS_COMPILE}gcc
171AR			:=	${CROSS_COMPILE}ar
172LD			:=	${CROSS_COMPILE}ld
173OC			:=	${CROSS_COMPILE}objcopy
174OD			:=	${CROSS_COMPILE}objdump
175NM			:=	${CROSS_COMPILE}nm
176PP			:=	${CROSS_COMPILE}gcc -E
177
178ASFLAGS			+= 	-nostdinc -ffreestanding -Wa,--fatal-warnings	\
179				-Werror -Wmissing-include-dirs			\
180				-mgeneral-regs-only -D__ASSEMBLY__		\
181				${DEFINES} ${INCLUDES}
182TF_CFLAGS		+= 	-nostdinc -ffreestanding -Wall			\
183				-Werror -Wmissing-include-dirs			\
184				-mgeneral-regs-only -mstrict-align		\
185				-std=c99 -c -Os					\
186				${DEFINES} ${INCLUDES}
187TF_CFLAGS		+=	-ffunction-sections -fdata-sections
188
189LDFLAGS			+=	--fatal-warnings -O1
190LDFLAGS			+=	--gc-sections
191
192
193################################################################################
194# Common sources and include directories
195################################################################################
196
197BL_COMMON_SOURCES	+=	common/bl_common.c			\
198				common/tf_printf.c			\
199				common/aarch64/debug.S			\
200				lib/aarch64/cache_helpers.S		\
201				lib/aarch64/misc_helpers.S		\
202				lib/stdlib/abort.c			\
203				lib/stdlib/assert.c			\
204				lib/stdlib/exit.c			\
205				lib/stdlib/mem.c			\
206				lib/stdlib/printf.c			\
207				lib/stdlib/putchar.c			\
208				lib/stdlib/puts.c			\
209				lib/stdlib/sscanf.c			\
210				lib/stdlib/strchr.c			\
211				lib/stdlib/strcmp.c			\
212				lib/stdlib/strlen.c			\
213				lib/stdlib/strncmp.c			\
214				lib/stdlib/subr_prf.c			\
215				plat/common/aarch64/platform_helpers.S
216
217INCLUDES		+=	-Iinclude/bl1			\
218				-Iinclude/bl31			\
219				-Iinclude/bl31/services		\
220				-Iinclude/common		\
221				-Iinclude/drivers		\
222				-Iinclude/drivers/arm		\
223				-Iinclude/drivers/auth		\
224				-Iinclude/drivers/io		\
225				-Iinclude/drivers/ti/uart	\
226				-Iinclude/lib			\
227				-Iinclude/lib/aarch64		\
228				-Iinclude/lib/cpus/aarch64	\
229				-Iinclude/plat/common		\
230				-Iinclude/stdlib		\
231				-Iinclude/stdlib/sys		\
232				${PLAT_INCLUDES}		\
233				${SPD_INCLUDES}
234
235
236################################################################################
237# Generic definitions
238################################################################################
239
240include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk
241
242BUILD_BASE		:=	./build
243BUILD_PLAT		:=	${BUILD_BASE}/${PLAT}/${BUILD_TYPE}
244
245SPDS			:=	$(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*))))
246
247# Platforms providing their own TBB makefile may override this value
248INCLUDE_TBBR_MK		:=	1
249
250
251################################################################################
252# Include SPD Makefile if one has been specified
253################################################################################
254
255ifneq (${SPD},none)
256ifdef EL3_PAYLOAD_BASE
257        $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.")
258        $(warning "The SPD and its BL32 companion will be present but ignored.")
259endif
260        # We expect to locate an spd.mk under the specified SPD directory
261        SPD_MAKE	:=	$(wildcard services/spd/${SPD}/${SPD}.mk)
262
263        ifeq (${SPD_MAKE},)
264                $(error Error: No services/spd/${SPD}/${SPD}.mk located)
265        endif
266        $(info Including ${SPD_MAKE})
267        include ${SPD_MAKE}
268
269        # If there's BL32 companion for the chosen SPD, we expect that the SPD's
270        # Makefile would set NEED_BL32 to "yes". In this case, the build system
271        # supports two mutually exclusive options:
272        # * BL32 is built from source: then BL32_SOURCES must contain the list
273        #   of source files to build BL32
274        # * BL32 is a prebuilt binary: then BL32 must point to the image file
275        #   that will be included in the FIP
276        # If both BL32_SOURCES and BL32 are defined, the binary takes precedence
277        # over the sources.
278endif
279
280
281################################################################################
282# Include the platform specific Makefile after the SPD Makefile (the platform
283# makefile may use all previous definitions in this file)
284################################################################################
285
286include ${PLAT_MAKEFILE_FULL}
287
288# If the platform has not defined ENABLE_PLAT_COMPAT, then enable it by default
289ifndef ENABLE_PLAT_COMPAT
290ENABLE_PLAT_COMPAT := 1
291endif
292
293# Include the platform compatibility helpers for PSCI
294ifneq (${ENABLE_PLAT_COMPAT}, 0)
295include plat/compat/plat_compat.mk
296endif
297
298# Include the CPU specific operations makefile, which provides default
299# values for all CPU errata workarounds and CPU specific optimisations.
300# This can be overridden by the platform.
301include lib/cpus/cpu-ops.mk
302
303
304################################################################################
305# Check incompatible options
306################################################################################
307
308ifdef EL3_PAYLOAD_BASE
309        ifdef PRELOADED_BL33_BASE
310                $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \
311                incompatible build options. EL3_PAYLOAD_BASE has priority.")
312        endif
313endif
314
315ifeq (${NEED_BL33},yes)
316        ifdef EL3_PAYLOAD_BASE
317                $(warning "BL33 image is not needed when option \
318                BL33_PAYLOAD_BASE is used and won't be added to the FIP file.")
319        endif
320        ifdef PRELOADED_BL33_BASE
321                $(warning "BL33 image is not needed when option \
322                PRELOADED_BL33_BASE is used and won't be added to the FIP \
323                file.")
324        endif
325endif
326
327
328################################################################################
329# Process platform overrideable behaviour
330################################################################################
331
332# Check if -pedantic option should be used
333ifeq (${DISABLE_PEDANTIC},0)
334        TF_CFLAGS	+= 	-pedantic
335endif
336
337# Using the ARM Trusted Firmware BL2 implies that a BL33 image also needs to be
338# supplied for the FIP and Certificate generation tools. This flag can be
339# overridden by the platform.
340ifdef BL2_SOURCES
341        ifdef EL3_PAYLOAD_BASE
342                # If booting an EL3 payload there is no need for a BL33 image
343                # in the FIP file.
344                NEED_BL33		:=	no
345        else
346                ifdef PRELOADED_BL33_BASE
347                        # If booting a BL33 preloaded image there is no need of
348                        # another one in the FIP file.
349                        NEED_BL33		:=	no
350                else
351                        NEED_BL33		?=	yes
352                endif
353        endif
354endif
355
356# Process TBB related flags
357ifneq (${GENERATE_COT},0)
358        # Common cert_create options
359        ifneq (${CREATE_KEYS},0)
360                $(eval CRT_ARGS += -n)
361                $(eval FWU_CRT_ARGS += -n)
362                ifneq (${SAVE_KEYS},0)
363                        $(eval CRT_ARGS += -k)
364                        $(eval FWU_CRT_ARGS += -k)
365                endif
366        endif
367        # Include TBBR makefile (unless the platform indicates otherwise)
368        ifeq (${INCLUDE_TBBR_MK},1)
369                include make_helpers/tbbr/tbbr_tools.mk
370        endif
371endif
372
373
374################################################################################
375# Auxiliary tools (fip_create, cert_create, etc)
376################################################################################
377
378# Variables for use with Certificate Generation Tool
379CRTTOOLPATH		?=	tools/cert_create
380CRTTOOL			?=	${CRTTOOLPATH}/cert_create${BIN_EXT}
381
382# Variables for use with Firmware Image Package
383FIPTOOLPATH		?=	tools/fip_create
384FIPTOOL			?=	${FIPTOOLPATH}/fip_create${BIN_EXT}
385
386
387################################################################################
388# Build options checks
389################################################################################
390
391$(eval $(call assert_boolean,DEBUG))
392$(eval $(call assert_boolean,NS_TIMER_SWITCH))
393$(eval $(call assert_boolean,RESET_TO_BL31))
394$(eval $(call assert_boolean,CTX_INCLUDE_FPREGS))
395$(eval $(call assert_boolean,ASM_ASSERTION))
396$(eval $(call assert_boolean,USE_COHERENT_MEM))
397$(eval $(call assert_boolean,DISABLE_PEDANTIC))
398$(eval $(call assert_boolean,GENERATE_COT))
399$(eval $(call assert_boolean,CREATE_KEYS))
400$(eval $(call assert_boolean,SAVE_KEYS))
401$(eval $(call assert_boolean,TRUSTED_BOARD_BOOT))
402$(eval $(call assert_boolean,PROGRAMMABLE_RESET_ADDRESS))
403$(eval $(call assert_boolean,COLD_BOOT_SINGLE_CPU))
404$(eval $(call assert_boolean,PSCI_EXTENDED_STATE_ID))
405$(eval $(call assert_boolean,ERROR_DEPRECATED))
406$(eval $(call assert_boolean,ENABLE_PLAT_COMPAT))
407$(eval $(call assert_boolean,SPIN_ON_BL1_EXIT))
408$(eval $(call assert_boolean,PL011_GENERIC_UART))
409
410
411################################################################################
412# Add definitions to the cpp preprocessor based on the current build options.
413# This is done after including the platform specific makefile to allow the
414# platform to overwrite the default options
415################################################################################
416
417$(eval $(call add_define,PLAT_${PLAT}))
418$(eval $(call add_define,SPD_${SPD}))
419$(eval $(call add_define,NS_TIMER_SWITCH))
420$(eval $(call add_define,RESET_TO_BL31))
421$(eval $(call add_define,CTX_INCLUDE_FPREGS))
422$(eval $(call add_define,ARM_GIC_ARCH))
423$(eval $(call add_define,ARM_CCI_PRODUCT_ID))
424$(eval $(call add_define,ASM_ASSERTION))
425$(eval $(call add_define,LOG_LEVEL))
426$(eval $(call add_define,USE_COHERENT_MEM))
427$(eval $(call add_define,TRUSTED_BOARD_BOOT))
428$(eval $(call add_define,PROGRAMMABLE_RESET_ADDRESS))
429$(eval $(call add_define,COLD_BOOT_SINGLE_CPU))
430$(eval $(call add_define,PSCI_EXTENDED_STATE_ID))
431$(eval $(call add_define,ERROR_DEPRECATED))
432$(eval $(call add_define,ENABLE_PLAT_COMPAT))
433$(eval $(call add_define,SPIN_ON_BL1_EXIT))
434$(eval $(call add_define,PL011_GENERIC_UART))
435# Define the EL3_PAYLOAD_BASE flag only if it is provided.
436ifdef EL3_PAYLOAD_BASE
437        $(eval $(call add_define,EL3_PAYLOAD_BASE))
438else
439        # Define the PRELOADED_BL33_BASE flag only if it is provided and
440        # EL3_PAYLOAD_BASE is not defined, as it has priority.
441        ifdef PRELOADED_BL33_BASE
442                $(eval $(call add_define,PRELOADED_BL33_BASE))
443        endif
444endif
445
446
447################################################################################
448# Include BL specific makefiles
449################################################################################
450
451ifdef BL1_SOURCES
452NEED_BL1 := yes
453include bl1/bl1.mk
454endif
455
456ifdef BL2_SOURCES
457NEED_BL2 := yes
458include bl2/bl2.mk
459endif
460
461ifdef BL2U_SOURCES
462NEED_BL2U := yes
463include bl2u/bl2u.mk
464endif
465
466ifdef BL31_SOURCES
467# When booting an EL3 payload, there is no need to compile the BL31 image nor
468# put it in the FIP.
469ifndef EL3_PAYLOAD_BASE
470NEED_BL31 := yes
471include bl31/bl31.mk
472endif
473endif
474
475
476################################################################################
477# Build targets
478################################################################################
479
480.PHONY:	all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool fip fwu_fip certtool
481.SUFFIXES:
482
483all: msg_start
484
485msg_start:
486	@echo "Building ${PLAT}"
487
488# Check if deprecated declarations should be treated as error or not.
489ifeq (${ERROR_DEPRECATED},0)
490    TF_CFLAGS		+= 	-Wno-error=deprecated-declarations
491endif
492
493# Expand build macros for the different images
494ifeq (${NEED_BL1},yes)
495$(eval $(call MAKE_BL,1))
496endif
497
498ifeq (${NEED_BL2},yes)
499$(if ${BL2}, $(eval $(call MAKE_TOOL_ARGS,2,${BL2},tb-fw)),\
500	$(eval $(call MAKE_BL,2,tb-fw)))
501endif
502
503ifeq (${NEED_BL31},yes)
504BL31_SOURCES += ${SPD_SOURCES}
505$(if ${BL31}, $(eval $(call MAKE_TOOL_ARGS,31,${BL31},soc-fw)),\
506	$(eval $(call MAKE_BL,31,soc-fw)))
507endif
508
509# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the
510# build system will call FIP_ADD_IMG to print a warning message and abort the
511# process. Note that the dependency on BL32 applies to the FIP only.
512ifeq (${NEED_BL32},yes)
513$(if ${BL32}, $(eval $(call MAKE_TOOL_ARGS,32,${BL32},tos-fw)),\
514	$(if ${BL32_SOURCES}, $(eval $(call MAKE_BL,32,tos-fw)),\
515		$(eval $(call FIP_ADD_IMG,BL32,--tos-fw))))
516endif
517
518# Add the BL33 image if required by the platform
519ifeq (${NEED_BL33},yes)
520$(eval $(call FIP_ADD_IMG,BL33,--nt-fw))
521endif
522
523ifeq (${NEED_BL2U},yes)
524BL2U_PATH	:= $(if ${BL2U},${BL2U},$(call IMG_BIN,2u))
525$(if ${BL2U}, ,$(eval $(call MAKE_BL,2u)))
526$(eval $(call FWU_FIP_ADD_PAYLOAD,${BL2U_PATH},--ap-fwu-cfg))
527endif
528
529locate-checkpatch:
530ifndef CHECKPATCH
531	$(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/script/checkpatch.pl")
532else
533ifeq (,$(wildcard ${CHECKPATCH}))
534	$(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/script/checkpatch.pl")
535endif
536endif
537
538clean:
539	@echo "  CLEAN"
540	$(call SHELL_REMOVE_DIR,${BUILD_PLAT})
541	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
542	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
543
544realclean distclean:
545	@echo "  REALCLEAN"
546	$(call SHELL_REMOVE_DIR,${BUILD_BASE})
547	$(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*)
548	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
549	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
550
551checkcodebase:		locate-checkpatch
552	@echo "  CHECKING STYLE"
553	@if test -d .git ; then	\
554		git ls-files | grep -v stdlib | while read GIT_FILE ; do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; done ;	\
555	 else			\
556		 find . -type f -not -iwholename "*.git*" -not -iwholename "*build*" -not -iwholename "*stdlib*" -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ;	\
557	 fi
558
559checkpatch:		locate-checkpatch
560	@echo "  CHECKING STYLE"
561	${Q}git log -p ${BASE_COMMIT}..HEAD -- ${CHECK_PATHS} | ${CHECKPATCH} ${CHECKPATCH_ARGS} - || true
562
563certtool: ${CRTTOOL}
564
565.PHONY: ${CRTTOOL}
566${CRTTOOL}:
567	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH}
568	@${ECHO_BLANK_LINE}
569	@echo "Built $@ successfully"
570	@${ECHO_BLANK_LINE}
571
572ifneq (${GENERATE_COT},0)
573certificates: ${CRT_DEPS} ${CRTTOOL}
574	${Q}${CRTTOOL} ${CRT_ARGS}
575	@${ECHO_BLANK_LINE}
576	@echo "Built $@ successfully"
577	@echo "Certificates can be found in ${BUILD_PLAT}"
578	@${ECHO_BLANK_LINE}
579endif
580
581${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL}
582	${Q}${FIPTOOL} --dump ${FIP_ARGS} $@
583	@${ECHO_BLANK_LINE}
584	@echo "Built $@ successfully"
585	@${ECHO_BLANK_LINE}
586
587ifneq (${GENERATE_COT},0)
588fwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL}
589	${Q}${CRTTOOL} ${FWU_CRT_ARGS}
590	@echo
591	@echo "Built $@ successfully"
592	@echo "FWU certificates can be found in ${BUILD_PLAT}"
593	@echo
594endif
595
596${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL}
597	${Q}${FIPTOOL} --dump ${FWU_FIP_ARGS} $@
598	@echo
599	@echo "Built $@ successfully"
600	@echo
601
602fiptool: ${FIPTOOL}
603fip: ${BUILD_PLAT}/${FIP_NAME}
604fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME}
605
606.PHONY: ${FIPTOOL}
607${FIPTOOL}:
608	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH}
609
610cscope:
611	@echo "  CSCOPE"
612	${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files
613	${Q}cscope -b -q -k
614
615help:
616	@echo "usage: ${MAKE} PLAT=<${PLATFORM_LIST}> [OPTIONS] [TARGET]"
617	@echo ""
618	@echo "PLAT is used to specify which platform you wish to build."
619	@echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}"
620	@echo ""
621	@echo "Please refer to the User Guide for a list of all supported options."
622	@echo "Note that the build system doesn't track dependencies for build "
623	@echo "options. Therefore, if any of the build options are changed "
624	@echo "from a previous build, a clean build must be performed."
625	@echo ""
626	@echo "Supported Targets:"
627	@echo "  all            Build all individual bootloader binaries"
628	@echo "  bl1            Build the BL1 binary"
629	@echo "  bl2            Build the BL2 binary"
630	@echo "  bl2u           Build the BL2U binary"
631	@echo "  bl31           Build the BL31 binary"
632	@echo "  bl32           Build the BL32 binary"
633	@echo "  certificates   Build the certificates (requires 'GENERATE_COT=1')"
634	@echo "  fip            Build the Firmware Image Package (FIP)"
635	@echo "  fwu_fip        Build the FWU Firmware Image Package (FIP)"
636	@echo "  checkcodebase  Check the coding style of the entire source tree"
637	@echo "  checkpatch     Check the coding style on changes in the current"
638	@echo "                 branch against BASE_COMMIT (default origin/master)"
639	@echo "  clean          Clean the build for the selected platform"
640	@echo "  cscope         Generate cscope index"
641	@echo "  distclean      Remove all build artifacts for all platforms"
642	@echo "  certtool       Build the Certificate generation tool"
643	@echo "  fiptool        Build the Firmware Image Package(FIP) creation tool"
644	@echo ""
645	@echo "Note: most build targets require PLAT to be set to a specific platform."
646	@echo ""
647	@echo "example: build all targets for the FVP platform:"
648	@echo "  CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all"
649