###	yanxubing modify 2017.07.27+
#include ../../../../../../cust/${P82M_PROJECT_DIR}/ap_config/applications.inc
#include ../../../../../../cust/${P82M_PROJECT_DIR}/ap_config/adapter.inc
#export OEM_SPESIFIC_ADAPTLIBDIRS
#export OEM_SPESIFIC_LIBDIRS
#export OEM_SPESIFIC_ADAPTAPPDIRS
#export OEM_SPESIFIC_APPDIRS
###	yanxubing modify 2017.07.27-


#*******************************************************************************
#PHONY targets
#*******************************************************************************
PHONY := help

PHONY += sysconfig
PHONY += all
PHONY += allclean





.PHONY: $(PHONY)

#*******************************************************************************
#Execute user command
#*******************************************************************************
help:
	@echo "=========================Make help start========================="
	@echo "make [help]			help"
	@echo "make sysconfig		config linux system and compile it"
	@echo "make all[allclean]	compile linux system"
	@echo "make kernel[clean]	compile linux kernel"
	@echo "make lib[clean]		compile libs"
	@echo "make zlib[clean]		compile zte libraries"
	@echo "make app[clean]		compile applications"
	@echo "make zapp[clean]		compile zte applications"
	@echo "make dtbs			compile device tree blob"
	
	@echo "Steps for a new project:"
	@echo "Step1:   make sysconfig"
	@echo "=========================Make help end========================="

sysconfig:
	make -C ${ROOT_DIR}/linux ZXIC/${CHIP_TYPE}_default

sys:
	make -C ${ROOT_DIR}/linux all

all:
	#make -C ${ROOT_DIR}/linux all
	make -C ${ROOT_DIR}/linux ZXIC/${CHIP_TYPE}_default
allclean:
	make -C ${ROOT_DIR}/linux distclean

kernel:
	make -C ${ROOT_DIR}/linux/${LINUX_VER} uImage
	make -C ${ROOT_DIR}/linux kernel_image
	make -C ${ROOT_DIR}/linux modules
	make -C ${ROOT_DIR}/linux modules_install
kernelclean:
	make -C ${ROOT_DIR}/linux/${LINUX_VER} clean

uImage:
	make -C ${ROOT_DIR}/linux/${LINUX_VER} uImage

normal_image : kernel_image normal_rootfs_image
	@echo "Normal kernel and userdata ok"

kernel_image:
	make -C ${ROOT_DIR}/linux kernel_image

normal_rootfs_image:
	make -C ${ROOT_DIR}/linux rootfs_image

recovery_image : kernel_image recovery_rootfs_image
	@echo "Recovery kernel and userdata ok"

recovery_rootfs_image:
	make -C ${ROOT_DIR}/linux recovery_rootfs_image

lib:
	make -C ${ROOT_DIR}/linux/lib all 
	make -C ${ROOT_DIR}/linux/lib romfs
libclean:
	make -C ${ROOT_DIR}/linux/lib clean

zlib:
	make -C ${ROOT_DIR}/linux/lib/zte_libs all
	make -C ${ROOT_DIR}/linux/lib/zte_libs romfs
zlibclean:
	make -C ${ROOT_DIR}/linux/lib/zte_libs clean

app:
	make -C ${ROOT_DIR}/linux/user all 
	make -C ${ROOT_DIR}/linux/user romfs
appclean:
	make -C ${ROOT_DIR}/linux/user clean

zapp:
	make -C ${ROOT_DIR}/linux/user/zte_apps all
	make -C ${ROOT_DIR}/linux/user/zte_apps romfs
zappclean:
	make -C ${ROOT_DIR}/linux/user/zte_apps clean
	
dtbs:
	make -C ${LINUX_ROOT} dtbs

%_usdk_compile:
	make -C ${ROOT_DIR}/linux/user/zte_sdk $@

%_usdk_clear:
	make -C $(ROOT_DIR)/linux/user/zte_sdk $@
    
%:
	make -C ${ROOT_DIR}/linux $(*)

