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
|
# SPDX-License-Identifier: GPL-2.0
# Copyright(c) 1999 - 2020 Intel Corporation.
#ifndef REMOVE_COMPAT
ifneq ($(KERNELRELEASE),)
# kbuild part of makefile
#endif /* REMOVE_COMPAT */
#
# Makefile for the @SUMMARY@
#
obj-$(CONFIG_E1000E) += e1000e.o
define e1000e-y
netdev.o
ethtool.o
ich8lan.o
mac.o
nvm.o
phy.o
manage.o
80003es2lan.o
82571.o
param.o
endef
e1000e-y := $(strip ${e1000e-y})
#ifdef BUILD_PTP_SUPPORT
e1000e-$(CONFIG_PTP_1588_CLOCK:m=y) += ptp.o
#endif
#ifndef REMOVE_COMPAT
e1000e-y += kcompat.o
else # ifneq($(KERNELRELEASE),)
# normal makefile
DRIVER := e1000e
ifeq (,$(wildcard common.mk))
$(error Cannot find common.mk build rules)
else
include common.mk
endif
# Check that kernel version is at least 2.4.17
ifeq (0,$(shell [ ${KVER_CODE} -lt $(call get_kvercode,2,4,17) ]; echo "$?"))
$(warning *** Aborting the build.)
$(error This driver is not supported on kernel versions older than 2.4.17)
endif
######################
# Kernel Build Macro #
######################
# customized kernelbuild function
#
# ${1} is the kernel build target
# ${2} may contain extra rules to pass to kernelbuild macro
#
# We customize the kernelbuild target in order to provide our hack to disable
# CONFIG_PTP_1588_CLOCK support should -DNO_PTP_SUPPORT be defined in the extra
# cflags given on the command line.
devkernelbuild = $(call kernelbuild,$(if $(filter -DNO_PTP_SUPPORT,${EXTRA_CFLAGS}),CONFIG_PTP_1588_CLOCK=n) ${2},${1})
###############
# Build rules #
###############
# Standard compilation, with regular output
default:
@+$(call devkernelbuild,modules)
# Noisy output, for extra debugging
noisy:
@+$(call devkernelbuild,modules,V=1)
# Silence any output generated
silent:
@+$(call devkernelbuild,modules,>/dev/null)
# Enable higher warning level
checkwarnings: clean
@+$(call devkernelbuild,modules,W=1)
# Run sparse static analyzer
sparse: clean
@+$(call devkernelbuild,modules,C=2 CF="-D__CHECK_ENDIAN__ -Wbitwise -Wcontext")
# Run coccicheck static analyzer
ccc: clean
@+$(call devkernelbuild,modules,coccicheck MODE=report))
# Build manfiles
manfile:
@gzip -c ../${DRIVER}.${MANSECTION} > ${DRIVER}.${MANSECTION}.gz
# Clean the module subdirectories
clean:
@+$(call devkernelbuild,clean)
@-rm -rf *.${MANSECTION}.gz *.ko
# Install the modules and manpage
install: default manfile
@echo "Copying manpages..."
@install -D -m 644 ${DRIVER}.${MANSECTION}.gz ${INSTALL_MOD_PATH}${MANDIR}/man${MANSECTION}/${DRIVER}.${MANSECTION}.gz
@echo "Installing modules..."
@+$(call devkernelbuild,modules_install)
@echo "Running depmod..."
@$(call cmd_depmod)
# Target used by rpmbuild spec file
rpm: default manfile
@install -D -m 644 ${DRIVER}.${MANSECTION}.gz ${INSTALL_MOD_PATH}${MANDIR}/man${MANSECTION}/${DRIVER}.${MANSECTION}.gz
@install -D -m 644 ${DRIVER}.ko ${INSTALL_MOD_PATH}/lib/modules/${KVER}/${INSTALL_MOD_DIR}/${DRIVER}.ko
uninstall:
rm -f ${INSTALL_MOD_PATH}/lib/modules/${KVER}/${INSTALL_MOD_DIR}/${DRIVER}.ko;
$(call cmd_depmod)
if [ -e ${INSTALL_MOD_PATH}${MANDIR}/man${MANSECTION}/${DRIVER}.${MANSECTION}.gz ] ; then \
rm -f ${INSTALL_MOD_PATH}${MANDIR}/man${MANSECTION}/${DRIVER}.${MANSECTION}.gz ; \
fi;
########
# Help #
########
help:
@echo 'Cleaning targets:'
@echo ' clean - Clean files generated by kernel module build'
@echo 'Build targets:'
@echo ' default - Build module(s) with standard verbosity'
@echo ' noisy - Build module(s) with V=1 verbosity -- very noisy'
@echo ' silent - Build module(s), squelching all output'
@echo 'Static Analysis:'
@echo ' checkwarnings - Clean, then build module(s) with W=1 warnings enabled'
@echo ' sparse - Clean, then check module(s) using sparse'
@echo ' ccc - Clean, then check module(s) using coccicheck'
@echo 'Other targets:'
@echo ' manfile - Generate a gzipped manpage'
@echo ' install - Build then install the module(s) and manpage'
@echo ' uninstall - Uninstall the module(s) and manpage'
@echo ' help - Display this help message'
@echo 'Variables:'
@echo ' LINUX_VERSION - Debug tool to force kernel LINUX_VERSION_CODE. Use at your own risk.'
@echo ' W=N - Kernel variable for setting warning levels'
@echo ' V=N - Kernel variable for setting output verbosity'
@echo ' INSTALL_MOD_PATH - Add prefix for the module and manpage installation path'
@echo ' INSTALL_MOD_DIR - Use module directory other than updates/drivers/net/ethernet/intel/${DRIVER}'
@echo ' Other variables may be available for tuning make process, see'
@echo ' Kernel Kbuild documentation for more information'
.PHONY: default noisy clean manfile silent sparse ccc install uninstall help
endif # ifneq($(KERNELRELEASE),)
#endif /* REMOVE_COMPAT */
|