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