-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile.in
147 lines (121 loc) · 4.28 KB
/
makefile.in
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
PHONY += all kernel install_kernel install clean clean_kernel
all:
.PHONY: $(PHONY)
.DELETE_ON_ERROR:
include ./configure.mk.kernel
export COMPAT_CONFIG=$(CWD)/compat.config
export COMPAT_AUTOCONF=$(CWD)/include/linux/compat_autoconf.h
export KLIB_BUILD
export KVERSION
export MAKE
-include $(COMPAT_CONFIG)
export CREL=$(shell cat $(CWD)/compat_version)
export CREL_PRE:=.compat_autoconf_
export CREL_CHECK:=$(CREL_PRE)$(CREL)
CFLAGS += \
-DCOMPAT_BASE="\"$(shell cat compat_base)\"" \
-DCOMPAT_BASE_TREE="\"$(shell cat compat_base_tree)\"" \
-DCOMPAT_BASE_TREE_VERSION="\"$(shell cat compat_base_tree_version)\"" \
-DCOMPAT_PROJECT="\"Compat-rdma\"" \
-DCOMPAT_VERSION="\"$(shell cat compat_version)\"" \
DEPMOD = /sbin/depmod
INSTALL_MOD_DIR ?= updates
ifeq ($(CONFIG_MEMTRACK),m)
export KERNEL_MEMTRACK_CFLAGS = -include $(CWD)/drivers/infiniband/debug/mtrack.h
else
export KERNEL_MEMTRACK_CFLAGS =
endif
export OPEN_ISCSI_MODULES = iscsi_tcp.ko libiscsi.ko scsi_transport_iscsi.ko
$(COMPAT_AUTOCONF): $(COMPAT_CONFIG)
+@$(CWD)/ofed_scripts/gen-compat-autoconf.sh $(COMPAT_CONFIG) > $(COMPAT_AUTOCONF)
$(COMPAT_CONFIG):
+@$(CWD)/ofed_scripts/gen-compat-config.sh > $(COMPAT_CONFIG)
configure.mk.kernel:
@echo Please run ./configure
@exit 1
all: kernel
install: install_kernel
install_kernel: install_modules
autoconf_h=$(shell /bin/ls -1 $(KSRC_OBJ)/include/*/autoconf.h 2> /dev/null | head -1)
kconfig_h=$(shell /bin/ls -1 $(KSRC)/include/*/kconfig.h 2> /dev/null | head -1)
ifneq ($(kconfig_h),)
KCONFIG_H = -include $(kconfig_h)
endif
V ?= 0
#########################
# make kernel #
#########################
#NB: The LINUXINCLUDE value comes from main kernel Makefile
# with local directories prepended. This eventually affects
# CPPFLAGS in the kernel Makefile
kernel: $(COMPAT_CONFIG) $(COMPAT_AUTOCONF)
@echo "Building kernel modules"
@echo "Kernel version: $(KVERSION)"
@echo "Modules directory: $(INSTALL_MOD_PATH)/$(MODULES_DIR)"
@echo "Kernel sources: $(KSRC_OBJ)"
env CWD=$(CWD) BACKPORT_INCLUDES=$(BACKPORT_INCLUDES) \
$(MAKE) -C $(KSRC_OBJ) SUBDIRS="$(CWD)" \
V=$(V) KBUILD_NOCMDDEP=1 $(WITH_MAKE_PARAMS) \
@CONFIG_VALUES@ \
LINUXINCLUDE=' \
-D__OFED_BUILD__ \
-D__KERNEL__ \
$(CFLAGS) \
-include $(autoconf_h) \
$(KCONFIG_H) \
-include $(CWD)/include/linux/compat-2.6.h \
$(BACKPORT_INCLUDES) \
$(KERNEL_MEMTRACK_CFLAGS) \
$(OPENIB_KERNEL_EXTRA_CFLAGS) \
-I$(CWD)/include \
-I$(CWD)/include/uapi \
-I$(CWD)/drivers/infiniband/debug \
-I/usr/local/include/scst \
-I$(CWD)/drivers/infiniband/ulp/srpt \
$$(if $$(CONFIG_XEN),-D__XEN_INTERFACE_VERSION__=$$(CONFIG_XEN_INTERFACE_VERSION)) \
$$(if $$(CONFIG_XEN),-I$$(srctree)/arch/x86/include/mach-xen) \
-I$$(srctree)/arch/$$(SRCARCH)/include \
-Iarch/$$(SRCARCH)/include/generated \
-Iinclude \
-I$$(srctree)/arch/$$(SRCARCH)/include/uapi \
-Iarch/$$(SRCARCH)/include/generated/uapi \
-I$$(srctree)/include \
-I$$(srctree)/include/uapi \
-Iinclude/generated/uapi \
$$(if $$(KBUILD_SRC),-Iinclude2 -I$$(srctree)/include) \
-I$$(srctree)/arch/$$(SRCARCH)/include \
-Iarch/$$(SRCARCH)/include/generated \
' \
modules
#########################
# Install kernel #
#########################
install_modules:
@echo "Installing kernel modules"
$(MAKE) -C $(KSRC_OBJ) SUBDIRS="$(CWD)" \
INSTALL_MOD_PATH=$(INSTALL_MOD_PATH) \
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
$(WITH_MAKE_PARAMS) modules_install;
if [ ! -n "$(INSTALL_MOD_PATH)" ]; then $(DEPMOD) $(KVERSION);fi;
clean: clean_kernel
clean_kernel:
$(MAKE) -C $(KSRC_OBJ) rm-files= SUBDIRS="$(CWD)" $(WITH_MAKE_PARAMS) \
@CONFIG_VALUES@ \
clean
distclean: clean_kernel
@/bin/rm -f $(clean-files)
clean-files := Module.symvers modules.order Module.markers compat/modules.order compat/configure
clean-files += $(COMPAT_CONFIG) $(COMPAT_AUTOCONF)
clean-files += include/linux/autoconf.h include/generated/autoconf.h
clean-files += allconfigs makefile
help:
@echo
@echo kernel: build kernel modules
@echo all: build kernel modules
@echo
@echo install_kernel: install kernel modules under $(INSTALL_MOD_PATH)/$(MODULES_DIR)
@echo install: run install_kernel
@echo
@echo clean: delete kernel modules binaries
@echo clean_kernel: delete kernel modules binaries
@echo