blob: 6e59aa21559aeaf10bea92ecd6bd08a42bfc017f [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
9include ../../../make_helpers/toolchain.mk
10
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020011PROJECT = doimage
12OBJECTS = doimage.o
13
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010014HOSTCCFLAGS = -Wall -Werror
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020015ifeq (${DEBUG},1)
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010016 HOSTCCFLAGS += -g -O0 -DDEBUG
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020017else
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010018 HOSTCCFLAGS += -O2
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020019endif
20
21ifeq (${MARVELL_SECURE_BOOT},1)
22DOIMAGE_CC_FLAGS := -DCONFIG_MVEBU_SECURE_BOOT
23DOIMAGE_LD_FLAGS := -lconfig -lmbedtls -lmbedcrypto -lmbedx509
24endif
25
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010026HOSTCCFLAGS += ${DOIMAGE_CC_FLAGS}
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020027
28# Make soft links and include from local directory otherwise wrong headers
29# could get pulled in from firmware tree.
30INCLUDE_PATHS = -I.
31
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020032RM := rm -rf
33
34.PHONY: all clean
35
36all: ${PROJECT}
37
38${PROJECT}: ${OBJECTS} Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010039 @echo " HOSTLD $@"
Chris Kay523e8642023-12-04 12:03:51 +000040 ${Q}$(host-cc) ${OBJECTS} ${DOIMAGE_LD_FLAGS} -o $@
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020041 @echo
42 @echo "Built $@ successfully"
43 @echo
44
Jan Kiszka67f2f542018-10-02 09:28:00 +020045%.o: %.c Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010046 @echo " HOSTCC $<"
Chris Kay523e8642023-12-04 12:03:51 +000047 ${Q}$(host-cc) -c ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020048
49clean:
50 ${Q}${RM} ${PROJECT}
51 ${Q}${RM} ${OBJECTS}