blob: 9bdafe00c8e286bd41609e2daae64814bcdca3a9 [file] [log] [blame]
Harry Liebelf58ad362014-01-10 18:00:33 +00001#
Masahiro Yamadae3a2b312017-05-08 18:29:03 +09002# Copyright (c) 2014-2017, 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
dp-arm4972ec52016-05-25 16:20:20 +010011PROJECT := fiptool${BIN_EXT}
12OBJECTS := 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
Evan Lloydf4ba5ca2015-12-03 09:47:51 +000016CFLAGS := -Wall -Werror -pedantic -std=c99
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +000017ifeq (${DEBUG},1)
Harry Liebelf58ad362014-01-10 18:00:33 +000018 CFLAGS += -g -O0 -DDEBUG
19else
20 CFLAGS += -O2
21endif
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
39 @echo " LD $@"
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
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +000046 @echo " CC $<"
dp-arme95aaa62017-05-02 11:09:11 +010047 ${Q}${HOSTCC} -c ${CPPFLAGS} ${CFLAGS} ${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})