⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makefile

📁 82546千兆网卡驱动程序,支持该系列所有芯片
💻
字号:
################################################################################## Intel PRO/1000 Linux driver# Copyright(c) 1999 - 2006 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.# # You should have received a copy of the GNU General Public License along with# this program; if not, write to the Free Software Foundation, Inc.,# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.# # The full GNU General Public License is included in this distribution in# the file called "COPYING".# # Contact Information:# Linux NICS <linux.nics@intel.com># e1000-devel Mailing List <e1000-devel@lists.sourceforge.net># Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497############################################################################################################################################################# Driver files# core driver filesCFILES = e1000_main.c e1000_hw.c e1000_param.c \         e1000_ethtool.c kcompat.cHFILES = e1000.h e1000_hw.h e1000_osdep.h kcompat.hifeq (,$(BUILD_KERNEL))BUILD_KERNEL=$(shell uname -r)endif############################################################################ Environment tests# Kernel Search Path# All the places we look for kernel sourceKSP :=  /lib/modules/$(BUILD_KERNEL)/build \        /lib/modules/$(BUILD_KERNEL)/source \        /usr/src/linux-$(BUILD_KERNEL) \        /usr/src/linux-$($(BUILD_KERNEL) | sed 's/-.*//') \        /usr/src/kernel-headers-$(BUILD_KERNEL) \        /usr/src/kernel-source-$(BUILD_KERNEL) \        /usr/src/linux-$($(BUILD_KERNEL) | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/') \        /usr/src/linux# prune the list down to only values that exist# and have an include/linux sub-directorytest_dir = $(shell [ -e $(dir)/include/linux ] && echo $(dir))KSP := $(foreach dir, $(KSP), $(test_dir))# we will use this first valid entry in the search pathifeq (,$(KSRC))  KSRC := $(firstword $(KSP))endififeq (,$(KSRC))  $(error Linux kernel source not found)elseifeq (/lib/modules/$(shell uname -r)/source, $(KSRC))  KOBJ :=  /lib/modules/$(shell uname -r)/buildelse  KOBJ :=  $(KSRC)endifendif# check for version.h and autoconf.h for running kernel in /boot (SUSE)ifneq (,$(wildcard /boot/vmlinuz.version.h))  VERSION_FILE := /boot/vmlinuz.version.h  CONFIG_FILE  := /boot/vmlinuz.autoconf.h  KVER := $(shell $(CC) $(CFLAGS) -E -dM $(VERSION_FILE) | \          grep UTS_RELEASE | awk '{ print $$3 }' | sed 's/\"//g')  ifeq ($(KVER),$(shell uname -r))    # set up include path to override headers from kernel source    x:=$(shell rm -rf include)    x:=$(shell mkdir -p include/linux)    x:=$(shell cp /boot/vmlinuz.version.h include/linux/version.h)    x:=$(shell cp /boot/vmlinuz.autoconf.h include/linux/autoconf.h)    CFLAGS += -I./include  else    VERSION_FILE := $(KOBJ)/include/linux/version.h    CONFIG_FILE  := $(KSRC)/include/linux/autoconf.h  endifelse  ifneq (,$(wildcard $(KOBJ)/include/linux/utsrelease.h))    VERSION_FILE := $(KOBJ)/include/linux/utsrelease.h  else    VERSION_FILE := $(KOBJ)/include/linux/version.h  endif  CONFIG_FILE  := $(KSRC)/include/linux/autoconf.hendififeq (,$(wildcard $(VERSION_FILE)))  $(error Linux kernel source not configured - missing version.h)endififeq (,$(wildcard $(CONFIG_FILE)))  $(error Linux kernel source not configured - missing autoconf.h)endif# pick a compilerifneq (,$(findstring egcs-2.91.66, $(shell cat /proc/version)))  CC := kgcc gcc ccelse  CC := gcc ccendiftest_cc = $(shell $(cc) --version > /dev/null 2>&1 && echo $(cc))CC := $(foreach cc, $(CC), $(test_cc))CC := $(firstword $(CC))ifeq (,$(CC))  $(error Compiler not found)endif# we need to know what platform the driver is being built on# some additional features are only built on Intel platformsARCH := $(shell uname -m | sed 's/i.86/i386/')ifeq ($(ARCH),alpha)  CFLAGS += -ffixed-8 -mno-fp-regsendififeq ($(ARCH),x86_64)  CFLAGS += -mcmodel=kernel -mno-red-zoneendififeq ($(ARCH),ppc)  CFLAGS += -msoft-floatendififeq ($(ARCH),ppc64)  CFLAGS += -m64 -msoft-float  LDFLAGS += -melf64ppcendif# standard flags for module buildsCFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -WallCFLAGS += -I$(KSRC)/include -I.CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \            echo "-DMODVERSIONS -DEXPORT_SYMTAB \                  -include $(KSRC)/include/linux/modversions.h")CFLAGS += $(CFLAGS_EXTRA)#ifeq (,$(shell echo $(CFLAGS_EXTRA) | grep NAPI))#CFLAGS += -DE1000_NO_NAPI#CFLAGS_EXTRA += -DE1000_NO_NAPI#endifRHC := $(KSRC)/include/linux/rhconfig.hifneq (,$(wildcard $(RHC)))  # 7.3 typo in rhconfig.h  ifneq (,$(shell $(CC) $(CFLAGS) -E -dM $(RHC) | grep __module__bigmem))	CFLAGS += -D__module_bigmem  endifendif# get the kernel version - we use this to find the correct install pathKVER := $(shell $(CC) $(CFLAGS) -E -dM $(VERSION_FILE) | grep UTS_RELEASE | \        awk '{ print $$3 }' | sed 's/\"//g')KKVER := $(shell echo $(KVER) | \         awk '{ if ($$0 ~ /2\.[4-9]\./) print "1"; else print "0"}')ifeq ($(KKVER), 0)  $(error *** Aborting the build. \          *** This driver is not supported on kernel versions older than 2.4.0)endif# set the install pathINSTDIR := /lib/modules/$(KVER)/kernel/drivers/net/e1000# look for SMP in config.hSMP := $(shell $(CC) $(CFLAGS) -E -dM $(CONFIG_FILE) | \         grep -w CONFIG_SMP | awk '{ print $$3 }')ifneq ($(SMP),1)  SMP := 0endififneq ($(SMP),$(shell uname -a | grep SMP > /dev/null 2>&1 && echo 1 || echo 0))  $(warning ***)  ifeq ($(SMP),1)    $(warning *** Warning: kernel source configuration (SMP))    $(warning *** does not match running kernel (UP))  else    $(warning *** Warning: kernel source configuration (UP))    $(warning *** does not match running kernel (SMP))  endif  $(warning *** Continuing with build,)  $(warning *** resulting driver may not be what you want)  $(warning ***)endififeq ($(SMP),1)  CFLAGS += -D__SMP__endif############################################################################ 2.4.x & 2.6.x Specific rulesK_VERSION:=$(shell uname -r | cut -c1-3 | sed 's/2\.[56]/2\.6/')ifeq ($(K_VERSION), 2.6)# Makefile for 2.6.x kernelTARGET = e1000.ko# man pageMANSECTION = 7MANFILE = $(TARGET:.ko=.$(MANSECTION))ifneq ($(PATCHLEVEL),)EXTRA_CFLAGS += $(CFLAGS_EXTRA)obj-m += e1000.oe1000-objs := $(CFILES:.c=.o)elsedefault:ifeq ($(KOBJ),$(KSRC))	make -C $(KSRC) SUBDIRS=$(shell pwd) moduleselse	make -C $(KSRC) O=$(KOBJ) SUBDIRS=$(shell pwd) modulesendifendifelse # ifeq ($(K_VERSION),2.6)# Makefile for 2.4.x kernelTARGET = e1000.o# man pageMANSECTION = 7MANFILE = $(TARGET:.o=.$(MANSECTION))# Get rid of compile warnings in kernel header files from SuSEifneq (,$(wildcard /etc/SuSE-release))  CFLAGS += -Wno-sign-compare -fno-strict-aliasingendif# Get rid of compile warnings in kernel header files from fedoraifneq (,$(wildcard /etc/fedora-release))  CFLAGS += -fno-strict-aliasingendif.SILENT: $(TARGET)$(TARGET): $(filter-out $(TARGET), $(CFILES:.c=.o))	$(LD) $(LDFLAGS) -r $^ -o $@	echo; echo	echo "**************************************************"	echo "** $(TARGET) built for $(KVER)"	echo -n "** SMP               "	if [ "$(SMP)" = "1" ]; \		then echo "Enabled"; else echo "Disabled"; fi	echo "**************************************************"	echo$(CFILES:.c=.o): $(HFILES) Makefiledefault:	makeendif # ifeq ($(K_VERSION),2.6)ifeq (,$(MANDIR))  # find the best place to install the man page  MANPATH := $(shell (manpath 2>/dev/null || echo $MANPATH) | sed 's/:/ /g')  ifneq (,$(MANPATH))    # test based on inclusion in MANPATH    test_dir = $(findstring $(dir), $(MANPATH))  else    # no MANPATH, test based on directory existence    test_dir = $(shell [ -e $(dir) ] && echo $(dir))  endif  # our preferred install path  # should /usr/local/man be in here ?  MANDIR := /usr/share/man /usr/man  MANDIR := $(foreach dir, $(MANDIR), $(test_dir))  MANDIR := $(firstword $(MANDIR))endififeq (,$(MANDIR))  # fallback to /usr/man  MANDIR := /usr/manendif# depmod version for rpm buildsDEPVER := $(shell /sbin/depmod -V 2>/dev/null | \          awk 'BEGIN {FS="."} NR==1 {print $$2}')############################################################################ Build rules$(MANFILE).gz: ../$(MANFILE)	gzip -c $< > $@install: default $(MANFILE).gz	# remove all old versions of the driver	find $(INSTALL_MOD_PATH)/lib/modules/$(KVER) -name $(TARGET) -exec rm -f {} \; || true	find $(INSTALL_MOD_PATH)/lib/modules/$(KVER) -name $(TARGET).gz -exec rm -f {} \; || true	install -D -m 644 $(TARGET) $(INSTALL_MOD_PATH)$(INSTDIR)/$(TARGET)ifeq (,$(INSTALL_MOD_PATH))	/sbin/depmod -a || trueelse  ifeq ($(DEPVER),1 )	/sbin/depmod -r $(INSTALL_MOD_PATH) -a || true  else	/sbin/depmod -b $(INSTALL_MOD_PATH) -a -n $(KVERSION) > /dev/null || true  endifendif	install -D -m 644 $(MANFILE).gz $(INSTALL_MOD_PATH)$(MANDIR)/man$(MANSECTION)/$(MANFILE).gz	man -c -P'cat > /dev/null' $(MANFILE:.$(MANSECTION)=) || trueuninstall:	if [ -e $(INSTDIR)/$(TARGET) ] ; then \	    rm -f $(INSTDIR)/$(TARGET) ; \	fi	/sbin/depmod -a	if [ -e $(MANDIR)/man$(MANSECTION)/$(MANFILE).gz ] ; then \		rm -f $(MANDIR)/man$(MANSECTION)/$(MANFILE).gz ; \	fi.PHONY: clean installclean:	rm -rf $(TARGET) $(TARGET:.ko=.o) $(TARGET:.ko=.mod.c) $(TARGET:.ko=.mod.o) $(CFILES:.c=.o) $(MANFILE).gz .*cmd .tmp_versions

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -