Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 1 | # |
Juan Pablo Conde | 7275a5a | 2022-03-02 18:10:08 -0500 | [diff] [blame] | 2 | # Copyright (c) 2014-2022, ARM Limited and Contributors. All rights reserved. |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 3 | # |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | # SPDX-License-Identifier: BSD-3-Clause |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 5 | # |
| 6 | |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 7 | MAKE_HELPERS_DIRECTORY := ../../make_helpers/ |
| 8 | include ${MAKE_HELPERS_DIRECTORY}build_macros.mk |
Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 9 | include ${MAKE_HELPERS_DIRECTORY}build_env.mk |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 10 | |
Manish V Badarkhe | b9adb52 | 2020-09-05 04:40:41 +0100 | [diff] [blame] | 11 | FIPTOOL ?= fiptool${BIN_EXT} |
Manish V Badarkhe | 635482e | 2020-08-13 05:56:33 +0100 | [diff] [blame] | 12 | PROJECT := $(notdir ${FIPTOOL}) |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 13 | OBJECTS := fiptool.o tbbr_config.o |
dp-arm | 34c8201 | 2017-05-02 11:14:29 +0100 | [diff] [blame] | 14 | V ?= 0 |
Ross Burton | fdce8af | 2021-10-25 12:27:59 +0100 | [diff] [blame] | 15 | OPENSSL_DIR := /usr |
| 16 | |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 17 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 18 | override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700 |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 19 | HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 |
Jeenu Viswambharan | 2f2cef4 | 2014-02-19 09:38:18 +0000 | [diff] [blame] | 20 | ifeq (${DEBUG},1) |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 21 | HOSTCCFLAGS += -g -O0 -DDEBUG |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 22 | else |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 23 | HOSTCCFLAGS += -O2 |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 24 | endif |
Juan Pablo Conde | 7275a5a | 2022-03-02 18:10:08 -0500 | [diff] [blame] | 25 | |
| 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/). |
| 32 | LDLIBS := -L${OPENSSL_DIR}/lib -L${OPENSSL_DIR} -lcrypto |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 33 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 34 | ifeq (${V},0) |
| 35 | Q := @ |
| 36 | else |
| 37 | Q := |
| 38 | endif |
| 39 | |
Ross Burton | fdce8af | 2021-10-25 12:27:59 +0100 | [diff] [blame] | 40 | INCLUDE_PATHS := -I../../include/tools_share -I${OPENSSL_DIR}/include |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 41 | |
dp-arm | e95aaa6 | 2017-05-02 11:09:11 +0100 | [diff] [blame] | 42 | HOSTCC ?= gcc |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 43 | |
Pankaj Gupta | e4aa1bd | 2020-12-09 14:02:38 +0530 | [diff] [blame] | 44 | ifneq (${PLAT},) |
| 45 | TF_PLATFORM_ROOT := ../../plat/ |
| 46 | include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk |
| 47 | PLAT_FIPTOOL_HELPER_MK := ${PLAT_DIR}/plat_fiptool.mk |
| 48 | endif |
| 49 | |
| 50 | ifneq (,$(wildcard ${PLAT_FIPTOOL_HELPER_MK})) |
| 51 | include ${PLAT_FIPTOOL_HELPER_MK} |
| 52 | endif |
| 53 | |
Evan Lloyd | 93a7640 | 2015-12-02 20:30:13 +0000 | [diff] [blame] | 54 | .PHONY: all clean distclean |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 55 | |
Pali Rohár | 40f33f4 | 2021-03-25 16:08:09 +0100 | [diff] [blame] | 56 | all: ${PROJECT} |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 57 | |
Jeenu Viswambharan | 2f2cef4 | 2014-02-19 09:38:18 +0000 | [diff] [blame] | 58 | ${PROJECT}: ${OBJECTS} Makefile |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 59 | @echo " HOSTLD $@" |
dp-arm | e95aaa6 | 2017-05-02 11:09:11 +0100 | [diff] [blame] | 60 | ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS} |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 61 | @${ECHO_BLANK_LINE} |
Sandrine Bailleux | 152c17f | 2014-10-27 17:10:46 +0000 | [diff] [blame] | 62 | @echo "Built $@ successfully" |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 63 | @${ECHO_BLANK_LINE} |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 64 | |
Pankaj Gupta | e4aa1bd | 2020-12-09 14:02:38 +0530 | [diff] [blame] | 65 | %.o: %.c Makefile |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 66 | @echo " HOSTCC $<" |
| 67 | ${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@ |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 68 | |
| 69 | clean: |
dp-arm | 4d133d9 | 2016-12-30 14:33:24 +0000 | [diff] [blame] | 70 | $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS}) |