blob: 9f0d89d3e8d31801e13c825c90049d4e37cb9240 [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
7PROJECT = doimage
8OBJECTS = doimage.o
9
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010010HOSTCCFLAGS = -Wall -Werror
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020011ifeq (${DEBUG},1)
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010012 HOSTCCFLAGS += -g -O0 -DDEBUG
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020013else
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010014 HOSTCCFLAGS += -O2
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020015endif
16
17ifeq (${MARVELL_SECURE_BOOT},1)
18DOIMAGE_CC_FLAGS := -DCONFIG_MVEBU_SECURE_BOOT
19DOIMAGE_LD_FLAGS := -lconfig -lmbedtls -lmbedcrypto -lmbedx509
20endif
21
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010022HOSTCCFLAGS += ${DOIMAGE_CC_FLAGS}
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020023
24# Make soft links and include from local directory otherwise wrong headers
25# could get pulled in from firmware tree.
26INCLUDE_PATHS = -I.
27
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010028HOSTCC ?= gcc
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020029RM := rm -rf
30
31.PHONY: all clean
32
33all: ${PROJECT}
34
35${PROJECT}: ${OBJECTS} Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010036 @echo " HOSTLD $@"
37 ${Q}${HOSTCC} ${OBJECTS} ${DOIMAGE_LD_FLAGS} -o $@
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020038 @echo
39 @echo "Built $@ successfully"
40 @echo
41
Jan Kiszka67f2f542018-10-02 09:28:00 +020042%.o: %.c Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010043 @echo " HOSTCC $<"
44 ${Q}${HOSTCC} -c ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
Konstantin Porotchkinbf58b8a2018-02-26 16:28:40 +020045
46clean:
47 ${Q}${RM} ${PROJECT}
48 ${Q}${RM} ${OBJECTS}