################################################################################ # # Intel(R) 10GbE PCI Express Linux Network Driver # Copyright(c) 1999 - 2017 Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, # version 2, as published by the Free Software Foundation. # # This program is distributed in the hope it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. # # The full GNU General Public License is included in this distribution in # the file called "COPYING". # # Contact Information: # Linux NICS # e1000-devel Mailing List # Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 # Silicom, Ltd ################################################################################ MOD_VER=5.2.0.41 PRDPATH_UTIL=/bin TARGET_UTIL=bpctl_util OBJS_UTIL = bp_util.o ifneq ($(KERNELRELEASE),) # kbuild part of makefile # # Makefile for the Intel(R) 10GbE PCI Express Linux Network Driver # obj-$(CONFIG_BPCTL_MOD) += bpctl_mod.o define bpctl_mod-y bp_mod.o endef bpctl_mod-y := $(strip ${bpctl_mod-y}) else # ifneq($(KERNELRELEASE),) # normal makefile DRIVER := bpctl_mod ifeq (,$(wildcard common.mk)) $(error Cannot find common.mk build rules) else include common.mk endif # Check that kernel version is at least 2.6.0, since we don't support 2.4.x # kernels with the BPCTL driver. We can't use minimum_kver_check since SLES 10 # SP4's Make has a bug which causes $(eval) inside an ifeq conditional to error # out. This was fixed in Make 3.81, but SLES 10 SP4 does not have a fix for # this yet. ifeq (0,$(shell [ ${KVER_CODE} -lt $(call get_kvercode,2,6,0) ]; echo "$?")) $(warning *** Aborting the build.) $(error This driver is not supported on kernel versions older than 2.6.0) 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: $(TARGET_UTIL) @+$(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)) # Clean the module subdirectories clean: @+$(call devkernelbuild,clean) @-rm -rf *.ko rm -rf $(OBJS_UTIL) $(TARGET_UTIL) # Install the modules install: default @echo "Installing modules..." @+$(call devkernelbuild,modules_install) @echo "Running depmod..." @$(call cmd_depmod) mkdir -p $(INSTALL_MOD_PATH)$(PRDPATH_UTIL) install $(TARGET_UTIL) $(INSTALL_MOD_PATH)$(PRDPATH_UTIL) install bpctl_start $(INSTALL_MOD_PATH)$(PRDPATH_UTIL) install bpctl_stop $(INSTALL_MOD_PATH)$(PRDPATH_UTIL) $(TARGET_UTIL): $(OBJS_UTIL) $(CC) $(OBJS_UTIL) -g -Wall -o $(TARGET_UTIL) uninstall: rm -f ${INSTALL_MOD_PATH}/lib/modules/${KVER}/${INSTALL_MOD_DIR}/${DRIVER}.ko; $(call cmd_depmod) if [ -e $(INSTALL_MOD_PATH)$(PRDPATH_UTIL)/$(TARGET_UTIL) ] ; then \ rm -f $(INSTALL_MOD_PATH)$(PRDPATH_UTIL)/$(TARGET_UTIL) ; \ fi if [ -e $(INSTALL_MOD_PATH)$(PRDPATH_UTIL)/bpctl_start ] ; then \ rm -f $(INSTALL_MOD_PATH)$(PRDPATH_UTIL)/bpctl_start ; \ fi if [ -e $(INSTALL_MOD_PATH)$(PRDPATH_UTIL)/bpctl_stop ] ; then \ rm -f $(INSTALL_MOD_PATH)$(PRDPATH_UTIL)/bpctl_stop ; \ 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 ' install - Build then install the module(s)' @echo ' uninstall - Uninstall the module(s)' @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 installation path' @echo ' Other variables may be available for tuning make process, see' @echo ' Kernel Kbuild documentation for more information' .PHONY: default noisy clean silent sparse ccc install uninstall help endif # ifneq($(KERNELRELEASE),)