<commit_before>
# On Centos: sudo yum install kernel-headers

V?=0
ifeq ($(V),0)
Q=@
else
Q=
endif
CURRENTDIR := $(PWD)
CONNECTALDIR ?= $(CURRENTDIR)/../..
include $(CONNECTALDIR)/Makefile.version

obj-m += pcieportal.o

PKG_NAME?=connectal
# DKMS only looks in /usr/src
PREFIX?=/usr
KVERSION=$(shell uname -r)
KROOT=/lib/modules/$(KVERSION)/build
export BS_MOD_DIR=$(DESTDIR)/lib/modules/$(KVERSION)/connectal

.PHONY: default
default: pcieportal.ko ../portalmem/portalmem.ko

EXTRA_CFLAGS := -I$(CONNECTALDIR)/drivers/pciportal -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR) -I$(CONNECTALDIR)/drivers/portalmem -I$(CONNECTALDIR)/generated/cpp \
	-DDRIVER_VERSION="KBUILD_STR($(VERSION))"
cflags-y += -I$(PWD)

../portalmem/portalmem.ko: ../portalmem/portalmem.c
	cd ../portalmem; make

.PHONY: pcieportal_signature_file.h
pcieportal_signature_file.h:
	md5sum *.c ../../generated/cpp/*.c | grep -v mod.c | sed -f ../../scripts/driver_signature.sed >pcieportal_signature_file.h

pcieportal.ko: pcieportal.c pcieportal.h pcieportal_signature_file.h
	$(Q)$(MAKE) -C $(KROOT) M=$(PWD) modules

.PHONY: modules_check
modules_check:
	$(Q)$(MAKE) -C $(KROOT) C=2 M=$(PWD) modules

.PHONY: install
install: pcieportal.ko
	install -d -m755 $(BS_MOD_DIR)
	install -m644 pcieportal.ko $(BS_MOD_DIR)
	install -m644 ../portalmem/portalmem.ko $(BS_MOD_DIR)
ifeq ("$(DESTDIR)", "")
	depmod
endif

.PHONY: uninstall
uninstall:
	rm -f $(BS_MOD_DIR)/pcieportal.ko
	rmdir --ignore-fail-on-non-empty $(BS_MOD_DIR)
ifeq ("$(DESTDIR)", "")
	depmod
endif

.PHONY: clean
clean:
	rm -rf *.ko *.o *.mod.*
	rm -rf Module.symvers Module.markers modules.order
	cd ../portalmem; make clean

.PHONY: rmmod
rmmod:
	rmmod portalmem || true
	rmmod pcieportal || true

.PHONY: insmod<commit_msg>use kernel build clean target<commit_after>
# On Centos: sudo yum install kernel-headers

V?=0
ifeq ($(V),0)
Q=@
else
Q=
endif
CURRENTDIR := $(PWD)
CONNECTALDIR ?= $(CURRENTDIR)/../..
include $(CONNECTALDIR)/Makefile.version

obj-m += pcieportal.o

PKG_NAME?=connectal
# DKMS only looks in /usr/src
PREFIX?=/usr
KVERSION=$(shell uname -r)
KROOT=/lib/modules/$(KVERSION)/build
export BS_MOD_DIR=$(DESTDIR)/lib/modules/$(KVERSION)/connectal

.PHONY: default
default: pcieportal.ko ../portalmem/portalmem.ko

EXTRA_CFLAGS := -I$(CONNECTALDIR)/drivers/pciportal -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR) -I$(CONNECTALDIR)/drivers/portalmem -I$(CONNECTALDIR)/generated/cpp \
	-DDRIVER_VERSION="KBUILD_STR($(VERSION))"
cflags-y += -I$(PWD)

../portalmem/portalmem.ko: ../portalmem/portalmem.c
	cd ../portalmem; make

.PHONY: pcieportal_signature_file.h
pcieportal_signature_file.h:
	md5sum *.c ../../generated/cpp/*.c | grep -v mod.c | sed -f ../../scripts/driver_signature.sed >pcieportal_signature_file.h

pcieportal.ko: pcieportal.c pcieportal.h pcieportal_signature_file.h
	$(Q)$(MAKE) -C $(KROOT) M=$(PWD) modules

.PHONY: modules_check
modules_check:
	$(Q)$(MAKE) -C $(KROOT) C=2 M=$(PWD) modules

.PHONY: install
install: pcieportal.ko
	install -d -m755 $(BS_MOD_DIR)
	install -m644 pcieportal.ko $(BS_MOD_DIR)
	install -m644 ../portalmem/portalmem.ko $(BS_MOD_DIR)
ifeq ("$(DESTDIR)", "")
	depmod
endif

.PHONY: uninstall
uninstall:
	rm -f $(BS_MOD_DIR)/pcieportal.ko
	rmdir --ignore-fail-on-non-empty $(BS_MOD_DIR)
ifeq ("$(DESTDIR)", "")
	depmod
endif

.PHONY: clean
clean:
	$(Q)$(MAKE) -C $(KROOT) M=$(PWD) clean
	cd ../portalmem; make clean

.PHONY: distclean
distclean: clean

.PHONY: rmmod
rmmod:
	rmmod portalmem || true
	rmmod pcieportal || true

.PHONY: insmod
{'fraction_non_alphanumeric': 0.1731478853250071, 'fraction_numerical': 0.007380073800738007, 'mean_word_length': 4.567140600315955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1178267', 'n_tokens_mistral': 1449, 'n_tokens_neox': 1464, 'n_words': 294}