blob: b75907de06585fa7c11d6e0d6fa5194c23a5ccdc [file] [log] [blame]
Harry Liebelf58ad362014-01-10 18:00:33 +00001#
Pankaj Guptae4aa1bd2020-12-09 14:02:38 +05302# Copyright (c) 2014-2021, ARM Limited and Contributors. All rights reserved.
Harry Liebelf58ad362014-01-10 18:00:33 +00003#
dp-armfa3cf0b2017-05-03 09:38:09 +01004# SPDX-License-Identifier: BSD-3-Clause
Harry Liebelf58ad362014-01-10 18:00:33 +00005#
6
Evan Lloyd26c6cb42015-12-02 18:33:55 +00007MAKE_HELPERS_DIRECTORY := ../../make_helpers/
8include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
Evan Lloyda71d2592015-12-02 18:56:06 +00009include ${MAKE_HELPERS_DIRECTORY}build_env.mk
Evan Lloyd26c6cb42015-12-02 18:33:55 +000010
Manish V Badarkheb9adb522020-09-05 04:40:41 +010011FIPTOOL ?= fiptool${BIN_EXT}
Manish V Badarkhe635482e2020-08-13 05:56:33 +010012PROJECT := $(notdir ${FIPTOOL})
dp-arm4972ec52016-05-25 16:20:20 +010013OBJECTS := fiptool.o tbbr_config.o
dp-arm34c82012017-05-02 11:14:29 +010014V ?= 0
Harry Liebelf58ad362014-01-10 18:00:33 +000015
dp-arm4972ec52016-05-25 16:20:20 +010016override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010017HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +000018ifeq (${DEBUG},1)
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010019 HOSTCCFLAGS += -g -O0 -DDEBUG
Harry Liebelf58ad362014-01-10 18:00:33 +000020else
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010021 HOSTCCFLAGS += -O2
Harry Liebelf58ad362014-01-10 18:00:33 +000022endif
dp-arm12e893b2016-08-24 13:21:08 +010023LDLIBS := -lcrypto
Harry Liebelf58ad362014-01-10 18:00:33 +000024
dp-arm4972ec52016-05-25 16:20:20 +010025ifeq (${V},0)
26 Q := @
27else
28 Q :=
29endif
30
Masahiro Yamada75440bf2017-07-26 18:21:59 +090031INCLUDE_PATHS := -I../../include/tools_share
Harry Liebelf58ad362014-01-10 18:00:33 +000032
dp-arme95aaa62017-05-02 11:09:11 +010033HOSTCC ?= gcc
Harry Liebelf58ad362014-01-10 18:00:33 +000034
Pankaj Guptae4aa1bd2020-12-09 14:02:38 +053035ifneq (${PLAT},)
36TF_PLATFORM_ROOT := ../../plat/
37include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk
38PLAT_FIPTOOL_HELPER_MK := ${PLAT_DIR}/plat_fiptool.mk
39endif
40
41ifneq (,$(wildcard ${PLAT_FIPTOOL_HELPER_MK}))
42include ${PLAT_FIPTOOL_HELPER_MK}
43endif
44
Evan Lloyd93a76402015-12-02 20:30:13 +000045.PHONY: all clean distclean
Harry Liebelf58ad362014-01-10 18:00:33 +000046
Pankaj Guptae4aa1bd2020-12-09 14:02:38 +053047# Clean before build as old fiptool might be created with
48# including different PLAT_FIPTOOL_HELPER_MK.
49all:
50 ${MAKE} clean
51 ${MAKE} ${PROJECT}
Harry Liebelf58ad362014-01-10 18:00:33 +000052
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +000053${PROJECT}: ${OBJECTS} Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010054 @echo " HOSTLD $@"
dp-arme95aaa62017-05-02 11:09:11 +010055 ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
Evan Lloyd26c6cb42015-12-02 18:33:55 +000056 @${ECHO_BLANK_LINE}
Sandrine Bailleux152c17f2014-10-27 17:10:46 +000057 @echo "Built $@ successfully"
Evan Lloyd26c6cb42015-12-02 18:33:55 +000058 @${ECHO_BLANK_LINE}
Harry Liebelf58ad362014-01-10 18:00:33 +000059
Pankaj Guptae4aa1bd2020-12-09 14:02:38 +053060%.o: %.c Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010061 @echo " HOSTCC $<"
62 ${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
Harry Liebelf58ad362014-01-10 18:00:33 +000063
64clean:
dp-arm4d133d92016-12-30 14:33:24 +000065 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})