blob: 7c2a08379ce7a46dee81ddac5566ee3fe5839f58 [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
Ross Burtonfdce8af2021-10-25 12:27:59 +010015OPENSSL_DIR := /usr
16
Harry Liebelf58ad362014-01-10 18:00:33 +000017
dp-arm4972ec52016-05-25 16:20:20 +010018override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010019HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +000020ifeq (${DEBUG},1)
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010021 HOSTCCFLAGS += -g -O0 -DDEBUG
Harry Liebelf58ad362014-01-10 18:00:33 +000022else
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010023 HOSTCCFLAGS += -O2
Harry Liebelf58ad362014-01-10 18:00:33 +000024endif
Ross Burtonfdce8af2021-10-25 12:27:59 +010025LDLIBS := -L${OPENSSL_DIR}/lib -lcrypto
Harry Liebelf58ad362014-01-10 18:00:33 +000026
dp-arm4972ec52016-05-25 16:20:20 +010027ifeq (${V},0)
28 Q := @
29else
30 Q :=
31endif
32
Ross Burtonfdce8af2021-10-25 12:27:59 +010033INCLUDE_PATHS := -I../../include/tools_share -I${OPENSSL_DIR}/include
Harry Liebelf58ad362014-01-10 18:00:33 +000034
dp-arme95aaa62017-05-02 11:09:11 +010035HOSTCC ?= gcc
Harry Liebelf58ad362014-01-10 18:00:33 +000036
Pankaj Guptae4aa1bd2020-12-09 14:02:38 +053037ifneq (${PLAT},)
38TF_PLATFORM_ROOT := ../../plat/
39include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk
40PLAT_FIPTOOL_HELPER_MK := ${PLAT_DIR}/plat_fiptool.mk
41endif
42
43ifneq (,$(wildcard ${PLAT_FIPTOOL_HELPER_MK}))
44include ${PLAT_FIPTOOL_HELPER_MK}
45endif
46
Evan Lloyd93a76402015-12-02 20:30:13 +000047.PHONY: all clean distclean
Harry Liebelf58ad362014-01-10 18:00:33 +000048
Pali Rohár40f33f42021-03-25 16:08:09 +010049all: ${PROJECT}
Harry Liebelf58ad362014-01-10 18:00:33 +000050
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +000051${PROJECT}: ${OBJECTS} Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010052 @echo " HOSTLD $@"
dp-arme95aaa62017-05-02 11:09:11 +010053 ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
Evan Lloyd26c6cb42015-12-02 18:33:55 +000054 @${ECHO_BLANK_LINE}
Sandrine Bailleux152c17f2014-10-27 17:10:46 +000055 @echo "Built $@ successfully"
Evan Lloyd26c6cb42015-12-02 18:33:55 +000056 @${ECHO_BLANK_LINE}
Harry Liebelf58ad362014-01-10 18:00:33 +000057
Pankaj Guptae4aa1bd2020-12-09 14:02:38 +053058%.o: %.c Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010059 @echo " HOSTCC $<"
60 ${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
Harry Liebelf58ad362014-01-10 18:00:33 +000061
62clean:
dp-arm4d133d92016-12-30 14:33:24 +000063 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})