1# Copyright (c) 2022 Huawei Device Co., Ltd.
2#
3# This software is licensed under the terms of the GNU General Public
4# License version 2, as published by the Free Software Foundation, and
5# may be copied, distributed, and modified under those terms.
6#
7# This program is distributed in the hope that it will be useful,
8# but WITHOUT ANY WARRANTY; without even the implied warranty of
9# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10# GNU General Public License for more details.
11
12CROSS := arm-linux-gnueabi-
13COMPILER_PATH := $(COMPILER_PATH_DIR)
14CROSS_TOOLCHAIN_PATH := $(OHOS_ROOT_PATH)/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/bin
15CLANG_HOST_TOOLCHAIN := $(OHOS_ROOT_PATH)/prebuilts/clang/ohos/linux-x86_64/llvm/bin
16HOST_CC := $(CLANG_HOST_TOOLCHAIN)/clang
17AR := $(CROSS_PATH)/$(CROSS)ar
18
19export KERNEL_ROOT?=$(OHOS_ROOT_PATH)/out/KERNEL_OBJ/kernel/src_tmp/$(KERNEL_VERSION)
20export KBUILD_OUTPUT=$(OHOS_ROOT_PATH)/out/KERNEL_OBJ/kernel/OBJ/$(KERNEL_VERSION)
21
22COMPILER_TRIPLE :=
23COMPILER_TRIPLE += "CROSS_COMPILE=$(CROSS_TOOLCHAIN_PATH)/$(CROSS)"
24COMPILER_TRIPLE += "CC=$(HOST_CC)"
25
26include $(OHOS_ROOT_PATH)/drivers/hdf_core/adapter/khdf/linux/test/test_khdf.mk
27
28$(waring build sample_driver module)
29
30obj-m += hdf_test_helper.o
31hdf_test_helper-y := test_helper_driver.o
32
33
34.PHONY: default clean
35default:
36	@$(MAKE) -C $(KERNEL_ROOT) M=$(PWD) ARCH=arm $(COMPILER_TRIPLE) $(COMPILER_TRIPLE) V=10 modules -j 1
37
38clean:
39	@rm -f .*.cmd
40	@rm -f *.mod.c
41	@rm -f *.o
42	@rm -f *.mod
43	@rm -f *.symvers
44	@rm -f *.order
45