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