blob: e6aeba95b1cbd269937b9a1b207a6fb8720812a0 [file] [log] [blame]
Harry Liebelf58ad362014-01-10 18:00:33 +00001#
Juan Pablo Conde7275a5a2022-03-02 18:10:08 -05002# Copyright (c) 2014-2022, 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
Juan Pablo Conde7275a5a2022-03-02 18:10:08 -050025
26# Include library directories where OpenSSL library files are located.
27# For a normal installation (i.e.: when ${OPENSSL_DIR} = /usr or
28# /usr/local), binaries are located under the ${OPENSSL_DIR}/lib/
29# directory. However, for a local build of OpenSSL, the built binaries are
30# located under the main project directory (i.e.: ${OPENSSL_DIR}, not
31# ${OPENSSL_DIR}/lib/).
32LDLIBS := -L${OPENSSL_DIR}/lib -L${OPENSSL_DIR} -lcrypto
Harry Liebelf58ad362014-01-10 18:00:33 +000033
dp-arm4972ec52016-05-25 16:20:20 +010034ifeq (${V},0)
35 Q := @
36else
37 Q :=
38endif
39
Ross Burtonfdce8af2021-10-25 12:27:59 +010040INCLUDE_PATHS := -I../../include/tools_share -I${OPENSSL_DIR}/include
Harry Liebelf58ad362014-01-10 18:00:33 +000041
dp-arme95aaa62017-05-02 11:09:11 +010042HOSTCC ?= gcc
Harry Liebelf58ad362014-01-10 18:00:33 +000043
Pankaj Guptae4aa1bd2020-12-09 14:02:38 +053044ifneq (${PLAT},)
45TF_PLATFORM_ROOT := ../../plat/
46include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk
47PLAT_FIPTOOL_HELPER_MK := ${PLAT_DIR}/plat_fiptool.mk
48endif
49
50ifneq (,$(wildcard ${PLAT_FIPTOOL_HELPER_MK}))
51include ${PLAT_FIPTOOL_HELPER_MK}
52endif
53
Evan Lloyd93a76402015-12-02 20:30:13 +000054.PHONY: all clean distclean
Harry Liebelf58ad362014-01-10 18:00:33 +000055
Pali Rohár40f33f42021-03-25 16:08:09 +010056all: ${PROJECT}
Harry Liebelf58ad362014-01-10 18:00:33 +000057
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +000058${PROJECT}: ${OBJECTS} Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010059 @echo " HOSTLD $@"
dp-arme95aaa62017-05-02 11:09:11 +010060 ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
Evan Lloyd26c6cb42015-12-02 18:33:55 +000061 @${ECHO_BLANK_LINE}
Sandrine Bailleux152c17f2014-10-27 17:10:46 +000062 @echo "Built $@ successfully"
Evan Lloyd26c6cb42015-12-02 18:33:55 +000063 @${ECHO_BLANK_LINE}
Harry Liebelf58ad362014-01-10 18:00:33 +000064
Pankaj Guptae4aa1bd2020-12-09 14:02:38 +053065%.o: %.c Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010066 @echo " HOSTCC $<"
67 ${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
Harry Liebelf58ad362014-01-10 18:00:33 +000068
69clean:
dp-arm4d133d92016-12-30 14:33:24 +000070 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})