xref: /rk3399_ARM-atf/tools/marvell/doimage/Makefile (revision 7c4e1eea61a32291a6640070418e07ab98b42442)
16414dc6dSKonstantin Porotchkin#
26414dc6dSKonstantin Porotchkin# Copyright (C) 2018 Marvell International Ltd.
36414dc6dSKonstantin Porotchkin#
46414dc6dSKonstantin Porotchkin# SPDX-License-Identifier:     BSD-3-Clause
56414dc6dSKonstantin Porotchkin# https://spdx.org/licenses
66414dc6dSKonstantin Porotchkin
7cc277de8SChris Kaytoolchains := host
8cc277de8SChris Kay
9*7c4e1eeaSChris Kayinclude ../../../make_helpers/common.mk
10cc277de8SChris Kayinclude ../../../make_helpers/toolchain.mk
11cc277de8SChris Kay
126414dc6dSKonstantin PorotchkinPROJECT = doimage
136414dc6dSKonstantin PorotchkinOBJECTS = doimage.o
146414dc6dSKonstantin Porotchkin
156414dc6dSKonstantin PorotchkinHOSTCCFLAGS = -Wall -Werror
166414dc6dSKonstantin Porotchkinifeq (${DEBUG},1)
176414dc6dSKonstantin Porotchkin  HOSTCCFLAGS += -g -O0 -DDEBUG
186414dc6dSKonstantin Porotchkinelse
196414dc6dSKonstantin Porotchkin  HOSTCCFLAGS += -O2
206414dc6dSKonstantin Porotchkinendif
216414dc6dSKonstantin Porotchkin
226414dc6dSKonstantin Porotchkinifeq (${MARVELL_SECURE_BOOT},1)
236414dc6dSKonstantin PorotchkinDOIMAGE_CC_FLAGS := -DCONFIG_MVEBU_SECURE_BOOT
246414dc6dSKonstantin PorotchkinDOIMAGE_LD_FLAGS := -lconfig -lmbedtls -lmbedcrypto -lmbedx509
256414dc6dSKonstantin Porotchkinendif
266414dc6dSKonstantin Porotchkin
276414dc6dSKonstantin PorotchkinHOSTCCFLAGS += ${DOIMAGE_CC_FLAGS}
286414dc6dSKonstantin Porotchkin
296414dc6dSKonstantin Porotchkin# Make soft links and include from local directory otherwise wrong headers
306414dc6dSKonstantin Porotchkin# could get pulled in from firmware tree.
316414dc6dSKonstantin PorotchkinINCLUDE_PATHS = -I.
326414dc6dSKonstantin Porotchkin
336414dc6dSKonstantin PorotchkinRM := rm -rf
346414dc6dSKonstantin Porotchkin
356414dc6dSKonstantin Porotchkin.PHONY: all clean
366414dc6dSKonstantin Porotchkin
376414dc6dSKonstantin Porotchkinall: ${PROJECT}
386414dc6dSKonstantin Porotchkin
396414dc6dSKonstantin Porotchkin${PROJECT}: ${OBJECTS} Makefile
40*7c4e1eeaSChris Kay	$(s)echo "  HOSTLD  $@"
41*7c4e1eeaSChris Kay	$(q)$(host-cc) ${OBJECTS} ${DOIMAGE_LD_FLAGS} -o $@
42*7c4e1eeaSChris Kay	$(s)echo
43*7c4e1eeaSChris Kay	$(s)echo "Built $@ successfully"
44*7c4e1eeaSChris Kay	$(s)echo
456414dc6dSKonstantin Porotchkin
466414dc6dSKonstantin Porotchkin%.o: %.c Makefile
47*7c4e1eeaSChris Kay	$(s)echo "  HOSTCC  $<"
48*7c4e1eeaSChris Kay	$(q)$(host-cc) -c ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
496414dc6dSKonstantin Porotchkin
506414dc6dSKonstantin Porotchkinclean:
51*7c4e1eeaSChris Kay	$(q)${RM} ${PROJECT}
52*7c4e1eeaSChris Kay	$(q)${RM} ${OBJECTS}
53