# Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ifeq ($(PARAM_FILE), ) PARAM_FILE:=../../../mpp/Makefile.param include $(PARAM_FILE) endif TARGET := $(ARCH_LIBNAME)_adc #************************************************************************* # all source file in this module SRCS := hi_adc.c \ ../init/$(OSTYPE)/adc_init.c #************************************************************************* EXTRA_CFLAGS += $(MPP_CFLAGS) EXTRA_CFLAGS += $(MKP_CFLAGS) EXTRA_CFLAGS += -I$(PWD) EXTRA_CFLAGS += -I$(REL_INC) EXTRA_CFLAGS += -I$(OSAL_ROOT)/include EXTRA_CFLAGS += -I$(PWD)/arch/$(HIARCH) ifeq ($(OSTYPE), liteos) EXTRA_CFLAGS += $(CFLAGS) endif .PHONY: all clean all: $(OSTYPE)_build clean: $(OSTYPE)_clean ############################################# $(TARGET)-objs = $(SRCS:%.c=%.o) ifneq ($(KERNELRELEASE),) obj-m += $(TARGET).o endif linux_build: @echo -e "\e[0;32;1m--Compiling '$(TARGET)'... Configs as follow:\e[0;36;1m" @echo ---- CROSS=$(CROSS) @echo ---- HIARCH=$(HIARCH), HICHIP=$(HICHIP), CVER=$(CVER), DBG=$(HIDBG), HI_FPGA=$(HI_FPGA) @echo ---- CPU_TYPE=$(CPU_TYPE) @echo ---- MPP_CFLAGS=$(MPP_CFLAGS) @echo ---- SDK_PATH=$(SDK_PATH) , PARAM_FILE=$(PARAM_FILE) @echo ---- KERNEL_ROOT=$(KERNEL_ROOT) @echo ---- ARCH_ROOT=$(ARCH_ROOT), ARCH_HAL=$(ARCH_HAL) @@echo -e "\e[0m" @$(MAKE) -C $(KERNEL_ROOT) M=$(PWD) $(COMPILER_TRIPLE) modules #@mkdir -p $(REL_INC) && cp -f hi_adc.h $(REL_INC)/ @mkdir -p $(REL_KO) && cp $(TARGET).ko $(REL_KO) linux_clean: @rm -f *.o *.ko *.mod.c .*.cmd *.mod @rm -f *.symvers *.order @rm -rf .*.ko.cmd .*.o.cmd .tmp_versions @rm -f $(REL_KO)/$(TARGET).ko #@rm -f $(REL_INC)/hi_adc.h @for x in `find ../init/$(OSTYPE) -name "*adc_init.o.cmd"`;do rm -rf $$x;done @for x in `find ../init/$(OSTYPE) -name "*adc_init.o*"`;do rm -rf $$x;done #============================================ ############################################# OBJS = $(SRCS:%.c=%.o) LIB := lib$(TARGET).a liteos_build: $(OBJS) $(LIB) @echo -e "\e[0;32;1m--Compiling '$(TARGET)'...\e[0;36;1m" @echo ---- CROSS=$(CROSS) @echo ---- HIARCH=$(HIARCH), HICHIP=$(HICHIP), CVER=$(CVER), DBG=$(HIDBG), HI_FPGA=$(HI_FPGA) @echo ---- CPU_TYPE=$(CPU_TYPE) @echo ---- MPP_CFLAGS=$(MPP_CFLAGS) @echo ---- SDK_PATH=$(SDK_PATH) , PARAM_FILE=$(PARAM_FILE) @@echo -e "\e[0m" @mkdir -p $(REL_KO) && cp -rf $(LIB) $(REL_KO)/ @mkdir -p $(REL_INC) && cp -f hi_adc.h $(REL_INC)/ liteos_clean: @rm -f $(OBJS) $(LIB) @rm -f $(REL_KO)/$(LIB) @rm -f $(REL_INC)/hi_adc.h $(OBJS): %.o : %.c @$(CC) $(EXTRA_CFLAGS) -c $< -o $@ $(LIB): $(OBJS) @$(AR) $(ARFLAGS) $@ $(OBJS) #============================================