1#
2# Copyright (C) 2018 Marvell International Ltd.
3#
4# SPDX-License-Identifier:     BSD-3-Clause
5# https://spdx.org/licenses
6
7PROJECT = doimage
8OBJECTS = doimage.o
9
10HOSTCCFLAGS = -Wall -Werror
11ifeq (${DEBUG},1)
12  HOSTCCFLAGS += -g -O0 -DDEBUG
13else
14  HOSTCCFLAGS += -O2
15endif
16
17ifeq (${MARVELL_SECURE_BOOT},1)
18DOIMAGE_CC_FLAGS := -DCONFIG_MVEBU_SECURE_BOOT
19DOIMAGE_LD_FLAGS := -lconfig -lmbedtls -lmbedcrypto -lmbedx509
20endif
21
22HOSTCCFLAGS += ${DOIMAGE_CC_FLAGS}
23
24# Make soft links and include from local directory otherwise wrong headers
25# could get pulled in from firmware tree.
26INCLUDE_PATHS = -I.
27
28HOSTCC ?= gcc
29RM := rm -rf
30
31.PHONY: all clean
32
33all: ${PROJECT}
34
35${PROJECT}: ${OBJECTS} Makefile
36	@echo "  HOSTLD  $@"
37	${Q}${HOSTCC} ${OBJECTS} ${DOIMAGE_LD_FLAGS} -o $@
38	@echo
39	@echo "Built $@ successfully"
40	@echo
41
42%.o: %.c Makefile
43	@echo "  HOSTCC  $<"
44	${Q}${HOSTCC} -c ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
45
46clean:
47	${Q}${RM} ${PROJECT}
48	${Q}${RM} ${OBJECTS}
49