xref: /rk3399_ARM-atf/Makefile (revision f0b489c1d2d4d176c06e34af9e881303816a5584)
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 imported library files or documentation files
116INC_LIB_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
117					include/lib/stdlib,		\
118					$(wildcard include/lib/*)))
119INC_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
120					include/lib,			\
121					$(wildcard include/*)))
122LIB_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
123					lib/stdlib,			\
124					$(wildcard lib/*)))
125ROOT_DIRS_TO_CHECK	:=	$(sort $(filter-out			\
126					lib				\
127					include				\
128					docs				\
129					%.md,				\
130					$(wildcard *)))
131CHECK_PATHS		:=	${ROOT_DIRS_TO_CHECK}			\
132				${INC_DIRS_TO_CHECK}			\
133				${INC_LIB_DIRS_TO_CHECK}		\
134				${LIB_DIRS_TO_CHECK}
135
136
137################################################################################
138# Process build options
139################################################################################
140
141# Verbose flag
142ifeq (${V},0)
143        Q:=@
144        CHECKCODE_ARGS	+=	--no-summary --terse
145else
146        Q:=
147endif
148export Q
149
150# Process Debug flag
151$(eval $(call add_define,DEBUG))
152ifneq (${DEBUG}, 0)
153        BUILD_TYPE	:=	debug
154        TF_CFLAGS	+= 	-g
155        ASFLAGS		+= 	-g -Wa,--gdwarf-2
156        # Use LOG_LEVEL_INFO by default for debug builds
157        LOG_LEVEL	:=	40
158else
159        BUILD_TYPE	:=	release
160        $(eval $(call add_define,NDEBUG))
161        # Use LOG_LEVEL_NOTICE by default for release builds
162        LOG_LEVEL	:=	20
163endif
164
165# Default build string (git branch and commit)
166ifeq (${BUILD_STRING},)
167        BUILD_STRING	:=	$(shell git log -n 1 --pretty=format:"%h")
168endif
169VERSION_STRING		:=	v${VERSION_MAJOR}.${VERSION_MINOR}(${BUILD_TYPE}):${BUILD_STRING}
170
171# The cert_create tool cannot generate certificates individually, so we use the
172# target 'certificates' to create them all
173ifneq (${GENERATE_COT},0)
174        FIP_DEPS += certificates
175        FWU_FIP_DEPS += fwu_certificates
176endif
177
178
179################################################################################
180# Toolchain
181################################################################################
182
183CC			:=	${CROSS_COMPILE}gcc
184CPP			:=	${CROSS_COMPILE}cpp
185AS			:=	${CROSS_COMPILE}gcc
186AR			:=	${CROSS_COMPILE}ar
187LD			:=	${CROSS_COMPILE}ld
188OC			:=	${CROSS_COMPILE}objcopy
189OD			:=	${CROSS_COMPILE}objdump
190NM			:=	${CROSS_COMPILE}nm
191PP			:=	${CROSS_COMPILE}gcc -E
192
193ASFLAGS			+= 	-nostdinc -ffreestanding -Wa,--fatal-warnings	\
194				-Werror -Wmissing-include-dirs			\
195				-mgeneral-regs-only -D__ASSEMBLY__		\
196				${DEFINES} ${INCLUDES}
197TF_CFLAGS		+= 	-nostdinc -ffreestanding -Wall			\
198				-Werror -Wmissing-include-dirs			\
199				-mgeneral-regs-only -mstrict-align		\
200				-std=c99 -c -Os					\
201				${DEFINES} ${INCLUDES}
202TF_CFLAGS		+=	-ffunction-sections -fdata-sections
203
204LDFLAGS			+=	--fatal-warnings -O1
205LDFLAGS			+=	--gc-sections
206
207
208################################################################################
209# Common sources and include directories
210################################################################################
211include lib/stdlib/stdlib.mk
212
213BL_COMMON_SOURCES	+=	common/bl_common.c			\
214				common/tf_printf.c			\
215				common/aarch64/debug.S			\
216				lib/aarch64/cache_helpers.S		\
217				lib/aarch64/misc_helpers.S		\
218				plat/common/aarch64/platform_helpers.S	\
219				${STDLIB_SRCS}
220
221INCLUDES		+=	-Iinclude/bl1			\
222				-Iinclude/bl31			\
223				-Iinclude/bl31/services		\
224				-Iinclude/common		\
225				-Iinclude/drivers		\
226				-Iinclude/drivers/arm		\
227				-Iinclude/drivers/auth		\
228				-Iinclude/drivers/io		\
229				-Iinclude/drivers/ti/uart	\
230				-Iinclude/lib			\
231				-Iinclude/lib/aarch64		\
232				-Iinclude/lib/cpus/aarch64	\
233				-Iinclude/plat/common		\
234				${PLAT_INCLUDES}		\
235				${SPD_INCLUDES}
236
237
238################################################################################
239# Generic definitions
240################################################################################
241
242include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk
243
244BUILD_BASE		:=	./build
245BUILD_PLAT		:=	${BUILD_BASE}/${PLAT}/${BUILD_TYPE}
246
247SPDS			:=	$(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*))))
248
249# Platforms providing their own TBB makefile may override this value
250INCLUDE_TBBR_MK		:=	1
251
252
253################################################################################
254# Include SPD Makefile if one has been specified
255################################################################################
256
257ifneq (${SPD},none)
258ifdef EL3_PAYLOAD_BASE
259        $(warning "SPD and EL3_PAYLOAD_BASE are incompatible build options.")
260        $(warning "The SPD and its BL32 companion will be present but ignored.")
261endif
262        # We expect to locate an spd.mk under the specified SPD directory
263        SPD_MAKE	:=	$(wildcard services/spd/${SPD}/${SPD}.mk)
264
265        ifeq (${SPD_MAKE},)
266                $(error Error: No services/spd/${SPD}/${SPD}.mk located)
267        endif
268        $(info Including ${SPD_MAKE})
269        include ${SPD_MAKE}
270
271        # If there's BL32 companion for the chosen SPD, we expect that the SPD's
272        # Makefile would set NEED_BL32 to "yes". In this case, the build system
273        # supports two mutually exclusive options:
274        # * BL32 is built from source: then BL32_SOURCES must contain the list
275        #   of source files to build BL32
276        # * BL32 is a prebuilt binary: then BL32 must point to the image file
277        #   that will be included in the FIP
278        # If both BL32_SOURCES and BL32 are defined, the binary takes precedence
279        # over the sources.
280endif
281
282
283################################################################################
284# Include the platform specific Makefile after the SPD Makefile (the platform
285# makefile may use all previous definitions in this file)
286################################################################################
287
288include ${PLAT_MAKEFILE_FULL}
289
290# If the platform has not defined ENABLE_PLAT_COMPAT, then enable it by default
291ifndef ENABLE_PLAT_COMPAT
292ENABLE_PLAT_COMPAT := 1
293endif
294
295# Include the platform compatibility helpers for PSCI
296ifneq (${ENABLE_PLAT_COMPAT}, 0)
297include plat/compat/plat_compat.mk
298endif
299
300# Include the CPU specific operations makefile, which provides default
301# values for all CPU errata workarounds and CPU specific optimisations.
302# This can be overridden by the platform.
303include lib/cpus/cpu-ops.mk
304
305
306################################################################################
307# Check incompatible options
308################################################################################
309
310ifdef EL3_PAYLOAD_BASE
311        ifdef PRELOADED_BL33_BASE
312                $(warning "PRELOADED_BL33_BASE and EL3_PAYLOAD_BASE are \
313                incompatible build options. EL3_PAYLOAD_BASE has priority.")
314        endif
315endif
316
317ifeq (${NEED_BL33},yes)
318        ifdef EL3_PAYLOAD_BASE
319                $(warning "BL33 image is not needed when option \
320                BL33_PAYLOAD_BASE is used and won't be added to the FIP file.")
321        endif
322        ifdef PRELOADED_BL33_BASE
323                $(warning "BL33 image is not needed when option \
324                PRELOADED_BL33_BASE is used and won't be added to the FIP \
325                file.")
326        endif
327endif
328
329
330################################################################################
331# Process platform overrideable behaviour
332################################################################################
333
334# Check if -pedantic option should be used
335ifeq (${DISABLE_PEDANTIC},0)
336        TF_CFLAGS	+= 	-pedantic
337endif
338
339# Using the ARM Trusted Firmware BL2 implies that a BL33 image also needs to be
340# supplied for the FIP and Certificate generation tools. This flag can be
341# overridden by the platform.
342ifdef BL2_SOURCES
343        ifdef EL3_PAYLOAD_BASE
344                # If booting an EL3 payload there is no need for a BL33 image
345                # in the FIP file.
346                NEED_BL33		:=	no
347        else
348                ifdef PRELOADED_BL33_BASE
349                        # If booting a BL33 preloaded image there is no need of
350                        # another one in the FIP file.
351                        NEED_BL33		:=	no
352                else
353                        NEED_BL33		?=	yes
354                endif
355        endif
356endif
357
358# Process TBB related flags
359ifneq (${GENERATE_COT},0)
360        # Common cert_create options
361        ifneq (${CREATE_KEYS},0)
362                $(eval CRT_ARGS += -n)
363                $(eval FWU_CRT_ARGS += -n)
364                ifneq (${SAVE_KEYS},0)
365                        $(eval CRT_ARGS += -k)
366                        $(eval FWU_CRT_ARGS += -k)
367                endif
368        endif
369        # Include TBBR makefile (unless the platform indicates otherwise)
370        ifeq (${INCLUDE_TBBR_MK},1)
371                include make_helpers/tbbr/tbbr_tools.mk
372        endif
373endif
374
375
376################################################################################
377# Auxiliary tools (fip_create, cert_create, etc)
378################################################################################
379
380# Variables for use with Certificate Generation Tool
381CRTTOOLPATH		?=	tools/cert_create
382CRTTOOL			?=	${CRTTOOLPATH}/cert_create${BIN_EXT}
383
384# Variables for use with Firmware Image Package
385FIPTOOLPATH		?=	tools/fip_create
386FIPTOOL			?=	${FIPTOOLPATH}/fip_create${BIN_EXT}
387
388
389################################################################################
390# Build options checks
391################################################################################
392
393$(eval $(call assert_boolean,DEBUG))
394$(eval $(call assert_boolean,NS_TIMER_SWITCH))
395$(eval $(call assert_boolean,RESET_TO_BL31))
396$(eval $(call assert_boolean,CTX_INCLUDE_FPREGS))
397$(eval $(call assert_boolean,ASM_ASSERTION))
398$(eval $(call assert_boolean,USE_COHERENT_MEM))
399$(eval $(call assert_boolean,DISABLE_PEDANTIC))
400$(eval $(call assert_boolean,GENERATE_COT))
401$(eval $(call assert_boolean,CREATE_KEYS))
402$(eval $(call assert_boolean,SAVE_KEYS))
403$(eval $(call assert_boolean,TRUSTED_BOARD_BOOT))
404$(eval $(call assert_boolean,PROGRAMMABLE_RESET_ADDRESS))
405$(eval $(call assert_boolean,COLD_BOOT_SINGLE_CPU))
406$(eval $(call assert_boolean,PSCI_EXTENDED_STATE_ID))
407$(eval $(call assert_boolean,ERROR_DEPRECATED))
408$(eval $(call assert_boolean,ENABLE_PLAT_COMPAT))
409$(eval $(call assert_boolean,SPIN_ON_BL1_EXIT))
410$(eval $(call assert_boolean,PL011_GENERIC_UART))
411
412
413################################################################################
414# Add definitions to the cpp preprocessor based on the current build options.
415# This is done after including the platform specific makefile to allow the
416# platform to overwrite the default options
417################################################################################
418
419$(eval $(call add_define,PLAT_${PLAT}))
420$(eval $(call add_define,SPD_${SPD}))
421$(eval $(call add_define,NS_TIMER_SWITCH))
422$(eval $(call add_define,RESET_TO_BL31))
423$(eval $(call add_define,CTX_INCLUDE_FPREGS))
424$(eval $(call add_define,ARM_GIC_ARCH))
425$(eval $(call add_define,ARM_CCI_PRODUCT_ID))
426$(eval $(call add_define,ASM_ASSERTION))
427$(eval $(call add_define,LOG_LEVEL))
428$(eval $(call add_define,USE_COHERENT_MEM))
429$(eval $(call add_define,TRUSTED_BOARD_BOOT))
430$(eval $(call add_define,PROGRAMMABLE_RESET_ADDRESS))
431$(eval $(call add_define,COLD_BOOT_SINGLE_CPU))
432$(eval $(call add_define,PSCI_EXTENDED_STATE_ID))
433$(eval $(call add_define,ERROR_DEPRECATED))
434$(eval $(call add_define,ENABLE_PLAT_COMPAT))
435$(eval $(call add_define,SPIN_ON_BL1_EXIT))
436$(eval $(call add_define,PL011_GENERIC_UART))
437# Define the EL3_PAYLOAD_BASE flag only if it is provided.
438ifdef EL3_PAYLOAD_BASE
439        $(eval $(call add_define,EL3_PAYLOAD_BASE))
440else
441        # Define the PRELOADED_BL33_BASE flag only if it is provided and
442        # EL3_PAYLOAD_BASE is not defined, as it has priority.
443        ifdef PRELOADED_BL33_BASE
444                $(eval $(call add_define,PRELOADED_BL33_BASE))
445        endif
446endif
447
448
449################################################################################
450# Include BL specific makefiles
451################################################################################
452
453ifdef BL1_SOURCES
454NEED_BL1 := yes
455include bl1/bl1.mk
456endif
457
458ifdef BL2_SOURCES
459NEED_BL2 := yes
460include bl2/bl2.mk
461endif
462
463ifdef BL2U_SOURCES
464NEED_BL2U := yes
465include bl2u/bl2u.mk
466endif
467
468ifdef BL31_SOURCES
469# When booting an EL3 payload, there is no need to compile the BL31 image nor
470# put it in the FIP.
471ifndef EL3_PAYLOAD_BASE
472NEED_BL31 := yes
473include bl31/bl31.mk
474endif
475endif
476
477
478################################################################################
479# Build targets
480################################################################################
481
482.PHONY:	all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool fip fwu_fip certtool
483.SUFFIXES:
484
485all: msg_start
486
487msg_start:
488	@echo "Building ${PLAT}"
489
490# Check if deprecated declarations should be treated as error or not.
491ifeq (${ERROR_DEPRECATED},0)
492    TF_CFLAGS		+= 	-Wno-error=deprecated-declarations
493endif
494
495# Expand build macros for the different images
496ifeq (${NEED_BL1},yes)
497$(eval $(call MAKE_BL,1))
498endif
499
500ifeq (${NEED_BL2},yes)
501$(if ${BL2}, $(eval $(call MAKE_TOOL_ARGS,2,${BL2},tb-fw)),\
502	$(eval $(call MAKE_BL,2,tb-fw)))
503endif
504
505ifeq (${NEED_BL31},yes)
506BL31_SOURCES += ${SPD_SOURCES}
507$(if ${BL31}, $(eval $(call MAKE_TOOL_ARGS,31,${BL31},soc-fw)),\
508	$(eval $(call MAKE_BL,31,soc-fw)))
509endif
510
511# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the
512# build system will call FIP_ADD_IMG to print a warning message and abort the
513# process. Note that the dependency on BL32 applies to the FIP only.
514ifeq (${NEED_BL32},yes)
515$(if ${BL32}, $(eval $(call MAKE_TOOL_ARGS,32,${BL32},tos-fw)),\
516	$(if ${BL32_SOURCES}, $(eval $(call MAKE_BL,32,tos-fw)),\
517		$(eval $(call FIP_ADD_IMG,BL32,--tos-fw))))
518endif
519
520# Add the BL33 image if required by the platform
521ifeq (${NEED_BL33},yes)
522$(eval $(call FIP_ADD_IMG,BL33,--nt-fw))
523endif
524
525ifeq (${NEED_BL2U},yes)
526BL2U_PATH	:= $(if ${BL2U},${BL2U},$(call IMG_BIN,2u))
527$(if ${BL2U}, ,$(eval $(call MAKE_BL,2u)))
528$(eval $(call FWU_FIP_ADD_PAYLOAD,${BL2U_PATH},--ap-fwu-cfg))
529endif
530
531locate-checkpatch:
532ifndef CHECKPATCH
533	$(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/script/checkpatch.pl")
534else
535ifeq (,$(wildcard ${CHECKPATCH}))
536	$(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/script/checkpatch.pl")
537endif
538endif
539
540clean:
541	@echo "  CLEAN"
542	$(call SHELL_REMOVE_DIR,${BUILD_PLAT})
543	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
544	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
545
546realclean distclean:
547	@echo "  REALCLEAN"
548	$(call SHELL_REMOVE_DIR,${BUILD_BASE})
549	$(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*)
550	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
551	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
552
553checkcodebase:		locate-checkpatch
554	@echo "  CHECKING STYLE"
555	@if test -d .git ; then	\
556		git ls-files | grep -v stdlib | while read GIT_FILE ; do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; done ;	\
557	 else			\
558		 find . -type f -not -iwholename "*.git*" -not -iwholename "*build*" -not -iwholename "*stdlib*" -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ;	\
559	 fi
560
561checkpatch:		locate-checkpatch
562	@echo "  CHECKING STYLE"
563	${Q}git log -p ${BASE_COMMIT}..HEAD -- ${CHECK_PATHS} | ${CHECKPATCH} ${CHECKPATCH_ARGS} - || true
564
565certtool: ${CRTTOOL}
566
567.PHONY: ${CRTTOOL}
568${CRTTOOL}:
569	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH}
570	@${ECHO_BLANK_LINE}
571	@echo "Built $@ successfully"
572	@${ECHO_BLANK_LINE}
573
574ifneq (${GENERATE_COT},0)
575certificates: ${CRT_DEPS} ${CRTTOOL}
576	${Q}${CRTTOOL} ${CRT_ARGS}
577	@${ECHO_BLANK_LINE}
578	@echo "Built $@ successfully"
579	@echo "Certificates can be found in ${BUILD_PLAT}"
580	@${ECHO_BLANK_LINE}
581endif
582
583${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL}
584	${Q}${FIPTOOL} --dump ${FIP_ARGS} $@
585	@${ECHO_BLANK_LINE}
586	@echo "Built $@ successfully"
587	@${ECHO_BLANK_LINE}
588
589ifneq (${GENERATE_COT},0)
590fwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL}
591	${Q}${CRTTOOL} ${FWU_CRT_ARGS}
592	@echo
593	@echo "Built $@ successfully"
594	@echo "FWU certificates can be found in ${BUILD_PLAT}"
595	@echo
596endif
597
598${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL}
599	${Q}${FIPTOOL} --dump ${FWU_FIP_ARGS} $@
600	@echo
601	@echo "Built $@ successfully"
602	@echo
603
604fiptool: ${FIPTOOL}
605fip: ${BUILD_PLAT}/${FIP_NAME}
606fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME}
607
608.PHONY: ${FIPTOOL}
609${FIPTOOL}:
610	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH}
611
612cscope:
613	@echo "  CSCOPE"
614	${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files
615	${Q}cscope -b -q -k
616
617help:
618	@echo "usage: ${MAKE} PLAT=<${PLATFORM_LIST}> [OPTIONS] [TARGET]"
619	@echo ""
620	@echo "PLAT is used to specify which platform you wish to build."
621	@echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}"
622	@echo ""
623	@echo "Please refer to the User Guide for a list of all supported options."
624	@echo "Note that the build system doesn't track dependencies for build "
625	@echo "options. Therefore, if any of the build options are changed "
626	@echo "from a previous build, a clean build must be performed."
627	@echo ""
628	@echo "Supported Targets:"
629	@echo "  all            Build all individual bootloader binaries"
630	@echo "  bl1            Build the BL1 binary"
631	@echo "  bl2            Build the BL2 binary"
632	@echo "  bl2u           Build the BL2U binary"
633	@echo "  bl31           Build the BL31 binary"
634	@echo "  bl32           Build the BL32 binary"
635	@echo "  certificates   Build the certificates (requires 'GENERATE_COT=1')"
636	@echo "  fip            Build the Firmware Image Package (FIP)"
637	@echo "  fwu_fip        Build the FWU Firmware Image Package (FIP)"
638	@echo "  checkcodebase  Check the coding style of the entire source tree"
639	@echo "  checkpatch     Check the coding style on changes in the current"
640	@echo "                 branch against BASE_COMMIT (default origin/master)"
641	@echo "  clean          Clean the build for the selected platform"
642	@echo "  cscope         Generate cscope index"
643	@echo "  distclean      Remove all build artifacts for all platforms"
644	@echo "  certtool       Build the Certificate generation tool"
645	@echo "  fiptool        Build the Firmware Image Package(FIP) creation tool"
646	@echo ""
647	@echo "Note: most build targets require PLAT to be set to a specific platform."
648	@echo ""
649	@echo "example: build all targets for the FVP platform:"
650	@echo "  CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all"
651