1# 2# Copyright (c) 2014-2021, ARM Limited and Contributors. All rights reserved. 3# 4# SPDX-License-Identifier: BSD-3-Clause 5# 6 7MAKE_HELPERS_DIRECTORY := ../../make_helpers/ 8include ${MAKE_HELPERS_DIRECTORY}build_macros.mk 9include ${MAKE_HELPERS_DIRECTORY}build_env.mk 10 11FIPTOOL ?= fiptool${BIN_EXT} 12PROJECT := $(notdir ${FIPTOOL}) 13OBJECTS := fiptool.o tbbr_config.o 14V ?= 0 15 16override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700 17HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 18ifeq (${DEBUG},1) 19 HOSTCCFLAGS += -g -O0 -DDEBUG 20else 21 HOSTCCFLAGS += -O2 22endif 23LDLIBS := -lcrypto 24 25ifeq (${V},0) 26 Q := @ 27else 28 Q := 29endif 30 31INCLUDE_PATHS := -I../../include/tools_share 32 33HOSTCC ?= gcc 34 35ifneq (${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 45.PHONY: all clean distclean 46 47all: ${PROJECT} 48 49${PROJECT}: ${OBJECTS} Makefile 50 @echo " HOSTLD $@" 51 ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS} 52 @${ECHO_BLANK_LINE} 53 @echo "Built $@ successfully" 54 @${ECHO_BLANK_LINE} 55 56%.o: %.c Makefile 57 @echo " HOSTCC $<" 58 ${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@ 59 60clean: 61 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS}) 62