fm10k/src/Makefile
2020-10-20 20:06:27 +02:00

174 lines
5.8 KiB
Makefile

# SPDX-License-Identifier: GPL-2.0
# Copyright(c) 2013 - 2018 Intel Corporation.
ifneq ($(KERNELRELEASE),)
# kbuild part of makefile
#
# Makefile for the Intel(R) Ethernet Switch Host Interface Driver
#
obj-$(CONFIG_FM10K) += fm10k.o
fm10k-y := fm10k_main.o \
fm10k_common.o \
fm10k_pci.o \
fm10k_netdev.o \
fm10k_ethtool.o \
fm10k_ies.o \
fm10k_param.o \
fm10k_pf.o \
fm10k_vf.o \
fm10k_mbx.o \
fm10k_iov.o \
fm10k_tlv.o
fm10k-$(CONFIG_DEBUG_FS) += fm10k_debugfs.o
fm10k-$(CONFIG_DCB) += fm10k_dcbnl.o
ifdef CONFIG_UIO
fm10k-y += fm10k_uio.o
endif
fm10k-y += kcompat.o
else # ifneq($(KERNELRELEASE),)
# normal makefile
DRIVER := fm10k
# If the user just wants to print the help output, don't include common.mk or
# perform any other checks. This ensures that running "make help" will always
# work even if kernel-devel is not installed, or if the common.mk fails under
# any other error condition.
ifneq ($(MAKECMDGOALS),help)
include common.mk
# fm10k does not support building on kernels older than 2.6.32
$(call minimum_kver_check,2,6,32)
endif
# Command to update initramfs or display a warning message
ifeq (${cmd_initrd},)
define cmd_initramfs
@echo "Unable to update initramfs. You may need to do this manaully."
endef
else
define cmd_initramfs
@echo "Updating initramfs..."
-@$(call cmd_initrd)
endef
endif
###############
# Build rules #
###############
# Standard compilation, with regular output
default:
@+$(call kernelbuild,modules)
# Noisy output, for extra debugging
noisy:
@+$(call kernelbuild,modules,V=1)
# Silence any output generated
silent:
@+$(call kernelbuild,modules,>/dev/null)
# Enable higher warning level
checkwarnings: clean
@+$(call kernelbuild,modules,W=1)
# Run sparse static analyzer
sparse: clean
@+$(call kernelbuild,modules,C=2 CF="-D__CHECK_ENDIAN__ -Wbitwise -Wcontext")
# Run coccicheck static analyzer
ccc: clean
@+$(call kernelbuild,modules,coccicheck MODE=report)
# Build manfiles
manfile:
@gzip -c ../${DRIVER}.${MANSECTION} > ${DRIVER}.${MANSECTION}.gz
# Clean the module subdirectories
clean:
@+$(call kernelbuild,clean)
@-rm -rf *.${MANSECTION}.gz *.ko
mandocs_install: manfile
@echo "Copying manpages..."
@install -D -m 644 ${DRIVER}.${MANSECTION}.gz ${INSTALL_MOD_PATH}${MANDIR}/man${MANSECTION}/${DRIVER}.${MANSECTION}.gz
# Install kernel module files. This target is called by the RPM specfile when
# generating binary RPMs, and is not expected to modify files outside of the
# build root. Thus, it must not update initramfs, or run depmod.
modules_install: default
@echo "Installing modules..."
@+$(call kernelbuild,modules_install)
# After installing all the files, perform necessary work to ensure the system
# will use the new modules. This includes running depmod to update module
# dependencies and updating the initramfs image in case the module is loaded
# during early boot.
install: modules_install mandocs_install
$(call cmd_depmod)
$(call cmd_initramfs)
mandocs_uninstall:
if [ -e ${INSTALL_MOD_PATH}${MANDIR}/man${MANSECTION}/${DRIVER}.${MANSECTION}.gz ] ; then \
rm -f ${INSTALL_MOD_PATH}${MANDIR}/man${MANSECTION}/${DRIVER}.${MANSECTION}.gz ; \
fi;
# Remove installed module files. This target is called by the RPM specfile when
# generating binary RPMs, and is not expected to modify files outside of the
# build root. Thus, it must not update the initramfs image or run depmod.
modules_uninstall:
rm -f ${INSTALL_MOD_PATH}/lib/modules/${KVER}/${INSTALL_MOD_DIR}/${DRIVER}.ko;
# After uninstalling all the files, perform necessary work to restore the
# system back to using the default kernel modules. This includes running depmod
# to update module dependencies and updating the initramfs image.
uninstall: modules_uninstall mandocs_uninstall
$(call cmd_depmod)
$(call cmd_initramfs)
########
# Help #
########
help:
@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 ''
@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 ''
@echo 'Cleaning targets:'
@echo ' clean - Clean files generated by kernel module build'
@echo ''
@echo 'Other targets:'
@echo ' manfile - Generate a gzipped manpage'
@echo ' modules_install - install the module(s) only'
@echo ' mandocs_install - install the manpage only'
@echo ' install - Build then install the module(s) and manpage, and update initramfs'
@echo ' modules_uninstall - uninstall the module(s) only'
@echo ' mandocs_uninstall - uninstall the manpage only'
@echo ' uninstall - Uninstall the module(s) and manpage, and update initramfs'
@echo ' help - Display this help message'
@echo ''
@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 ' KSRC - Specifies the full path to the kernel tree to build against'
@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),)