blob: df8ab5c7be2d89f2fe083711fa96eadaf318c5c2 [file] [log] [blame]
Harry Liebelf58ad362014-01-10 18:00:33 +00001#
Manish V Badarkhe635482e2020-08-13 05:56:33 +01002# Copyright (c) 2014-2020, 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
Evan Lloyd93a76402015-12-02 20:30:13 +000035.PHONY: all clean distclean
Harry Liebelf58ad362014-01-10 18:00:33 +000036
dp-arm4d133d92016-12-30 14:33:24 +000037all: ${PROJECT}
Harry Liebelf58ad362014-01-10 18:00:33 +000038
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +000039${PROJECT}: ${OBJECTS} Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010040 @echo " HOSTLD $@"
dp-arme95aaa62017-05-02 11:09:11 +010041 ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
Evan Lloyd26c6cb42015-12-02 18:33:55 +000042 @${ECHO_BLANK_LINE}
Sandrine Bailleux152c17f2014-10-27 17:10:46 +000043 @echo "Built $@ successfully"
Evan Lloyd26c6cb42015-12-02 18:33:55 +000044 @${ECHO_BLANK_LINE}
Harry Liebelf58ad362014-01-10 18:00:33 +000045
Masahiro Yamadae3a2b312017-05-08 18:29:03 +090046%.o: %.c %.h Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010047 @echo " HOSTCC $<"
48 ${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
Harry Liebelf58ad362014-01-10 18:00:33 +000049
50clean:
dp-arm4d133d92016-12-30 14:33:24 +000051 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})