blob: a4f7a1d89a96b89814982860acb9347a8169e8fc [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 Kay1870c722024-05-02 17:52:37 +00007include ../../../make_helpers/common.mk
Chris Kayc8a47ba2023-10-20 09:17:33 +00008include ../../../make_helpers/toolchain.mk
9
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020010PROJECT = doimage
11OBJECTS = doimage.o
12
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010013HOSTCCFLAGS = -Wall -Werror
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020014ifeq (${DEBUG},1)
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010015 HOSTCCFLAGS += -g -O0 -DDEBUG
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020016else
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010017 HOSTCCFLAGS += -O2
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020018endif
19
20ifeq (${MARVELL_SECURE_BOOT},1)
21DOIMAGE_CC_FLAGS := -DCONFIG_MVEBU_SECURE_BOOT
22DOIMAGE_LD_FLAGS := -lconfig -lmbedtls -lmbedcrypto -lmbedx509
23endif
24
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010025HOSTCCFLAGS += ${DOIMAGE_CC_FLAGS}
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020026
27# Make soft links and include from local directory otherwise wrong headers
28# could get pulled in from firmware tree.
29INCLUDE_PATHS = -I.
30
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020031RM := rm -rf
32
33.PHONY: all clean
34
35all: ${PROJECT}
36
37${PROJECT}: ${OBJECTS} Makefile
Chris Kay1870c722024-05-02 17:52:37 +000038 $(s)echo " HOSTLD $@"
39 $(q)$(host-cc) ${OBJECTS} ${DOIMAGE_LD_FLAGS} -o $@
40 $(s)echo
41 $(s)echo "Built $@ successfully"
42 $(s)echo
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020043
Jan Kiszka67f2f542018-10-02 09:28:00 +020044%.o: %.c Makefile
Chris Kay1870c722024-05-02 17:52:37 +000045 $(s)echo " HOSTCC $<"
46 $(q)$(host-cc) -c ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020047
48clean:
Chris Kay1870c722024-05-02 17:52:37 +000049 $(q)${RM} ${PROJECT}
50 $(q)${RM} ${OBJECTS}