• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7MAKE_HELPERS_DIRECTORY := ../../make_helpers/
8include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
9include ${MAKE_HELPERS_DIRECTORY}build_env.mk
10
11PROJECT := fiptool${BIN_EXT}
12OBJECTS := fiptool.o tbbr_config.o
13V ?= 0
14
15override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
16HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99
17ifeq (${DEBUG},1)
18  HOSTCCFLAGS += -g -O0 -DDEBUG
19else
20  HOSTCCFLAGS += -O2
21endif
22LDLIBS := -lcrypto
23
24ifeq (${V},0)
25  Q := @
26else
27  Q :=
28endif
29
30INCLUDE_PATHS := -I../../include/tools_share
31
32HOSTCC ?= gcc
33
34.PHONY: all clean distclean
35
36all: ${PROJECT}
37
38${PROJECT}: ${OBJECTS} Makefile
39	@echo "  HOSTLD  $@"
40	${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
41	@${ECHO_BLANK_LINE}
42	@echo "Built $@ successfully"
43	@${ECHO_BLANK_LINE}
44
45%.o: %.c %.h Makefile
46	@echo "  HOSTCC  $<"
47	${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
48
49clean:
50	$(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})
51