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 | |
| 10 | CFLAGS = -Wall -Werror |
| 11 | ifeq (${DEBUG},1) |
| 12 | CFLAGS += -g -O0 -DDEBUG |
| 13 | else |
| 14 | CFLAGS += -O2 |
| 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 | |
| 22 | CFLAGS += ${DOIMAGE_CC_FLAGS} |
| 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 | |
| 28 | CC := gcc |
| 29 | RM := rm -rf |
| 30 | |
| 31 | .PHONY: all clean |
| 32 | |
| 33 | all: ${PROJECT} |
| 34 | |
| 35 | ${PROJECT}: ${OBJECTS} Makefile |
| 36 | @echo " LD $@" |
| 37 | ${Q}${CC} ${OBJECTS} ${DOIMAGE_LD_FLAGS} -o $@ |
| 38 | @echo |
| 39 | @echo "Built $@ successfully" |
| 40 | @echo |
| 41 | |
| 42 | %.o: %.c %.h Makefile |
| 43 | @echo " CC $<" |
| 44 | ${Q}${CC} -c ${CFLAGS} ${INCLUDE_PATHS} $< -o $@ |
| 45 | |
| 46 | clean: |
| 47 | ${Q}${RM} ${PROJECT} |
| 48 | ${Q}${RM} ${OBJECTS} |