blob: 0ede6cebb33670239e251064540467b938a529f2 [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 Badarkhe635482e2020-08-13 05:56:33 +010011PROJECT := $(notdir ${FIPTOOL})
dp-arm4972ec52016-05-25 16:20:20 +010012OBJECTS := fiptool.o tbbr_config.o
dp-arm34c82012017-05-02 11:14:29 +010013V ?= 0
Harry Liebelf58ad362014-01-10 18:00:33 +000014
dp-arm4972ec52016-05-25 16:20:20 +010015override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010016HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +000017ifeq (${DEBUG},1)
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010018 HOSTCCFLAGS += -g -O0 -DDEBUG
Harry Liebelf58ad362014-01-10 18:00:33 +000019else
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010020 HOSTCCFLAGS += -O2
Harry Liebelf58ad362014-01-10 18:00:33 +000021endif
dp-arm12e893b2016-08-24 13:21:08 +010022LDLIBS := -lcrypto
Harry Liebelf58ad362014-01-10 18:00:33 +000023
dp-arm4972ec52016-05-25 16:20:20 +010024ifeq (${V},0)
25 Q := @
26else
27 Q :=
28endif
29
Masahiro Yamada75440bf2017-07-26 18:21:59 +090030INCLUDE_PATHS := -I../../include/tools_share
Harry Liebelf58ad362014-01-10 18:00:33 +000031
dp-arme95aaa62017-05-02 11:09:11 +010032HOSTCC ?= gcc
Harry Liebelf58ad362014-01-10 18:00:33 +000033
Evan Lloyd93a76402015-12-02 20:30:13 +000034.PHONY: all clean distclean
Harry Liebelf58ad362014-01-10 18:00:33 +000035
dp-arm4d133d92016-12-30 14:33:24 +000036all: ${PROJECT}
Harry Liebelf58ad362014-01-10 18:00:33 +000037
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +000038${PROJECT}: ${OBJECTS} Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010039 @echo " HOSTLD $@"
dp-arme95aaa62017-05-02 11:09:11 +010040 ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
Evan Lloyd26c6cb42015-12-02 18:33:55 +000041 @${ECHO_BLANK_LINE}
Sandrine Bailleux152c17f2014-10-27 17:10:46 +000042 @echo "Built $@ successfully"
Evan Lloyd26c6cb42015-12-02 18:33:55 +000043 @${ECHO_BLANK_LINE}
Harry Liebelf58ad362014-01-10 18:00:33 +000044
Masahiro Yamadae3a2b312017-05-08 18:29:03 +090045%.o: %.c %.h Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010046 @echo " HOSTCC $<"
47 ${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
Harry Liebelf58ad362014-01-10 18:00:33 +000048
49clean:
dp-arm4d133d92016-12-30 14:33:24 +000050 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})