• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2022 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# For Hi3751V350...
19#===============================================================================
20# export variables
21#===============================================================================
22ifeq ($(CFG_HI_EXPORT_FLAG),)
23    ifneq ($(KERNELRELEASE),)
24    KERNEL_DIR := $(srctree)
25
26    SDK_DIR := $(KERNEL_DIR)/../../..
27    else
28    SDK_DIR := $(CURDIR)/../../../..
29    endif
30
31    ifneq ($(SDK_SOURCE_DIR),)
32    SDK_DIR := $(SDK_SOURCE_DIR)/..
33    endif
34include $(SDK_DIR)/base.mak
35endif
36
37KBUILD_EXTRA_SYMBOLS += $(COMMON_DIR)/drv/Module.symvers
38export KBUILD_EXTRA_SYMBOLS
39
40#===============================================================================
41# local variables
42#===============================================================================
43EXTRA_CFLAGS += -I$(COMMON_UNF_INCLUDE)                 \
44                -I$(COMMON_API_INCLUDE)                 \
45                -I$(COMMON_DRV_INCLUDE)                 \
46                -I$(MSP_UNF_INCLUDE)                    \
47                -I$(MSP_API_INCLUDE)                    \
48                -I$(MSP_DRV_INCLUDE)                    \
49                -I$(MSP_DIR)/drv/hidev/include
50
51EXTRA_CFLAGS += $(CFG_HI_KMOD_CFLAGS)
52
53MOD_NAME := hi_dev
54obj-$(CFG_MSP_BUILDTYPE) += $(MOD_NAME).o
55$(MOD_NAME)-y := kernel/hidev.o
56
57
58#===============================================================================
59#   rules
60#===============================================================================
61.PHONY: all clean install uninstall
62
63all:
64	$(AT)make -C $(LINUX_DIR) ARCH=$(CFG_HI_CPU_ARCH) CROSS_COMPILE=$(CFG_HI_TOOLCHAINS_NAME)- M=$(CURDIR) modules
65
66clean:
67	$(AT)make -C $(LINUX_DIR) M=$(CURDIR) clean
68	$(AT)rm -rf  *.o
69	$(AT)rm -rf  .*.o.cmd
70	$(AT)rm -rf .tmp_versions
71	$(AT)rm -rf  Module.symvers
72	$(AT)rm -rf  modules.order
73
74install: all
75ifneq ($(CFG_MSP_BUILDTYPE),y)
76	$(AT)cp -f $(CURDIR)/$(MOD_NAME).ko $(MODULE_DIR)/
77endif
78
79uninstall:
80	$(AT)rm -rf $(MODULE_DIR)/$(MOD_NAME).ko
81