1# Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 2# 3# This program is free software; you can redistribute it and/or 4# modify it under the terms of the GNU General Public License 5# as published by the Free Software Foundation; either version 2 6# of the License, or (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License 14# along with this program; if not, write to the Free Software 15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 17#******************************************************************************* 18#The rule of make Linux kernel module 19#******************************************************************************* 20$(HIFB_MOD_NAME)-objs = $(HIFB_SRC:%.c=%.o) 21$(MOD_NAME)-objs = $(HIFB_SRC_O:%.c=%.o) 22 23ifneq ($(KERNELRELEASE),) 24 obj-m += hifb.o 25 #obj-m += $(MOD_NAME).o 26endif 27 28ifeq ($(CROSS),arm-hisiv500-linux-) 29EXTRA_CFLAGS += -Wno-error=date-time 30else ifeq ($(CROSS),arm-hisiv600-linux-) 31EXTRA_CFLAGS += -Wno-error=date-time 32endif 33 34ifeq ($(HIARCH),hi3516ev200) 35 TDE_ROOT := tde_hi3516ev200 36 VGS_ROOT := vgs/vgs_hi3516ev200 37else 38 TDE_ROOT := tde 39endif 40 41#******************************************************************************* 42.PHONY: default clean 43default: 44 @echo -e "\e[0;32;1m--Compiling 'hiFB'... Configs as follow:\e[0;36;1m" 45 @echo ---- CROSS=$(CROSS) 46 @echo ---- HIARCH=$(HIARCH), HICHIP=$(HICHIP), CVER=$(CVER), DBG=$(HIDBG) 47 @echo ---- SDK_PATH=$(SDK_PATH) , PARAM_FILE=$(PARAM_FILE) 48 @echo ---- KERNEL_ROOT=$(KERNEL_ROOT) 49 @@echo -e "\e[0m" 50 @$(MAKE) -C $(KERNEL_ROOT) M=$(PWD) $(COMPILER_TRIPLE) V=10 modules 51 @mkdir -p $(REL_KO) && cp -rf $(HIFB_MOD_NAME).ko $(REL_KO) 52 53clean: 54 @for x in `find . -name "*.o"`;do rm -rf $$x;done 55 @for x in `find . -name ".*.o.cmd"`;do rm -rf $$x;done 56 @for x in `find . -name "*.ko"`;do rm -rf $$x;done 57 @for x in `find . -name "*.mod.c"`;do rm -rf $$x;done 58 @for x in `find . -name ".*.ko.cmd"`;do rm -rf $$x;done 59 @rm -f *.mod .*.cmd 60 @rm .tmp_versions -fr 61 @rm Module.symvers -f 62 @rm modules.order -f 63 @rm -rf $(REL_KO)/$(HIFB_MOD_NAME).ko 64 @rm -rf $(REL_INC)/$(HIFB_MOD_NAME)*.h 65 @rm -f $(REL_OBJ)/$(MOD_NAME).o 66