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