blob: 488b768e8c83d8046c69f4ee75eaf56035e694a0 [file] [log] [blame]
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +02001#
2# Copyright (C) 2018 Marvell International Ltd.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5# https://spdx.org/licenses
6
Chris Kayc8a47ba2023-10-20 09:17:33 +00007toolchains := host
8
Chris Kay1870c722024-05-02 17:52:37 +00009include ../../../make_helpers/common.mk
Chris Kayc8a47ba2023-10-20 09:17:33 +000010include ../../../make_helpers/toolchain.mk
11
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020012PROJECT = doimage
13OBJECTS = doimage.o
14
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010015HOSTCCFLAGS = -Wall -Werror
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020016ifeq (${DEBUG},1)
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010017 HOSTCCFLAGS += -g -O0 -DDEBUG
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020018else
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010019 HOSTCCFLAGS += -O2
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020020endif
21
22ifeq (${MARVELL_SECURE_BOOT},1)
23DOIMAGE_CC_FLAGS := -DCONFIG_MVEBU_SECURE_BOOT
24DOIMAGE_LD_FLAGS := -lconfig -lmbedtls -lmbedcrypto -lmbedx509
25endif
26
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010027HOSTCCFLAGS += ${DOIMAGE_CC_FLAGS}
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020028
29# Make soft links and include from local directory otherwise wrong headers
30# could get pulled in from firmware tree.
31INCLUDE_PATHS = -I.
32
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020033RM := rm -rf
34
35.PHONY: all clean
36
37all: ${PROJECT}
38
39${PROJECT}: ${OBJECTS} Makefile
Chris Kay1870c722024-05-02 17:52:37 +000040 $(s)echo " HOSTLD $@"
41 $(q)$(host-cc) ${OBJECTS} ${DOIMAGE_LD_FLAGS} -o $@
42 $(s)echo
43 $(s)echo "Built $@ successfully"
44 $(s)echo
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020045
Jan Kiszka67f2f542018-10-02 09:28:00 +020046%.o: %.c Makefile
Chris Kay1870c722024-05-02 17:52:37 +000047 $(s)echo " HOSTCC $<"
48 $(q)$(host-cc) -c ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020049
50clean:
Chris Kay1870c722024-05-02 17:52:37 +000051 $(q)${RM} ${PROJECT}
52 $(q)${RM} ${OBJECTS}