#
# Copyright (C) 2022 The Falco Authors.
#
# This file is dual licensed under either the MIT or GPL 2. See
# MIT.txt or GPL.txt for full copies of the license.
#

falco-y += main.o dynamic_params_table.o fillers_table.o flags_table.o ppm_events.o ppm_fillers.o event_table.o syscall_table.o ppm_cputime.o tp_table.o
obj-m += falco.o
ccflags-y := 

KERNEL_VER ?= $(shell uname -r)
ifneq ($(findstring uelc, $(KERNEL_VER)),)
    # 包含字符串 "uelc" 时执行的操作
    KERNELDIR               ?= /lib/modules/$(shell rpm -qa kernel-headers | sed 's/^kernel-headers-//')/build
else
    # 不包含字符串 "uelc" 时执行的操作
    KERNELDIR               ?= /lib/modules/$(shell rpm -qa kernel-devel | sed 's/^kernel-devel-//')/build
endif

TOP := $(shell pwd)
all:
	$(MAKE) -C $(KERNELDIR) M=$(TOP) modules

clean:
	$(MAKE) -C $(KERNELDIR) M=$(TOP) clean

install: all
	$(MAKE) -C $(KERNELDIR) M=$(TOP) modules_install
