Makefile 965 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
#
# Copyright (C) 2018 Marvell International Ltd.
#
# SPDX-License-Identifier:     BSD-3-Clause
# https://spdx.org/licenses

PROJECT = doimage
OBJECTS = doimage.o

10
HOSTCCFLAGS = -Wall -Werror
11
ifeq (${DEBUG},1)
12
  HOSTCCFLAGS += -g -O0 -DDEBUG
13
else
14
  HOSTCCFLAGS += -O2
15
16
17
18
19
20
21
endif

ifeq (${MARVELL_SECURE_BOOT},1)
DOIMAGE_CC_FLAGS := -DCONFIG_MVEBU_SECURE_BOOT
DOIMAGE_LD_FLAGS := -lconfig -lmbedtls -lmbedcrypto -lmbedx509
endif

22
HOSTCCFLAGS += ${DOIMAGE_CC_FLAGS}
23
24
25
26
27

# Make soft links and include from local directory otherwise wrong headers
# could get pulled in from firmware tree.
INCLUDE_PATHS = -I.

28
HOSTCC ?= gcc
29
30
31
32
33
34
35
RM := rm -rf

.PHONY: all clean

all: ${PROJECT}

${PROJECT}: ${OBJECTS} Makefile
36
37
	@echo "  HOSTLD  $@"
	${Q}${HOSTCC} ${OBJECTS} ${DOIMAGE_LD_FLAGS} -o $@
38
39
40
41
	@echo
	@echo "Built $@ successfully"
	@echo

42
%.o: %.c Makefile
43
44
	@echo "  HOSTCC  $<"
	${Q}${HOSTCC} -c ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
45
46
47
48

clean:
	${Q}${RM} ${PROJECT}
	${Q}${RM} ${OBJECTS}