Makefile 1.4 KB
Newer Older
1
#
2
# Copyright (c) 2014-2021, ARM Limited and Contributors. All rights reserved.
3
#
dp-arm's avatar
dp-arm committed
4
# SPDX-License-Identifier: BSD-3-Clause
5
6
#

7
8
MAKE_HELPERS_DIRECTORY := ../../make_helpers/
include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
9
include ${MAKE_HELPERS_DIRECTORY}build_env.mk
10

11
FIPTOOL ?= fiptool${BIN_EXT}
12
PROJECT := $(notdir ${FIPTOOL})
dp-arm's avatar
dp-arm committed
13
OBJECTS := fiptool.o tbbr_config.o
14
V ?= 0
15

dp-arm's avatar
dp-arm committed
16
override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
17
HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99
18
ifeq (${DEBUG},1)
19
  HOSTCCFLAGS += -g -O0 -DDEBUG
20
else
21
  HOSTCCFLAGS += -O2
22
endif
23
LDLIBS := -lcrypto
24

dp-arm's avatar
dp-arm committed
25
26
27
28
29
30
ifeq (${V},0)
  Q := @
else
  Q :=
endif

31
INCLUDE_PATHS := -I../../include/tools_share
32

dp-arm's avatar
dp-arm committed
33
HOSTCC ?= gcc
34

35
36
37
38
39
40
41
42
43
44
ifneq (${PLAT},)
TF_PLATFORM_ROOT	:=	../../plat/
include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk
PLAT_FIPTOOL_HELPER_MK := ${PLAT_DIR}/plat_fiptool.mk
endif

ifneq (,$(wildcard ${PLAT_FIPTOOL_HELPER_MK}))
include ${PLAT_FIPTOOL_HELPER_MK}
endif

45
.PHONY: all clean distclean
46

47
48
49
50
51
# Clean before build as old fiptool might be created with
# including different PLAT_FIPTOOL_HELPER_MK.
all:
	${MAKE}	clean
	${MAKE}	${PROJECT}
52

53
${PROJECT}: ${OBJECTS} Makefile
54
	@echo "  HOSTLD  $@"
dp-arm's avatar
dp-arm committed
55
	${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
56
	@${ECHO_BLANK_LINE}
57
	@echo "Built $@ successfully"
58
	@${ECHO_BLANK_LINE}
59

60
%.o: %.c Makefile
61
62
	@echo "  HOSTCC  $<"
	${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
63
64

clean:
65
	$(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})