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 17ifeq ($(PARAM_FILE), ) 18 PARAM_FILE:=../../../mpp/Makefile.param 19 include $(PARAM_FILE) 20endif 21 22TARGET := $(ARCH_LIBNAME)_wdt 23# /* ARCH_LIBNAME*/ 24#************************************************************************* 25# all source file in this module 26SRCS := hi_wtdg.c \ 27 ../init/$(OSTYPE)/wtdg_init.c 28#************************************************************************* 29EXTRA_CFLAGS += $(MPP_CFLAGS) 30EXTRA_CFLAGS += $(MKP_CFLAGS) 31EXTRA_CFLAGS += -I$(PWD) 32EXTRA_CFLAGS += -I$(REL_INC) 33EXTRA_CFLAGS += -I$(OSAL_ROOT)/include 34 35EXTRA_CFLAGS += -I$(PWD)/arch/$(HIARCH) 36EXTRA_CFLAGS += -I$(CBB_ROOT)/include 37 38ifeq ($(OSTYPE), liteos) 39EXTRA_CFLAGS += $(CFLAGS) 40endif 41 42.PHONY: all clean 43all: $(OSTYPE)_build 44clean: $(OSTYPE)_clean 45 46############################################# 47$(TARGET)-objs = $(SRCS:%.c=%.o) 48ifneq ($(KERNELRELEASE),) 49 obj-m += $(TARGET).o 50endif 51 52linux_build: 53 @echo -e "\e[0;32;1m--Compiling '$(TARGET)'... Configs as follow:\e[0;36;1m" 54 @echo ---- CROSS=$(CROSS) 55 @echo ---- HIARCH=$(HIARCH), HICHIP=$(HICHIP), CVER=$(CVER), DBG=$(HIDBG), HI_FPGA=$(HI_FPGA) 56 @echo ---- CPU_TYPE=$(CPU_TYPE) 57 @echo ---- MPP_CFLAGS=$(MPP_CFLAGS) 58 @echo ---- SDK_PATH=$(SDK_PATH) , PARAM_FILE=$(PARAM_FILE) 59 @echo ---- KERNEL_ROOT=$(KERNEL_ROOT) 60 @echo ---- ARCH_ROOT=$(ARCH_ROOT), ARCH_HAL=$(ARCH_HAL) 61 @@echo -e "\e[0m" 62 @$(MAKE) -C $(KERNEL_ROOT) M=$(PWD) $(COMPILER_TRIPLE) modules 63 @mkdir -p $(REL_KO) && cp $(TARGET).ko $(REL_KO) 64 @mkdir -p $(REL_INC) && cp -f watchdog.h $(REL_INC)/ 65 66linux_clean: 67 @rm -f *.o *.ko *.mod.c .*.cmd *.mod 68 @rm -f *.symvers *.order 69 @rm -rf .*.ko.cmd .*.o.cmd .tmp_versions 70 @rm -f $(REL_KO)/$(TARGET).ko 71 @rm -f $(REL_INC)/watchdog.h 72 @for x in `find ../init/$(OSTYPE) -name "*wtdg_init.o.cmd"`;do rm -rf $$x;done 73 @for x in `find ../init/$(OSTYPE) -name "*wtdg_init.o*"`;do rm -rf $$x;done 74#============================================ 75 76############################################# 77OBJS = $(SRCS:%.c=%.o) 78LIB := lib$(TARGET).a 79 80liteos_build: $(OBJS) $(LIB) 81 @echo -e "\e[0;32;1m--Compiling '$(TARGET)'...\e[0;36;1m" 82 @echo ---- CROSS=$(CROSS) 83 @echo ---- HIARCH=$(HIARCH), HICHIP=$(HICHIP), CVER=$(CVER), DBG=$(HIDBG), HI_FPGA=$(HI_FPGA) 84 @echo ---- CPU_TYPE=$(CPU_TYPE) 85 @echo ---- MPP_CFLAGS=$(MPP_CFLAGS) 86 @echo ---- SDK_PATH=$(SDK_PATH) , PARAM_FILE=$(PARAM_FILE) 87 @@echo -e "\e[0m" 88 @mkdir -p $(REL_KO) && cp -rf $(LIB) $(REL_KO)/ 89 @mkdir -p $(REL_INC) && cp -f watchdog.h $(REL_INC)/ 90 91liteos_clean: 92 @rm -f $(OBJS) $(LIB) 93 @rm -f $(REL_KO)/$(LIB) 94 @rm -f $(REL_INC)/watchdog.h 95 96$(OBJS): %.o : %.c 97 @$(CC) $(EXTRA_CFLAGS) -c $< -o $@ 98 99$(LIB): $(OBJS) 100 @$(AR) $(ARFLAGS) $@ $(OBJS) 101#============================================ 102