blob: 97988c434db4054810f9153739fe6afd00d82772 [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001#
Dan Handleye83b0ca2014-01-14 18:17:09 +00002# Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
Achin Gupta4f6ad662013-10-25 09:08:21 +01003#
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# Decrease the verbosity of the make script
32# can be made verbose by passing V=1 at the make command line
33ifdef V
James Morrisseyeaaeece2013-11-01 13:56:59 +000034 KBUILD_VERBOSE = ${V}
Achin Gupta4f6ad662013-10-25 09:08:21 +010035else
36 KBUILD_VERBOSE = 0
37endif
38
Achin Gupta7421b462014-02-01 18:53:26 +000039# Checkpatch ignores
40CHECK_IGNORE = --ignore COMPLEX_MACRO
41
42CHECKPATCH_ARGS = --no-tree --no-signoff ${CHECK_IGNORE}
43CHECKCODE_ARGS = --no-patch --no-tree --no-signoff ${CHECK_IGNORE}
Ian Spray36eaaf32014-01-30 17:25:28 +000044
James Morrisseyeaaeece2013-11-01 13:56:59 +000045ifeq "${KBUILD_VERBOSE}" "0"
Achin Gupta4f6ad662013-10-25 09:08:21 +010046 Q=@
Ian Spray36eaaf32014-01-30 17:25:28 +000047 CHECKCODE_ARGS += --no-summary --terse
Achin Gupta4f6ad662013-10-25 09:08:21 +010048else
49 Q=
50endif
51
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +000052export Q
53
Achin Gupta4f6ad662013-10-25 09:08:21 +010054DEBUG ?= 0
James Morrisseyeaaeece2013-11-01 13:56:59 +000055
56ifneq (${DEBUG}, 0)
57 BUILD_TYPE := debug
58else
59 BUILD_TYPE := release
60endif
61
Ryan Harkind7a6b0f2014-01-13 14:40:13 +000062BL_COMMON_OBJS := misc_helpers.o \
63 cache_helpers.o \
64 tlb_helpers.o \
Achin Guptaa0cd9892014-02-09 13:30:38 +000065 xlat_helpers.o \
Ryan Harkind7a6b0f2014-01-13 14:40:13 +000066 std.o \
67 bl_common.o \
James Morrisseyf2f9bb52014-02-10 16:18:59 +000068 platform_helpers.o \
69 io_storage.o
Ryan Harkind7a6b0f2014-01-13 14:40:13 +000070
Ryan Harkin25cff832014-01-13 12:37:03 +000071ARCH ?= aarch64
Achin Gupta4f6ad662013-10-25 09:08:21 +010072
Ryan Harkin25cff832014-01-13 12:37:03 +000073# By default, build all platforms available
74PLAT ?= all
Achin Gupta375f5382014-02-18 18:12:48 +000075# By default, build no SPD component
76SPD ?= none
Achin Gupta4f6ad662013-10-25 09:08:21 +010077
Ryan Harkin25cff832014-01-13 12:37:03 +000078BUILD_BASE := ./build
79BUILD_PLAT := ${BUILD_BASE}/${PLAT}/${BUILD_TYPE}
80BUILD_BL1 := ${BUILD_PLAT}/bl1
81BUILD_BL2 := ${BUILD_PLAT}/bl2
82BUILD_BL31 := ${BUILD_PLAT}/bl31
83BUILD_DIRS := ${BUILD_BL1} ${BUILD_BL2} ${BUILD_BL31}
Achin Gupta4f6ad662013-10-25 09:08:21 +010084
Ryan Harkin25cff832014-01-13 12:37:03 +000085PLATFORMS := $(shell ls -I common plat/)
Achin Gupta375f5382014-02-18 18:12:48 +000086SPDS := $(shell ls -I none services/spd)
Ryan Harkin72ee3312014-01-15 16:55:07 +000087HELP_PLATFORMS := $(shell echo ${PLATFORMS} | sed 's/ /|/g')
88
Ryan Harkin25cff832014-01-13 12:37:03 +000089ifeq (${PLAT},)
90 $(error "Error: Unknown platform. Please use PLAT=<platform name> to specify the platform.")
91endif
92ifeq ($(findstring ${PLAT},${PLATFORMS} all),)
93 $(error "Error: Invalid platform. The following platforms are available: ${PLATFORMS}")
94endif
95
96ifeq (${PLAT},all)
97all: ${PLATFORMS}
98else
Harry Liebelf58ad362014-01-10 18:00:33 +000099all: msg_start bl1 bl2 bl31 fip
Ryan Harkin25cff832014-01-13 12:37:03 +0000100endif
Achin Gupta4f6ad662013-10-25 09:08:21 +0100101
Ryan Harkin25cff832014-01-13 12:37:03 +0000102msg_start:
103 @echo "Building ${PLAT}"
Achin Gupta4f6ad662013-10-25 09:08:21 +0100104
Ryan Harkin25cff832014-01-13 12:37:03 +0000105${PLATFORMS}:
106 ${MAKE} PLAT=$@ all
Achin Gupta4f6ad662013-10-25 09:08:21 +0100107
Ryan Harkin25cff832014-01-13 12:37:03 +0000108ifneq (${PLAT},all)
109 $(info Including ${PLAT}/platform.mk)
110 include plat/${PLAT}/platform.mk
111 $(info Including bl1.mk)
112 include bl1/bl1.mk
113 $(info Including bl2.mk)
114 include bl2/bl2.mk
115 $(info Including bl31.mk)
116 include bl31/bl31.mk
117endif
Achin Gupta4f6ad662013-10-25 09:08:21 +0100118
Achin Gupta375f5382014-02-18 18:12:48 +0000119# Include SPD Makefile if one has been specified
120ifneq (${SPD},none)
121 # We expect to locate an spd.mk under the specified SPD directory
122 SPD_MAKE := $(shell m="services/spd/${SPD}/${SPD}.mk"; [ -f "$$m" ] && echo "$$m")
123
124 ifeq (${SPD_MAKE},)
125 $(error Error: No services/spd/${SPD}/${SPD}.mk located)
126 endif
127 $(info Including ${SPD_MAKE})
128 include ${SPD_MAKE}
129
130 # If there's BL32 companion for the chosen SPD, and the SPD wants to build the
131 # BL2 from source, we expect that the SPD's Makefile would set NEED_BL32
132 # variable to "yes"
133endif
134
Harry Liebelf58ad362014-01-10 18:00:33 +0000135.PHONY: all msg_start ${PLATFORMS} dump clean realclean distclean bl1 bl2 bl31 cscope locate-checkpatch checkcodebase checkpatch fiptool fip locate-bl33
James Morrisseyeaaeece2013-11-01 13:56:59 +0000136.SUFFIXES:
137
138
Ryan Harkin25cff832014-01-13 12:37:03 +0000139BL1_OBJS := $(addprefix ${BUILD_BL1}/,${BL1_OBJS} ${BL_COMMON_OBJS} ${PLAT_BL_COMMON_OBJS})
140BL2_OBJS := $(addprefix ${BUILD_BL2}/,${BL2_OBJS} ${BL_COMMON_OBJS} ${PLAT_BL_COMMON_OBJS})
Achin Gupta375f5382014-02-18 18:12:48 +0000141BL31_OBJS := $(addprefix ${BUILD_BL31}/,${BL31_OBJS} ${BL_COMMON_OBJS} ${PLAT_BL_COMMON_OBJS} ${SPD_OBJS})
James Morrisseyeaaeece2013-11-01 13:56:59 +0000142BL1_MAPFILE := $(addprefix ${BUILD_BL1}/,${BL1_MAPFILE})
143BL2_MAPFILE := $(addprefix ${BUILD_BL2}/,${BL2_MAPFILE})
144BL31_MAPFILE := $(addprefix ${BUILD_BL31}/,${BL31_MAPFILE})
145BL1_LINKERFILE := $(addprefix ${BUILD_BL1}/,${BL1_LINKERFILE})
146BL2_LINKERFILE := $(addprefix ${BUILD_BL2}/,${BL2_LINKERFILE})
147BL31_LINKERFILE := $(addprefix ${BUILD_BL31}/,${BL31_LINKERFILE})
Achin Gupta4f6ad662013-10-25 09:08:21 +0100148
Ryan Harkind7a6b0f2014-01-13 14:40:13 +0000149INCLUDES += -Ilib/include/ \
James Morrisseyf2f9bb52014-02-10 16:18:59 +0000150 -Idrivers/io \
Ryan Harkind7a6b0f2014-01-13 14:40:13 +0000151 -Iinclude/${ARCH}/ \
152 -Iinclude/ \
153 -Iarch/system/gic \
Achin Gupta0a9f7472014-02-09 17:48:12 +0000154 -Iservices/psci \
Ryan Harkind7a6b0f2014-01-13 14:40:13 +0000155 -Iinclude/stdlib \
156 -Iinclude/stdlib/sys \
157 -Iplat/${PLAT} \
Achin Gupta375f5382014-02-18 18:12:48 +0000158 ${PLAT_INCLUDES} \
159 ${SPD_INCLUDES}
Achin Gupta4f6ad662013-10-25 09:08:21 +0100160
Harry Liebel0af6d642013-12-20 18:51:12 +0000161ASFLAGS += -nostdinc -ffreestanding -Wa,--fatal-warnings \
Sandrine Bailleuxdf64a552014-02-11 13:31:33 +0000162 -mgeneral-regs-only -D__ASSEMBLY__ ${INCLUDES} \
163 -DDEBUG=${DEBUG}
Harry Liebel4f603682014-01-14 18:11:48 +0000164CFLAGS := -nostdinc -pedantic -ffreestanding -Wall \
165 -Werror -mgeneral-regs-only -std=c99 -c -Os \
166 -DDEBUG=${DEBUG} ${INCLUDES} ${CFLAGS}
Achin Gupta4f6ad662013-10-25 09:08:21 +0100167
Sandrine Bailleux3e850a82013-11-20 11:50:48 +0000168LDFLAGS += --fatal-warnings -O1
James Morrisseyeaaeece2013-11-01 13:56:59 +0000169BL1_LDFLAGS := -Map=${BL1_MAPFILE} --script ${BL1_LINKERFILE} --entry=${BL1_ENTRY_POINT}
170BL2_LDFLAGS := -Map=${BL2_MAPFILE} --script ${BL2_LINKERFILE} --entry=${BL2_ENTRY_POINT}
171BL31_LDFLAGS := -Map=${BL31_MAPFILE} --script ${BL31_LINKERFILE} --entry=${BL31_ENTRY_POINT}
Achin Gupta4f6ad662013-10-25 09:08:21 +0100172
173
174vpath %.ld.S bl1:bl2:bl31
175vpath %.c bl1:bl2:bl31
176vpath %.c bl1/${ARCH}:bl2/${ARCH}:bl31/${ARCH}
177vpath %.S bl1/${ARCH}:bl2/${ARCH}:bl31/${ARCH}
178
179
James Morrisseyeaaeece2013-11-01 13:56:59 +0000180ifneq (${DEBUG}, 0)
Achin Gupta4f6ad662013-10-25 09:08:21 +0100181#CFLAGS += -g -O0
182CFLAGS += -g
183# -save-temps -fverbose-asm
184ASFLAGS += -g -Wa,--gdwarf-2
James Morrissey40a6f642014-02-10 14:24:36 +0000185else
186CFLAGS += -DNDEBUG=1
Achin Gupta4f6ad662013-10-25 09:08:21 +0100187endif
188
189
James Morrisseyeaaeece2013-11-01 13:56:59 +0000190CC := ${CROSS_COMPILE}gcc
191CPP := ${CROSS_COMPILE}cpp
192AS := ${CROSS_COMPILE}gcc
193AR := ${CROSS_COMPILE}ar
194LD := ${CROSS_COMPILE}ld
195OC := ${CROSS_COMPILE}objcopy
196OD := ${CROSS_COMPILE}objdump
197NM := ${CROSS_COMPILE}nm
198PP := ${CROSS_COMPILE}gcc -E ${CFLAGS}
Achin Gupta4f6ad662013-10-25 09:08:21 +0100199
200
Ryan Harkin25cff832014-01-13 12:37:03 +0000201bl1: ${BUILD_BL1} ${BUILD_PLAT}/bl1.bin
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +0000202FIP_DEPS += ${BUILD_PLAT}/bl1.bin
203
Ryan Harkin25cff832014-01-13 12:37:03 +0000204bl2: ${BUILD_BL2} ${BUILD_PLAT}/bl2.bin
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +0000205FIP_DEPS += ${BUILD_PLAT}/bl2.bin
206
Ryan Harkin25cff832014-01-13 12:37:03 +0000207bl31: ${BUILD_BL31} ${BUILD_PLAT}/bl31.bin
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +0000208FIP_DEPS += ${BUILD_PLAT}/bl31.bin
Achin Gupta4f6ad662013-10-25 09:08:21 +0100209
Ian Spray36eaaf32014-01-30 17:25:28 +0000210BASE_COMMIT ?= origin/master
211
Harry Liebelf58ad362014-01-10 18:00:33 +0000212# Variables for use with Firmware Image Package
213FIPTOOLPATH ?= tools/fip_create
Achin Gupta375f5382014-02-18 18:12:48 +0000214FIPTOOL ?= ${FIPTOOLPATH}/fip_create
Harry Liebelf58ad362014-01-10 18:00:33 +0000215fiptool: ${FIPTOOL}
216fip: ${BUILD_PLAT}/fip.bin
217
Ryan Harkin25cff832014-01-13 12:37:03 +0000218ifeq (${PLAT},all)
219 ifeq (${MAKECMDGOALS},clean)
220 $(error "Please select a platform with PLAT=<platform>. You can use 'make distclean' to clean up all platform builds")
221 endif
222endif
Ian Spray36eaaf32014-01-30 17:25:28 +0000223
224locate-checkpatch:
225ifndef CHECKPATCH
226 $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/script/checkpatch.pl")
227else
228ifeq (,$(wildcard ${CHECKPATCH}))
229 $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/script/checkpatch.pl")
230endif
231endif
232
Harry Liebelf58ad362014-01-10 18:00:33 +0000233locate-bl33:
234ifndef BL33
235 $(error "Please set BL33 to point to the Normal World binary, eg: BL33=../uefi/FVP_AARCH64_EFI.fd")
236else
237ifeq (,$(wildcard ${BL33}))
238 $(error "The file BL33 points to cannot be found (${BL33})")
239endif
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +0000240FIP_DEPS += ${BL33}
Harry Liebelf58ad362014-01-10 18:00:33 +0000241endif
242
243
Achin Gupta375f5382014-02-18 18:12:48 +0000244# If BL32 needs to be built, provide necessary build rules and targets
245ifeq (${NEED_BL32},yes)
246BUILD_BL32 := ${BUILD_PLAT}/bl32
247BUILD_DIRS += ${BUILD_BL32}
248
249BL32_OBJS := $(addprefix ${BUILD_BL32}/,${BL32_OBJS})
250BL32_MAPFILE := $(addprefix ${BUILD_BL32}/,${BL32_MAPFILE})
251BL32_LINKERFILE := $(addprefix ${BUILD_BL32}/,${BL32_LINKERFILE})
252BL32_LDFLAGS := -Map=${BL32_MAPFILE} --script ${BL32_LINKERFILE} --entry=${BL32_ENTRY_POINT}
253
254bl32: ${BUILD_BL32} ${BUILD_PLAT}/bl32.bin
255all: bl32
256dump: bl32_dump
257.PHONY: bl32
258
259# Add BL32 image to FIP's input image list
260FIP_DEPS := bl32
261FIP_ARGS := --bl32 ${BUILD_PLAT}/bl32.bin
262
263${BUILD_BL32}/%.o: %.S
264 @echo " AS $<"
265 ${Q}${AS} ${ASFLAGS} -c $< -o $@
266
267${BUILD_BL32}/%.o: %.c
268 @echo " CC $<"
269 ${Q}${CC} ${CFLAGS} -c $< -o $@
270
271${BUILD_BL32}/%.ld: %.ld.S
272 @echo " PP $<"
273 ${Q}${AS} ${ASFLAGS} -P -E $< -o $@
274
275${BUILD_BL32}/bl32.elf: ${BL32_OBJS} ${BL32_LINKERFILE}
276 @echo " LD $@"
277 ${Q}${LD} -o $@ ${LDFLAGS} ${BL32_LDFLAGS} ${BL32_OBJS}
278
279${BUILD_PLAT}/bl32.bin: ${BUILD_BL32}/bl32.elf
280 @echo " BIN $@"
281 ${Q}${OC} -O binary $< $@
282 @echo
283 @echo "Built $@ successfully"
284 @echo
285
286bl32_dump:
287 ${Q}${OD} -d ${BUILD_BL32}/bl32.elf > ${BUILD_BL32}/bl32.dump
288endif
289
290
Achin Gupta4f6ad662013-10-25 09:08:21 +0100291clean:
292 @echo " CLEAN"
Ryan Harkin25cff832014-01-13 12:37:03 +0000293 ${Q}rm -rf ${BUILD_PLAT}
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +0000294 ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
Achin Gupta4f6ad662013-10-25 09:08:21 +0100295
James Morrisseyeaaeece2013-11-01 13:56:59 +0000296realclean distclean:
297 @echo " REALCLEAN"
298 ${Q}rm -rf ${BUILD_BASE}
Joakim Bech35fab8c2014-01-23 14:51:49 +0100299 ${Q}rm -f ${CURDIR}/cscope.*
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +0000300 ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
Achin Gupta4f6ad662013-10-25 09:08:21 +0100301
302dump:
303 @echo " OBJDUMP"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000304 ${Q}${OD} -d ${BUILD_BL1}/bl1.elf > ${BUILD_BL1}/bl1.dump
305 ${Q}${OD} -d ${BUILD_BL2}/bl2.elf > ${BUILD_BL2}/bl2.dump
306 ${Q}${OD} -d ${BUILD_BL31}/bl31.elf > ${BUILD_BL31}/bl31.dump
307
Ian Spray36eaaf32014-01-30 17:25:28 +0000308checkcodebase: locate-checkpatch
309 @echo " CHECKING STYLE"
310 @if test -d .git ; then \
311 git ls-files | while read GIT_FILE ; do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; done ; \
312 else \
313 find . -type f -not -iwholename "*.git*" -not -iwholename "*build*" -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \
314 fi
315
316checkpatch: locate-checkpatch
317 @echo " CHECKING STYLE"
318 @git format-patch --stdout ${BASE_COMMIT} | ${CHECKPATCH} ${CHECKPATCH_ARGS} - || true
319
Harry Liebelf58ad362014-01-10 18:00:33 +0000320${FIPTOOL}:
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +0000321 ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH}
Harry Liebelf58ad362014-01-10 18:00:33 +0000322 @echo
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +0000323 @echo "Built $@ successfully"
Harry Liebelf58ad362014-01-10 18:00:33 +0000324 @echo
325
James Morrisseyeaaeece2013-11-01 13:56:59 +0000326${BUILD_DIRS}:
327 ${Q}mkdir -p "$@"
Achin Gupta4f6ad662013-10-25 09:08:21 +0100328
James Morrisseyeaaeece2013-11-01 13:56:59 +0000329
330${BUILD_BL1}/%.o: %.S
331 @echo " AS $<"
332 ${Q}${AS} ${ASFLAGS} -c $< -o $@
333
334${BUILD_BL2}/%.o: %.S
335 @echo " AS $<"
336 ${Q}${AS} ${ASFLAGS} -c $< -o $@
337
338${BUILD_BL31}/%.o: %.S
Achin Gupta4f6ad662013-10-25 09:08:21 +0100339 @echo " AS $<"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000340 ${Q}${AS} ${ASFLAGS} -c $< -o $@
341
342${BUILD_BL1}/%.o: %.c
343 @echo " CC $<"
344 ${Q}${CC} ${CFLAGS} -c $< -o $@
345
346${BUILD_BL2}/%.o: %.c
347 @echo " CC $<"
348 ${Q}${CC} ${CFLAGS} -c $< -o $@
Achin Gupta4f6ad662013-10-25 09:08:21 +0100349
James Morrisseyeaaeece2013-11-01 13:56:59 +0000350${BUILD_BL31}/%.o: %.c
Achin Gupta4f6ad662013-10-25 09:08:21 +0100351 @echo " CC $<"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000352 ${Q}${CC} ${CFLAGS} -c $< -o $@
353
354${BUILD_BL1}/%.ld: %.ld.S
Ryan Harkin25cff832014-01-13 12:37:03 +0000355 @echo " PP $<"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000356 ${Q}${AS} ${ASFLAGS} -P -E $< -o $@
357
358${BUILD_BL2}/%.ld: %.ld.S
Ryan Harkin25cff832014-01-13 12:37:03 +0000359 @echo " PP $<"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000360 ${Q}${AS} ${ASFLAGS} -P -E $< -o $@
Achin Gupta4f6ad662013-10-25 09:08:21 +0100361
James Morrisseyeaaeece2013-11-01 13:56:59 +0000362${BUILD_BL31}/%.ld: %.ld.S
Ryan Harkin25cff832014-01-13 12:37:03 +0000363 @echo " PP $<"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000364 ${Q}${AS} ${ASFLAGS} -P -E $< -o $@
Achin Gupta4f6ad662013-10-25 09:08:21 +0100365
366
James Morrisseyeaaeece2013-11-01 13:56:59 +0000367${BUILD_BL1}/bl1.elf: ${BL1_OBJS} ${BL1_LINKERFILE}
Achin Gupta4f6ad662013-10-25 09:08:21 +0100368 @echo " LD $@"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000369 ${Q}${LD} -o $@ ${LDFLAGS} ${BL1_LDFLAGS} ${BL1_OBJS}
370
371${BUILD_BL2}/bl2.elf: ${BL2_OBJS} ${BL2_LINKERFILE}
372 @echo " LD $@"
373 ${Q}${LD} -o $@ ${LDFLAGS} ${BL2_LDFLAGS} ${BL2_OBJS}
Achin Gupta4f6ad662013-10-25 09:08:21 +0100374
James Morrisseyeaaeece2013-11-01 13:56:59 +0000375${BUILD_BL31}/bl31.elf: ${BL31_OBJS} ${BL31_LINKERFILE}
Achin Gupta4f6ad662013-10-25 09:08:21 +0100376 @echo " LD $@"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000377 ${Q}${LD} -o $@ ${LDFLAGS} ${BL31_LDFLAGS} ${BL31_OBJS}
378
Ryan Harkin25cff832014-01-13 12:37:03 +0000379${BUILD_PLAT}/bl1.bin: ${BUILD_BL1}/bl1.elf
380 @echo " BIN $@"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000381 ${Q}${OC} -O binary $< $@
382 @echo
Achin Gupta4f6ad662013-10-25 09:08:21 +0100383 @echo "Built $@ successfully"
384 @echo
385
Ryan Harkin25cff832014-01-13 12:37:03 +0000386${BUILD_PLAT}/bl2.bin: ${BUILD_BL2}/bl2.elf
387 @echo " BIN $@"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000388 ${Q}${OC} -O binary $< $@
389 @echo
Achin Gupta4f6ad662013-10-25 09:08:21 +0100390 @echo "Built $@ successfully"
391 @echo
392
Ryan Harkin25cff832014-01-13 12:37:03 +0000393${BUILD_PLAT}/bl31.bin: ${BUILD_BL31}/bl31.elf
394 @echo " BIN $@"
James Morrisseyeaaeece2013-11-01 13:56:59 +0000395 ${Q}${OC} -O binary $< $@
396 @echo
397 @echo "Built $@ successfully"
398 @echo
Ryan Harkin72ee3312014-01-15 16:55:07 +0000399
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +0000400${BUILD_PLAT}/fip.bin: locate-bl33 ${FIP_DEPS} ${FIPTOOL}
Harry Liebelf58ad362014-01-10 18:00:33 +0000401 ${Q}${FIPTOOL} --dump \
402 --bl2 ${BUILD_PLAT}/bl2.bin \
403 --bl31 ${BUILD_PLAT}/bl31.bin \
404 --bl33 ${BL33} \
Achin Gupta375f5382014-02-18 18:12:48 +0000405 ${FIP_ARGS} \
Harry Liebelf58ad362014-01-10 18:00:33 +0000406 $@
407 @echo
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +0000408 @echo "Built $@ successfully"
409 @echo
Harry Liebelf58ad362014-01-10 18:00:33 +0000410
411
Joakim Bech35fab8c2014-01-23 14:51:49 +0100412cscope:
413 @echo " CSCOPE"
414 ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files
415 ${Q}cscope -b -q -k
416
Ryan Harkin72ee3312014-01-15 16:55:07 +0000417help:
Ian Spray36eaaf32014-01-30 17:25:28 +0000418 @echo "usage: ${MAKE} PLAT=<all|${HELP_PLATFORMS}> <all|bl1|bl2|bl31|distclean|clean|checkcodebase|checkpatch|dump>"
Ryan Harkin72ee3312014-01-15 16:55:07 +0000419 @echo ""
420 @echo "PLAT is used to specify which platform you wish to build."
421 @echo ""
422 @echo "Supported Targets:"
Achin Gupta375f5382014-02-18 18:12:48 +0000423 @echo " all Build the BL1, BL31 binaries"
Ian Spray36eaaf32014-01-30 17:25:28 +0000424 @echo " bl1 Build the BL1 binary"
Ian Spray36eaaf32014-01-30 17:25:28 +0000425 @echo " bl31 Build the BL31 binary"
426 @echo " checkcodebase Check the coding style of the entire source tree"
427 @echo " checkpatch Check the coding style on changes in the current"
428 @echo " branch against BASE_COMMIT (default origin/master)"
429 @echo " clean Clean the build for the selected platform"
Harry Liebelf58ad362014-01-10 18:00:33 +0000430 @echo " cscope Generate cscope index"
Ian Spray36eaaf32014-01-30 17:25:28 +0000431 @echo " distclean Remove all build artifacts for all platforms"
432 @echo " dump Generate object file dumps"
Harry Liebelf58ad362014-01-10 18:00:33 +0000433 @echo " fiptool Build the Firmware Image Package(FIP) creation tool"
Ryan Harkin72ee3312014-01-15 16:55:07 +0000434 @echo ""
435 @echo "note: most build targets require PLAT to be set to a specific platform."
436 @echo ""
437 @echo "example: build all targets for the FVP platform:"
438 @echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all"