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