blob: e0e3923604857d9b029b2687c4d3b88c5941906f [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-arm4972ec52016-05-25 16:20:20 +010036all: ${PROJECT} fip_create
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
dp-arm4972ec52016-05-25 16:20:20 +010045fip_create: fip_create.sh
dp-arm65dfe4c2016-08-10 13:39:42 +010046 ${Q}mkdir -p ../fip_create
47 ${Q}install -m 755 fip_create.sh ../fip_create/fip_create
dp-arm4972ec52016-05-25 16:20:20 +010048
Masahiro Yamadae3a2b312017-05-08 18:29:03 +090049%.o: %.c %.h Makefile
Jeenu Viswambharan2f2cef42014-02-19 09:38:18 +000050 @echo " CC $<"
dp-arme95aaa62017-05-02 11:09:11 +010051 ${Q}${HOSTCC} -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@
Harry Liebelf58ad362014-01-10 18:00:33 +000052
53clean:
dp-arm4972ec52016-05-25 16:20:20 +010054 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS} fip_create)