Makefile 1.04 KB
Newer Older
1
#
2
# Copyright (c) 2014-2020, 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
.PHONY: all clean distclean
36

37
all: ${PROJECT}
38

39
${PROJECT}: ${OBJECTS} Makefile
40
	@echo "  HOSTLD  $@"
dp-arm's avatar
dp-arm committed
41
	${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
42
	@${ECHO_BLANK_LINE}
43
	@echo "Built $@ successfully"
44
	@${ECHO_BLANK_LINE}
45

46
%.o: %.c %.h Makefile
47
48
	@echo "  HOSTCC  $<"
	${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
49
50

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