• 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
17ifeq ($(CFG_HI_EXPORT_FLAG),)
18    ifneq ($(KERNELRELEASE),)
19    KERNEL_DIR := $(srctree)
20
21    SDK_DIR := $(KERNEL_DIR)/../../..
22    else
23    SDK_DIR := $(CURDIR)/../../../../..
24    endif
25
26    ifneq ($(SDK_SOURCE_DIR),)
27    SDK_DIR := $(SDK_SOURCE_DIR)/..
28    endif
29
30include $(SDK_DIR)/base.mak
31endif
32
33EXTRA_CFLAGS += -I$(SDK_DIR)/source/msp/drv/include
34EXTRA_CFLAGS += -I$(SDK_DIR)/source/common/include/
35EXTRA_CFLAGS += -I$(SDK_DIR)/source/common/drv/include
36
37
38EXTRA_CFLAGS += $(CFG_HI_KMOD_CFLAGS)
39
40EXTRA_CFLAGS += -DLOG_D_MODULE_ID=HI_ID_I2C
41
42KBUILD_EXTRA_SYMBOLS += $(COMMON_DIR)/drv/Module.symvers
43KBUILD_EXTRA_SYMBOLS += $(MSP_DIR)/drv/gpio/Module.symvers
44
45MOD_NAME := hi_gt911
46
47obj-$(CFG_MSP_BUILDTYPE) += $(MOD_NAME).o
48
49
50$(MOD_NAME)-y := gt911.o
51
52#===============================================================================
53#   rules
54#===============================================================================
55.PHONY: all clean install uninstall
56
57all:
58	$(AT)make -C $(LINUX_DIR) ARCH=$(CFG_HI_CPU_ARCH) CROSS_COMPILE=$(CFG_HI_TOOLCHAINS_NAME)- M=$(CURDIR) modules
59
60clean:
61	$(AT)make -C $(LINUX_DIR) M=$(CURDIR) clean
62	$(AT)rm -rf  *.o
63	$(AT)rm -rf  .*.o.cmd
64	$(AT)rm -rf .tmp_versions
65	$(AT)rm -rf  Module.symvers
66	$(AT)rm -rf  modules.order
67
68install: all
69ifneq ($(CFG_MSP_BUILDTYPE),y)
70	$(AT)cp -f $(CURDIR)/$(MOD_NAME).ko $(MODULE_DIR)/
71endif
72
73uninstall:
74	$(AT)rm -rf $(MODULE_DIR)/$(MOD_NAME).ko
75