xref: /rk3399_ARM-atf/Makefile (revision 42a45b51aa9748c67654a9f7f4546b464856ca99)
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
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, $(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        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}
182CFLAGS			+= 	-nostdinc -ffreestanding -Wall			\
183				-Werror -Wmissing-include-dirs			\
184				-mgeneral-regs-only -mstrict-align		\
185				-std=c99 -c -Os					\
186				${DEFINES} ${INCLUDES}
187CFLAGS			+=	-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/aarch64/xlat_helpers.c		\
203				lib/stdlib/abort.c			\
204				lib/stdlib/assert.c			\
205				lib/stdlib/exit.c			\
206				lib/stdlib/mem.c			\
207				lib/stdlib/printf.c			\
208				lib/stdlib/putchar.c			\
209				lib/stdlib/puts.c			\
210				lib/stdlib/sscanf.c			\
211				lib/stdlib/strchr.c			\
212				lib/stdlib/strcmp.c			\
213				lib/stdlib/strlen.c			\
214				lib/stdlib/strncmp.c			\
215				lib/stdlib/subr_prf.c			\
216				plat/common/aarch64/platform_helpers.S
217
218INCLUDES		+=	-Iinclude/bl1			\
219				-Iinclude/bl31			\
220				-Iinclude/bl31/services		\
221				-Iinclude/common		\
222				-Iinclude/drivers		\
223				-Iinclude/drivers/arm		\
224				-Iinclude/drivers/auth		\
225				-Iinclude/drivers/io		\
226				-Iinclude/drivers/ti/uart	\
227				-Iinclude/lib			\
228				-Iinclude/lib/aarch64		\
229				-Iinclude/lib/cpus/aarch64	\
230				-Iinclude/plat/common		\
231				-Iinclude/stdlib		\
232				-Iinclude/stdlib/sys		\
233				${PLAT_INCLUDES}		\
234				${SPD_INCLUDES}
235
236
237################################################################################
238# Generic definitions
239################################################################################
240
241include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk
242
243BUILD_BASE		:=	./build
244BUILD_PLAT		:=	${BUILD_BASE}/${PLAT}/${BUILD_TYPE}
245
246SPDS			:=	$(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*))))
247
248# Platforms providing their own TBB makefile may override this value
249INCLUDE_TBBR_MK		:=	1
250
251
252################################################################################
253# Include SPD Makefile if one has been specified
254################################################################################
255
256ifneq (${SPD},none)
257ifdef EL3_PAYLOAD_BASE
258        $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.")
259        $(warning "The SPD and its BL32 companion will be present but ignored.")
260endif
261        # We expect to locate an spd.mk under the specified SPD directory
262        SPD_MAKE	:=	$(wildcard services/spd/${SPD}/${SPD}.mk)
263
264        ifeq (${SPD_MAKE},)
265                $(error Error: No services/spd/${SPD}/${SPD}.mk located)
266        endif
267        $(info Including ${SPD_MAKE})
268        include ${SPD_MAKE}
269
270        # If there's BL32 companion for the chosen SPD, we expect that the SPD's
271        # Makefile would set NEED_BL32 to "yes". In this case, the build system
272        # supports two mutually exclusive options:
273        # * BL32 is built from source: then BL32_SOURCES must contain the list
274        #   of source files to build BL32
275        # * BL32 is a prebuilt binary: then BL32 must point to the image file
276        #   that will be included in the FIP
277        # If both BL32_SOURCES and BL32 are defined, the binary takes precedence
278        # over the sources.
279endif
280
281
282################################################################################
283# Include the platform specific Makefile after the SPD Makefile (the platform
284# makefile may use all previous definitions in this file)
285################################################################################
286
287include ${PLAT_MAKEFILE_FULL}
288
289# If the platform has not defined ENABLE_PLAT_COMPAT, then enable it by default
290ifndef ENABLE_PLAT_COMPAT
291ENABLE_PLAT_COMPAT := 1
292endif
293
294# Include the platform compatibility helpers for PSCI
295ifneq (${ENABLE_PLAT_COMPAT}, 0)
296include plat/compat/plat_compat.mk
297endif
298
299# Include the CPU specific operations makefile, which provides default
300# values for all CPU errata workarounds and CPU specific optimisations.
301# This can be overridden by the platform.
302include lib/cpus/cpu-ops.mk
303
304
305################################################################################
306# Check incompatible options
307################################################################################
308
309ifdef EL3_PAYLOAD_BASE
310        ifdef BL33_BASE
311                $(warning "BL33_BASE and EL3_PAYLOAD_BASE are incompatible \
312                build options. EL3_PAYLOAD_BASE has priority.")
313        endif
314endif
315
316ifeq (${NEED_BL33},yes)
317        ifdef EL3_PAYLOAD_BASE
318                $(warning "BL33 image is not needed when option \
319                BL33_PAYLOAD_BASE is used and won't be added to the FIP file.")
320        endif
321        ifdef BL33_BASE
322                $(warning "BL33 image is not needed when option BL33_BASE is \
323                used and won't be added to the FIP 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        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 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,NS_TIMER_SWITCH))
419$(eval $(call add_define,RESET_TO_BL31))
420$(eval $(call add_define,CTX_INCLUDE_FPREGS))
421$(eval $(call add_define,ARM_GIC_ARCH))
422$(eval $(call add_define,ARM_CCI_PRODUCT_ID))
423$(eval $(call add_define,ASM_ASSERTION))
424$(eval $(call add_define,LOG_LEVEL))
425$(eval $(call add_define,USE_COHERENT_MEM))
426$(eval $(call add_define,TRUSTED_BOARD_BOOT))
427$(eval $(call add_define,PROGRAMMABLE_RESET_ADDRESS))
428$(eval $(call add_define,COLD_BOOT_SINGLE_CPU))
429$(eval $(call add_define,PSCI_EXTENDED_STATE_ID))
430$(eval $(call add_define,ERROR_DEPRECATED))
431$(eval $(call add_define,ENABLE_PLAT_COMPAT))
432$(eval $(call add_define,SPIN_ON_BL1_EXIT))
433$(eval $(call add_define,PL011_GENERIC_UART))
434# Define the EL3_PAYLOAD_BASE flag only if it is provided.
435ifdef EL3_PAYLOAD_BASE
436        $(eval $(call add_define,EL3_PAYLOAD_BASE))
437else
438        # Define the BL33_BASE flag only if it is provided and EL3_PAYLOAD_BASE
439        # is not defined, as it has priority.
440        ifdef BL33_BASE
441                $(eval $(call add_define,BL33_BASE))
442        endif
443endif
444
445
446################################################################################
447# Include BL specific makefiles
448################################################################################
449
450ifdef BL1_SOURCES
451NEED_BL1 := yes
452include bl1/bl1.mk
453endif
454
455ifdef BL2_SOURCES
456NEED_BL2 := yes
457include bl2/bl2.mk
458endif
459
460ifdef BL2U_SOURCES
461NEED_BL2U := yes
462include bl2u/bl2u.mk
463endif
464
465ifdef BL31_SOURCES
466# When booting an EL3 payload, there is no need to compile the BL31 image nor
467# put it in the FIP.
468ifndef EL3_PAYLOAD_BASE
469NEED_BL31 := yes
470include bl31/bl31.mk
471endif
472endif
473
474
475################################################################################
476# Build targets
477################################################################################
478
479.PHONY:	all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool fip fwu_fip certtool
480.SUFFIXES:
481
482all: msg_start
483
484msg_start:
485	@echo "Building ${PLAT}"
486
487# Check if deprecated declarations should be treated as error or not.
488ifeq (${ERROR_DEPRECATED},0)
489    CFLAGS		+= 	-Wno-error=deprecated-declarations
490endif
491
492# Expand build macros for the different images
493ifeq (${NEED_BL1},yes)
494$(eval $(call MAKE_BL,1))
495endif
496
497ifeq (${NEED_BL2},yes)
498$(if ${BL2}, $(eval $(call MAKE_TOOL_ARGS,2,${BL2},tb-fw)),\
499	$(eval $(call MAKE_BL,2,tb-fw)))
500endif
501
502ifeq (${NEED_BL31},yes)
503BL31_SOURCES += ${SPD_SOURCES}
504$(if ${BL31}, $(eval $(call MAKE_TOOL_ARGS,31,${BL31},soc-fw)),\
505	$(eval $(call MAKE_BL,31,soc-fw)))
506endif
507
508# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the
509# build system will call FIP_ADD_IMG to print a warning message and abort the
510# process. Note that the dependency on BL32 applies to the FIP only.
511ifeq (${NEED_BL32},yes)
512$(if ${BL32}, $(eval $(call MAKE_TOOL_ARGS,32,${BL32},tos-fw)),\
513	$(if ${BL32_SOURCES}, $(eval $(call MAKE_BL,32,tos-fw)),\
514		$(eval $(call FIP_ADD_IMG,BL32,--tos-fw))))
515endif
516
517# Add the BL33 image if required by the platform
518ifeq (${NEED_BL33},yes)
519$(eval $(call FIP_ADD_IMG,BL33,--nt-fw))
520endif
521
522ifeq (${NEED_BL2U},yes)
523BL2U_PATH	:= $(if ${BL2U},${BL2U},$(call IMG_BIN,2u))
524$(if ${BL2U}, ,$(eval $(call MAKE_BL,2u)))
525$(eval $(call FWU_FIP_ADD_PAYLOAD,${BL2U_PATH},--ap-fwu-cfg))
526endif
527
528locate-checkpatch:
529ifndef CHECKPATCH
530	$(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/script/checkpatch.pl")
531else
532ifeq (,$(wildcard ${CHECKPATCH}))
533	$(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/script/checkpatch.pl")
534endif
535endif
536
537clean:
538	@echo "  CLEAN"
539	$(call SHELL_REMOVE_DIR,${BUILD_PLAT})
540	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
541	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
542
543realclean distclean:
544	@echo "  REALCLEAN"
545	$(call SHELL_REMOVE_DIR,${BUILD_BASE})
546	$(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*)
547	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
548	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
549
550checkcodebase:		locate-checkpatch
551	@echo "  CHECKING STYLE"
552	@if test -d .git ; then	\
553		git ls-files | grep -v stdlib | while read GIT_FILE ; do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; done ;	\
554	 else			\
555		 find . -type f -not -iwholename "*.git*" -not -iwholename "*build*" -not -iwholename "*stdlib*" -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ;	\
556	 fi
557
558checkpatch:		locate-checkpatch
559	@echo "  CHECKING STYLE"
560	${Q}git log -p ${BASE_COMMIT}..HEAD -- ${CHECK_PATHS} | ${CHECKPATCH} ${CHECKPATCH_ARGS} - || true
561
562certtool: ${CRTTOOL}
563
564.PHONY: ${CRTTOOL}
565${CRTTOOL}:
566	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH}
567	@${ECHO_BLANK_LINE}
568	@echo "Built $@ successfully"
569	@${ECHO_BLANK_LINE}
570
571ifneq (${GENERATE_COT},0)
572certificates: ${CRT_DEPS} ${CRTTOOL}
573	${Q}${CRTTOOL} ${CRT_ARGS}
574	@${ECHO_BLANK_LINE}
575	@echo "Built $@ successfully"
576	@echo "Certificates can be found in ${BUILD_PLAT}"
577	@${ECHO_BLANK_LINE}
578endif
579
580${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL}
581	${Q}${FIPTOOL} --dump ${FIP_ARGS} $@
582	@${ECHO_BLANK_LINE}
583	@echo "Built $@ successfully"
584	@${ECHO_BLANK_LINE}
585
586ifneq (${GENERATE_COT},0)
587fwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL}
588	${Q}${CRTTOOL} ${FWU_CRT_ARGS}
589	@echo
590	@echo "Built $@ successfully"
591	@echo "FWU certificates can be found in ${BUILD_PLAT}"
592	@echo
593endif
594
595${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL}
596	${Q}${FIPTOOL} --dump ${FWU_FIP_ARGS} $@
597	@echo
598	@echo "Built $@ successfully"
599	@echo
600
601fiptool: ${FIPTOOL}
602fip: ${BUILD_PLAT}/${FIP_NAME}
603fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME}
604
605.PHONY: ${FIPTOOL}
606${FIPTOOL}:
607	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH}
608
609cscope:
610	@echo "  CSCOPE"
611	${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files
612	${Q}cscope -b -q -k
613
614help:
615	@echo "usage: ${MAKE} PLAT=<${PLATFORM_LIST}> [OPTIONS] [TARGET]"
616	@echo ""
617	@echo "PLAT is used to specify which platform you wish to build."
618	@echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}"
619	@echo ""
620	@echo "Please refer to the User Guide for a list of all supported options."
621	@echo "Note that the build system doesn't track dependencies for build "
622	@echo "options. Therefore, if any of the build options are changed "
623	@echo "from a previous build, a clean build must be performed."
624	@echo ""
625	@echo "Supported Targets:"
626	@echo "  all            Build all individual bootloader binaries"
627	@echo "  bl1            Build the BL1 binary"
628	@echo "  bl2            Build the BL2 binary"
629	@echo "  bl2u           Build the BL2U binary"
630	@echo "  bl31           Build the BL31 binary"
631	@echo "  bl32           Build the BL32 binary"
632	@echo "  certificates   Build the certificates (requires 'GENERATE_COT=1')"
633	@echo "  fip            Build the Firmware Image Package (FIP)"
634	@echo "  fwu_fip        Build the FWU Firmware Image Package (FIP)"
635	@echo "  checkcodebase  Check the coding style of the entire source tree"
636	@echo "  checkpatch     Check the coding style on changes in the current"
637	@echo "                 branch against BASE_COMMIT (default origin/master)"
638	@echo "  clean          Clean the build for the selected platform"
639	@echo "  cscope         Generate cscope index"
640	@echo "  distclean      Remove all build artifacts for all platforms"
641	@echo "  certtool       Build the Certificate generation tool"
642	@echo "  fiptool        Build the Firmware Image Package(FIP) creation tool"
643	@echo ""
644	@echo "Note: most build targets require PLAT to be set to a specific platform."
645	@echo ""
646	@echo "example: build all targets for the FVP platform:"
647	@echo "  CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all"
648