xref: /rk3399_ARM-atf/Makefile (revision f2f5a7bd182f0e35bc65ed5622a9be83cd0f2d67)
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/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 BL33_BASE
310                $(warning "BL33_BASE and EL3_PAYLOAD_BASE are incompatible \
311                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 BL33_BASE
321                $(warning "BL33 image is not needed when option BL33_BASE is \
322                used and won't be added to the FIP file.")
323        endif
324endif
325
326
327################################################################################
328# Process platform overrideable behaviour
329################################################################################
330
331# Check if -pedantic option should be used
332ifeq (${DISABLE_PEDANTIC},0)
333        CFLAGS		+= 	-pedantic
334endif
335
336# Using the ARM Trusted Firmware BL2 implies that a BL33 image also needs to be
337# supplied for the FIP and Certificate generation tools. This flag can be
338# overridden by the platform.
339ifdef BL2_SOURCES
340        ifdef EL3_PAYLOAD_BASE
341                # If booting an EL3 payload there is no need for a BL33 image
342                # in the FIP file.
343                NEED_BL33		:=	no
344        else
345                ifdef BL33_BASE
346                        # If booting a BL33 preloaded image there is no need of
347                        # another one in the FIP file.
348                        NEED_BL33		:=	no
349                else
350                        NEED_BL33		?=	yes
351                endif
352        endif
353endif
354
355# Process TBB related flags
356ifneq (${GENERATE_COT},0)
357        # Common cert_create options
358        ifneq (${CREATE_KEYS},0)
359                $(eval CRT_ARGS += -n)
360                $(eval FWU_CRT_ARGS += -n)
361                ifneq (${SAVE_KEYS},0)
362                        $(eval CRT_ARGS += -k)
363                        $(eval FWU_CRT_ARGS += -k)
364                endif
365        endif
366        # Include TBBR makefile (unless the platform indicates otherwise)
367        ifeq (${INCLUDE_TBBR_MK},1)
368                include make_helpers/tbbr/tbbr_tools.mk
369        endif
370endif
371
372
373################################################################################
374# Auxiliary tools (fip_create, cert_create, etc)
375################################################################################
376
377# Variables for use with Certificate Generation Tool
378CRTTOOLPATH		?=	tools/cert_create
379CRTTOOL			?=	${CRTTOOLPATH}/cert_create${BIN_EXT}
380
381# Variables for use with Firmware Image Package
382FIPTOOLPATH		?=	tools/fip_create
383FIPTOOL			?=	${FIPTOOLPATH}/fip_create${BIN_EXT}
384
385
386################################################################################
387# Build options checks
388################################################################################
389
390$(eval $(call assert_boolean,DEBUG))
391$(eval $(call assert_boolean,NS_TIMER_SWITCH))
392$(eval $(call assert_boolean,RESET_TO_BL31))
393$(eval $(call assert_boolean,CTX_INCLUDE_FPREGS))
394$(eval $(call assert_boolean,ASM_ASSERTION))
395$(eval $(call assert_boolean,USE_COHERENT_MEM))
396$(eval $(call assert_boolean,DISABLE_PEDANTIC))
397$(eval $(call assert_boolean,GENERATE_COT))
398$(eval $(call assert_boolean,CREATE_KEYS))
399$(eval $(call assert_boolean,SAVE_KEYS))
400$(eval $(call assert_boolean,TRUSTED_BOARD_BOOT))
401$(eval $(call assert_boolean,PROGRAMMABLE_RESET_ADDRESS))
402$(eval $(call assert_boolean,COLD_BOOT_SINGLE_CPU))
403$(eval $(call assert_boolean,PSCI_EXTENDED_STATE_ID))
404$(eval $(call assert_boolean,ERROR_DEPRECATED))
405$(eval $(call assert_boolean,ENABLE_PLAT_COMPAT))
406$(eval $(call assert_boolean,SPIN_ON_BL1_EXIT))
407$(eval $(call assert_boolean,PL011_GENERIC_UART))
408
409
410################################################################################
411# Add definitions to the cpp preprocessor based on the current build options.
412# This is done after including the platform specific makefile to allow the
413# platform to overwrite the default options
414################################################################################
415
416$(eval $(call add_define,PLAT_${PLAT}))
417$(eval $(call add_define,NS_TIMER_SWITCH))
418$(eval $(call add_define,RESET_TO_BL31))
419$(eval $(call add_define,CTX_INCLUDE_FPREGS))
420$(eval $(call add_define,ARM_GIC_ARCH))
421$(eval $(call add_define,ARM_CCI_PRODUCT_ID))
422$(eval $(call add_define,ASM_ASSERTION))
423$(eval $(call add_define,LOG_LEVEL))
424$(eval $(call add_define,USE_COHERENT_MEM))
425$(eval $(call add_define,TRUSTED_BOARD_BOOT))
426$(eval $(call add_define,PROGRAMMABLE_RESET_ADDRESS))
427$(eval $(call add_define,COLD_BOOT_SINGLE_CPU))
428$(eval $(call add_define,PSCI_EXTENDED_STATE_ID))
429$(eval $(call add_define,ERROR_DEPRECATED))
430$(eval $(call add_define,ENABLE_PLAT_COMPAT))
431$(eval $(call add_define,SPIN_ON_BL1_EXIT))
432$(eval $(call add_define,PL011_GENERIC_UART))
433# Define the EL3_PAYLOAD_BASE flag only if it is provided.
434ifdef EL3_PAYLOAD_BASE
435        $(eval $(call add_define,EL3_PAYLOAD_BASE))
436else
437        # Define the BL33_BASE flag only if it is provided and EL3_PAYLOAD_BASE
438        # is not defined, as it has priority.
439        ifdef BL33_BASE
440                $(eval $(call add_define,BL33_BASE))
441        endif
442endif
443
444
445################################################################################
446# Include BL specific makefiles
447################################################################################
448
449ifdef BL1_SOURCES
450NEED_BL1 := yes
451include bl1/bl1.mk
452endif
453
454ifdef BL2_SOURCES
455NEED_BL2 := yes
456include bl2/bl2.mk
457endif
458
459ifdef BL2U_SOURCES
460NEED_BL2U := yes
461include bl2u/bl2u.mk
462endif
463
464ifdef BL31_SOURCES
465# When booting an EL3 payload, there is no need to compile the BL31 image nor
466# put it in the FIP.
467ifndef EL3_PAYLOAD_BASE
468NEED_BL31 := yes
469include bl31/bl31.mk
470endif
471endif
472
473
474################################################################################
475# Build targets
476################################################################################
477
478.PHONY:	all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool fip fwu_fip certtool
479.SUFFIXES:
480
481all: msg_start
482
483msg_start:
484	@echo "Building ${PLAT}"
485
486# Check if deprecated declarations should be treated as error or not.
487ifeq (${ERROR_DEPRECATED},0)
488    CFLAGS		+= 	-Wno-error=deprecated-declarations
489endif
490
491# Expand build macros for the different images
492ifeq (${NEED_BL1},yes)
493$(eval $(call MAKE_BL,1))
494endif
495
496ifeq (${NEED_BL2},yes)
497$(if ${BL2}, $(eval $(call MAKE_TOOL_ARGS,2,${BL2},tb-fw)),\
498	$(eval $(call MAKE_BL,2,tb-fw)))
499endif
500
501ifeq (${NEED_BL31},yes)
502BL31_SOURCES += ${SPD_SOURCES}
503$(if ${BL31}, $(eval $(call MAKE_TOOL_ARGS,31,${BL31},soc-fw)),\
504	$(eval $(call MAKE_BL,31,soc-fw)))
505endif
506
507# If a BL32 image is needed but neither BL32 nor BL32_SOURCES is defined, the
508# build system will call FIP_ADD_IMG to print a warning message and abort the
509# process. Note that the dependency on BL32 applies to the FIP only.
510ifeq (${NEED_BL32},yes)
511$(if ${BL32}, $(eval $(call MAKE_TOOL_ARGS,32,${BL32},tos-fw)),\
512	$(if ${BL32_SOURCES}, $(eval $(call MAKE_BL,32,tos-fw)),\
513		$(eval $(call FIP_ADD_IMG,BL32,--tos-fw))))
514endif
515
516# Add the BL33 image if required by the platform
517ifeq (${NEED_BL33},yes)
518$(eval $(call FIP_ADD_IMG,BL33,--nt-fw))
519endif
520
521ifeq (${NEED_BL2U},yes)
522BL2U_PATH	:= $(if ${BL2U},${BL2U},$(call IMG_BIN,2u))
523$(if ${BL2U}, ,$(eval $(call MAKE_BL,2u)))
524$(eval $(call FWU_FIP_ADD_PAYLOAD,${BL2U_PATH},--ap-fwu-cfg))
525endif
526
527locate-checkpatch:
528ifndef CHECKPATCH
529	$(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/script/checkpatch.pl")
530else
531ifeq (,$(wildcard ${CHECKPATCH}))
532	$(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/script/checkpatch.pl")
533endif
534endif
535
536clean:
537	@echo "  CLEAN"
538	$(call SHELL_REMOVE_DIR,${BUILD_PLAT})
539	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
540	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
541
542realclean distclean:
543	@echo "  REALCLEAN"
544	$(call SHELL_REMOVE_DIR,${BUILD_BASE})
545	$(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*)
546	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
547	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
548
549checkcodebase:		locate-checkpatch
550	@echo "  CHECKING STYLE"
551	@if test -d .git ; then	\
552		git ls-files | grep -v stdlib | while read GIT_FILE ; do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; done ;	\
553	 else			\
554		 find . -type f -not -iwholename "*.git*" -not -iwholename "*build*" -not -iwholename "*stdlib*" -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ;	\
555	 fi
556
557checkpatch:		locate-checkpatch
558	@echo "  CHECKING STYLE"
559	${Q}git log -p ${BASE_COMMIT}..HEAD -- ${CHECK_PATHS} | ${CHECKPATCH} ${CHECKPATCH_ARGS} - || true
560
561certtool: ${CRTTOOL}
562
563.PHONY: ${CRTTOOL}
564${CRTTOOL}:
565	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH}
566	@${ECHO_BLANK_LINE}
567	@echo "Built $@ successfully"
568	@${ECHO_BLANK_LINE}
569
570ifneq (${GENERATE_COT},0)
571certificates: ${CRT_DEPS} ${CRTTOOL}
572	${Q}${CRTTOOL} ${CRT_ARGS}
573	@${ECHO_BLANK_LINE}
574	@echo "Built $@ successfully"
575	@echo "Certificates can be found in ${BUILD_PLAT}"
576	@${ECHO_BLANK_LINE}
577endif
578
579${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL}
580	${Q}${FIPTOOL} --dump ${FIP_ARGS} $@
581	@${ECHO_BLANK_LINE}
582	@echo "Built $@ successfully"
583	@${ECHO_BLANK_LINE}
584
585ifneq (${GENERATE_COT},0)
586fwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL}
587	${Q}${CRTTOOL} ${FWU_CRT_ARGS}
588	@echo
589	@echo "Built $@ successfully"
590	@echo "FWU certificates can be found in ${BUILD_PLAT}"
591	@echo
592endif
593
594${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL}
595	${Q}${FIPTOOL} --dump ${FWU_FIP_ARGS} $@
596	@echo
597	@echo "Built $@ successfully"
598	@echo
599
600fiptool: ${FIPTOOL}
601fip: ${BUILD_PLAT}/${FIP_NAME}
602fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME}
603
604.PHONY: ${FIPTOOL}
605${FIPTOOL}:
606	${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH}
607
608cscope:
609	@echo "  CSCOPE"
610	${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files
611	${Q}cscope -b -q -k
612
613help:
614	@echo "usage: ${MAKE} PLAT=<${PLATFORM_LIST}> [OPTIONS] [TARGET]"
615	@echo ""
616	@echo "PLAT is used to specify which platform you wish to build."
617	@echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}"
618	@echo ""
619	@echo "Please refer to the User Guide for a list of all supported options."
620	@echo "Note that the build system doesn't track dependencies for build "
621	@echo "options. Therefore, if any of the build options are changed "
622	@echo "from a previous build, a clean build must be performed."
623	@echo ""
624	@echo "Supported Targets:"
625	@echo "  all            Build all individual bootloader binaries"
626	@echo "  bl1            Build the BL1 binary"
627	@echo "  bl2            Build the BL2 binary"
628	@echo "  bl2u           Build the BL2U binary"
629	@echo "  bl31           Build the BL31 binary"
630	@echo "  bl32           Build the BL32 binary"
631	@echo "  certificates   Build the certificates (requires 'GENERATE_COT=1')"
632	@echo "  fip            Build the Firmware Image Package (FIP)"
633	@echo "  fwu_fip        Build the FWU Firmware Image Package (FIP)"
634	@echo "  checkcodebase  Check the coding style of the entire source tree"
635	@echo "  checkpatch     Check the coding style on changes in the current"
636	@echo "                 branch against BASE_COMMIT (default origin/master)"
637	@echo "  clean          Clean the build for the selected platform"
638	@echo "  cscope         Generate cscope index"
639	@echo "  distclean      Remove all build artifacts for all platforms"
640	@echo "  certtool       Build the Certificate generation tool"
641	@echo "  fiptool        Build the Firmware Image Package(FIP) creation tool"
642	@echo ""
643	@echo "Note: most build targets require PLAT to be set to a specific platform."
644	@echo ""
645	@echo "example: build all targets for the FVP platform:"
646	@echo "  CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all"
647