-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (65 loc) · 1.67 KB
/
Copy pathMakefile
File metadata and controls
77 lines (65 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
KDIR ?= /lib/modules/$(shell uname -r)/build
BUILD_DIR ?= $(CURDIR)/build
KVERBOSE = V=1
DEBUG ?= 0
PROFILING ?= 1
ifeq ($(DEBUG),1)
EXTRA_CFLAGS += -g -DDEBUG
endif
ifeq ($(PROFILING),1)
EXTRA_CFLAGS += -DPROFILING
endif
KMAKE_OPTS := -C $(KDIR) src=$(CURDIR) M=$(BUILD_DIR)
ifneq ($(ARCH),)
KMAKE_OPTS += ARCH=$(ARCH)
endif
ifneq ($(CROSS_COMPILE),)
KMAKE_OPTS += CROSS_COMPILE=$(CROSS_COMPILE)
endif
ifneq ($(INSTALL_MOD_PATH),)
KMAKE_OPTS += INSTALL_MOD_PATH=$(INSTALL_MOD_PATH)
endif
ifneq ($(KERNELRELEASE),)
KVERSION = $(KERNELRELEASE)
else
KVERSION := $(shell $(MAKE) -s -C $(KDIR) kernelversion)
endif
KVERSION_OK := $(shell \
MAJOR=$$(echo $(KVERSION) | cut -d. -f1); \
MINOR=$$(echo $(KVERSION) | cut -d. -f1); \
if [ $${MAJOR} -lt 5 ] || ([ $${MAJOR} -eq 5 ] && [ $${MINOR} -lt 10 ]); \
then \
echo 0; \
else \
echo 1; \
fi)
ifneq ($(KVERSION_OK),1)
$(error Kernel $(KVERSION) < 5.10.0 is not supported)
endif
ccflags-y := -I$(M)/src
ccflags-y += -I$(src)/include
ccflags-y += -I$(src)/include/uapi
obj-m := virtio_accel.o
virtio_accel-y := \
src/buffer.o \
src/cdev.o \
src/core.o \
src/op_request.o \
src/profiler.o \
src/request.o \
src/session.o
.PHONY: all clean
all: modules
$(BUILD_DIR)/src/version.h: src/version.h.in
mkdir -p $(BUILD_DIR)/src
VERSION=$$(scripts/common/generate-version.sh) ;\
sed -e "s/@VIRTIO_ACCEL_VERSION@/$${VERSION}/g" < $< > $@
modules: $(BUILD_DIR)/src/version.h
$(MAKE) CC=$(CC) $(KMAKE_OPTS) $(KVERBOSE) $@
compile_commands.json: modules
$(MAKE) CC=$(CC) $(KMAKE_OPTS) $(KVERBOSE) $@
modules_install:
$(MAKE) CC=$(CC) $(KMAKE_OPTS) $(KVERBOSE) $@
clean:
$(MAKE) CC=$(CC) $(KMAKE_OPTS) $@
rm -f $(BUILD_DIR)/src/version.h