1CROSS_COMPILE	:= aarch64-linux-gnu-
2output_dir	:= $(PWD)/../bin
3makejobs	:= $(nproc)
4makethreads	:= $(shell dc -e "$(makejobs) 1 + p")
5make_options	:= GCC49_AARCH64_PREFIX=$CROSS_COMPILE \
6		-j$(makethreads) -l$(makejobs)
7
8BL30_HIKEY	:= $(output_dir)/mcuimage.bin
9BL33_HIKEY	:= $(output_dir)/u-boot-hikey.bin
10
11.PHONY: help
12help:
13	@echo "****  Common Makefile  ****"
14	@echo "example:"
15	@echo "make -f build-tf.mak build"
16
17.PHONY: have-crosscompiler
18have-crosscompiler:
19	@echo -n "Check that $(CROSS_COMPILE)gcc is available..."
20	@which $(CROSS_COMPILE)gcc > /dev/null ; \
21	if [ ! $$? -eq 0 ] ; then \
22	   echo "ERROR: cross-compiler $(CROSS_COMPILE)gcc not in PATH=$$PATH!" ; \
23	   echo "ABORTING." ; \
24	   exit 1 ; \
25	else \
26	   echo "OK" ;\
27	fi
28
29build: have-crosscompiler FORCE
30	@echo "Build TF for Hikey..."
31	rm -rf build/
32	CROSS_COMPILE=$(CROSS_COMPILE) \
33	make all fip \
34	BL30=$(BL30_HIKEY) \
35	BL33=$(BL33_HIKEY) \
36	DEBUG=1 \
37	PLAT=hikey
38	@echo "Copy resulting binaries..."
39	cp build/hikey/debug/bl1.bin $(output_dir)/bl1-hikey.bin
40	cp build/hikey/debug/fip.bin $(output_dir)/fip-hikey.bin
41
42FORCE:
43