#!/bin/bash
#
# builder: build platform_sdk + zte code
# Ruinan Duan 10/29/2014
#
# Modified by Ruinan Duan 12/26/2014 - Add abs path.
# Modified by Ruinan Duan 01/07/2016 - Add tsp7520m.
#

. ${P82M_ABS_PATH}/script/builder_qc_mdm9xxx
. ${P82M_ABS_PATH}/script/builder_marvell_pxa
. ${P82M_ABS_PATH}/script/builder_mediatek_mt
. ${P82M_ABS_PATH}/script/builder_tsp7510
. ${P82M_ABS_PATH}/script/builder_tsp7520
. ${P82M_ABS_PATH}/script/builder_tsp7520m
. ${P82M_ABS_PATH}/script/builder_tsp7520v3

# Start to build project according to P82M_MACHINE.
build_all()
{
	print_wait "Building"

	if [ "${P82M_MACHINE}" = "mdm9x15" -o "${P82M_MACHINE}" = "mdm9x25" \
			-o "${P82M_MACHINE}" = "mdm9x30" ]; then
		if ! build_qc_mdm9xxx; then
			print_fail "build_qc_mdm9xxx failed."
			return 1
		fi
	elif [ "${P82M_MACHINE}" = "pxa1801" ]; then
		if ! build_marvell_pxa; then
			print_fail "build_marvell_pxa failed."
			return 1
		fi
	elif [ "${P82M_MACHINE}" = "mt6735" ] || [ "${P82M_MACHINE}" = "mt6735m" ]; then
		if ! build_mediatek_system; then
			print_fail "build mediatek failed."
			return 1
		fi
	elif [ "${P82M_MACHINE}" = "tsp7510" ] ; then
		if ! build_tsp7510; then
			print_fail "build tsp7510 failed."
			return 1
		fi
	elif [ "${P82M_MACHINE}" = "tsp7520m" ] ; then
		if ! build_tsp7520m; then
			print_fail "build tsp7520m failed."
			return 1
		fi
	elif [ "${P82M_MACHINE}" = "tsp7520v3" ] ; then
		if ! build_tsp7520v3; then
			print_fail "build tsp7520v3 failed."
			return 1
		fi		
	elif [ "${P82M_MACHINE}" = "tsp7520" ] ; then
		if ! build_tsp7520; then
			print_fail "build tsp7520 failed."
			return 1
		fi
	fi
	print_okey "Build complete."

	return 0
}


