-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathMakefile
More file actions
161 lines (131 loc) · 4.98 KB
/
Copy pathMakefile
File metadata and controls
161 lines (131 loc) · 4.98 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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# SPDX-License-Identifier: GPL-2.0
#
# This file is part of Lustre, http://www.lustre.org/
#
.DEFAULT_GOAL := __default
#
# The top-level autoMakefile is only used for 'make install' and 'make dist'.
# For the remaining make targets (often run interactively), we want to avoid
# warnings about redefining make targets. Hence, we conditionally include
# the autoMakefile.
#
ALWAYS_TARGETS := help checkpatch utils modules \
TAGS tags etags ctags cscope mkid \
checkstack checkstack-update checkstack-clean
ifeq ($(MAKECMDGOALS),)
-include autoMakefile
else ifneq ($(filter-out $(ALWAYS_TARGETS), $(MAKECMDGOALS)),)
-include autoMakefile
endif
#
# Include Makefile.exports to import the autoconf variables as plain make
# variables. Include the remaining make files to import their specific
# make targets.
#
-include config/Makefile.exports
-include config/Makefile.codetags
-include config/Makefile.pkg-rpm
-include config/Makefile.dkms-rpm
-include config/Makefile.pkg-deb
-include config/Makefile.dkms-deb
-include config/Makefile.checkstack
#
# Pass all lines in the make recipe to a single invocation of the shell
# See: https://www.gnu.org/software/make/manual/html_node/One-Shell.html
#
.ONESHELL:
#
# Help text in the style of the Linux kernel. When in doubt, try to mimic Linux
# style. And don't bother including intermediate build targets if they are not
# likely to be run iteractively.
#
help:
@echo 'Cleaning targets:'
echo ' clean - Remove generated object files but keep the files'
echo ' generated by autotools; use `git clean -xdf` to'
echo ' purge all files not tracked by git'
echo ''
echo 'Generic targets:'
echo ' all - Build all modules and utilities enabled by'
echo ' autotools'
echo ' utils - Build only userspace utilities'
echo ' modules - Build only kernel modules'
echo ' checkpatch - Run checkpatch.pl on latest commit'
echo ' checkstack - Run checkstack.pl'
echo ' checkstack-update - Update checkstack.pl'
echo ' checkstack-clean - Remove checkstack.pl artifacts'
echo ''
echo 'Packaging targets:'
echo ' rpms - Create RPM packages'
echo ' srpm - Create source RPM packages'
echo ' dkms-rpm - Create DKMS RPM packages'
echo ' dkms-srpm - Create source DKMS RPM packages'
echo ' debs - Create Debian packages'
echo ' dkms-debs - Create DKMS Debian packages'
#
# Run Lustre's custom checkpatch.pl script against the latest commit.
#
checkpatch:
@git diff HEAD~1 | ./contrib/scripts/checkpatch.pl
#
# Several modules (like ldiskfs or in-kernel-o2iblnd) define sources targets.
# This generic make target assigns 'foobar_sources' to run
# 'make source -C foobar'.
#
SOURCE_SUBDIRS := $(LUSTRE_BUILT_IN_KO2IBLND_NT) \
$(LUSTRE_LDISKFS_MT)
SOURCE_SUBDIRS_TGT = $(addsuffix _sources,$(SOURCE_SUBDIRS))
.PHONY: $(SOURCE_SUBDIRS_TGT)
$(SOURCE_SUBDIRS_TGT):
$(MAKE) sources -C $(patsubst %_sources,%,$@)
#
# Generic make target to assigns 'foobar' to 'make -C foobar'.
#
SUBDIRS := $(LUSTRE_IOKIT_MT) $(LUSTRE_LDISKFS_MT) \
Documentation lustre/tests lustre/scripts \
lustre/conf lib lnet/utils lustre/utils
.PHONY: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@
#
# lnet/klnds/o2iblnd is used to build the Infiniband LNet driver against the
# out-of-tree Mellanox driver. This is split to a separate build target so that
# the generic module build target doesn't require external symbol versions.
#
.PHONY: lnet/klnds/o2iblnd
lnet/klnds/o2iblnd: __modules
$(MAKE) BUILD_EXT_O2IB=yes \
KBUILD_EXTRA_SYMBOLS="$(PWD)/Module.symvers $(LUSTRE_EXT_O2IB_SYMBOLS) $(LUSTRE_EXTRA_SYMBOLS)" \
CC="$(LUSTRE_CC)" -C $(LUSTRE_LINUX_OBJ) \
M=$(PWD)/lnet/klnds/o2iblnd
#
# Build the in-kernel-o2iblnd module as ko2iblnd.ko and rename it to
# in-kernel-ko2iblnd.ko so that the kernel recognizes the module as
# ko2iblnd despite the file name being in-kernel-ko2iblnd.
#
.PHONY: lnet/klnds/in-kernel-o2iblnd
lnet/klnds/in-kernel-o2iblnd: __modules
cp -vf lnet/klnds/in-kernel-o2iblnd/ko2iblnd.ko \
lnet/klnds/in-kernel-o2iblnd/in-kernel-ko2iblnd.ko
#
# This is the entry point to the Linux build system. The top-level Kbuild file
# is the next file invoked by this target.
#
.PHONY: __modules
__modules: $(SOURCE_SUBDIRS_TGT)
$(MAKE) KBUILD_EXTRA_SYMBOLS="$(LUSTRE_INT_O2IB_SYMBOLS) $(LUSTRE_EXTRA_SYMBOLS) $(KBUILD_EXTRA_SYMBOLS)" \
CC="$(LUSTRE_CC)" -C $(LUSTRE_LINUX_OBJ) \
M=$(PWD)
#
# Express dependencies for the already defined make targets. Make automatically
# combines make targets with the same name if they are in the same file. By
# listing the dependencies at the end, we can define most targets using generic
# make targets.
#
lnet/utils: lib
lustre/utils: lib lnet/utils
utils: lib lnet/utils lustre/utils
lustre/tests: utils
ldiskfs: $(SOURCE_SUBDIRS_TGT)
modules: __modules $(LUSTRE_BUILT_IN_KO2IBLND_NT) $(LUSTRE_EXTERNAL_KO2IBLND_NT)
__default: utils $(LUSTRE_MODULES_MT) $(SUBDIRS)