Konstantin Porotchkin | bf58b8a | 2018-02-26 16:28:40 +0200 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2018 Marvell International Ltd. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # https://spdx.org/licenses |
| 6 | |
Chris Kay | c8a47ba | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 7 | toolchains := host |
| 8 | |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 9 | include ../../../make_helpers/common.mk |
Chris Kay | c8a47ba | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 10 | include ../../../make_helpers/toolchain.mk |
| 11 | |
Konstantin Porotchkin | bf58b8a | 2018-02-26 16:28:40 +0200 | [diff] [blame] | 12 | PROJECT = doimage |
| 13 | OBJECTS = doimage.o |
| 14 | |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 15 | HOSTCCFLAGS = -Wall -Werror |
Konstantin Porotchkin | bf58b8a | 2018-02-26 16:28:40 +0200 | [diff] [blame] | 16 | ifeq (${DEBUG},1) |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 17 | HOSTCCFLAGS += -g -O0 -DDEBUG |
Konstantin Porotchkin | bf58b8a | 2018-02-26 16:28:40 +0200 | [diff] [blame] | 18 | else |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 19 | HOSTCCFLAGS += -O2 |
Konstantin Porotchkin | bf58b8a | 2018-02-26 16:28:40 +0200 | [diff] [blame] | 20 | endif |
| 21 | |
| 22 | ifeq (${MARVELL_SECURE_BOOT},1) |
| 23 | DOIMAGE_CC_FLAGS := -DCONFIG_MVEBU_SECURE_BOOT |
| 24 | DOIMAGE_LD_FLAGS := -lconfig -lmbedtls -lmbedcrypto -lmbedx509 |
| 25 | endif |
| 26 | |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 27 | HOSTCCFLAGS += ${DOIMAGE_CC_FLAGS} |
Konstantin Porotchkin | bf58b8a | 2018-02-26 16:28:40 +0200 | [diff] [blame] | 28 | |
| 29 | # Make soft links and include from local directory otherwise wrong headers |
| 30 | # could get pulled in from firmware tree. |
| 31 | INCLUDE_PATHS = -I. |
| 32 | |
Konstantin Porotchkin | bf58b8a | 2018-02-26 16:28:40 +0200 | [diff] [blame] | 33 | RM := rm -rf |
| 34 | |
| 35 | .PHONY: all clean |
| 36 | |
| 37 | all: ${PROJECT} |
| 38 | |
| 39 | ${PROJECT}: ${OBJECTS} Makefile |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 40 | $(s)echo " HOSTLD $@" |
| 41 | $(q)$(host-cc) ${OBJECTS} ${DOIMAGE_LD_FLAGS} -o $@ |
| 42 | $(s)echo |
| 43 | $(s)echo "Built $@ successfully" |
| 44 | $(s)echo |
Konstantin Porotchkin | bf58b8a | 2018-02-26 16:28:40 +0200 | [diff] [blame] | 45 | |
Jan Kiszka | 67f2f54 | 2018-10-02 09:28:00 +0200 | [diff] [blame] | 46 | %.o: %.c Makefile |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 47 | $(s)echo " HOSTCC $<" |
| 48 | $(q)$(host-cc) -c ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@ |
Konstantin Porotchkin | bf58b8a | 2018-02-26 16:28:40 +0200 | [diff] [blame] | 49 | |
| 50 | clean: |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 51 | $(q)${RM} ${PROJECT} |
| 52 | $(q)${RM} ${OBJECTS} |