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

📄 makefile

📁 Linux* Base Driver for the Intel(R) PRO/100 Family of Adapters
💻
字号:
################################################################################## # Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.# # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation; either version 2 of the License, or (at your option) # any later version.# # This program is distributed in the hope that 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., 59 # Temple Place - Suite 330, Boston, MA  02111-1307, USA.# # The full GNU General Public License is included in this distribution in the# file called LICENSE.# # Contact Information:# Linux NICS <linux.nics@intel.com># Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497################################################################################################################################################################ Configuration Section# debug# CFLAGS += -g#extra warnings#CFLAGS += -W -Wfloat-equal -Wtraditional -Wundef -Wshadow -Wpointer-arith\# -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion\#-Wsign-compare -Waggregate-return -Wmissing-prototypes -Wmissing-declarations\#  -Wpacked -Wpadded -Wredundant-decls -Wnested-externs -Wunreachable-code  -Winline############################################################################### Driver files# core driver filesTARGET := e100.oCFILES = e100_main.c e100_eeprom.c e100_config.c e100_phy.c e100_kcompat.c e100_test.cHFILES = e100.h e100_config.h e100_phy.h e100_kcompat.h e100_ucode.h # ManMAN_FILE = e100.7# pick an appropriate MAN pathMAN_CFG := /etc/man.configMAN_TYPE := man7MSP := $(shell [ -e $(MAN_CFG) ] && grep -e "^MANPATH[^_]" $(MAN_CFG) | awk '{print $$2}')ifeq (,$(MSP))MSP :=	/usr/share/man \	/usr/manendif# prune the list down to only values that existtest_dir = $(shell [ -e $(dir)/$(MAN_TYPE) ] && echo $(dir))MSP := $(foreach dir, $(MSP), $(test_dir))# we will use the first valid entry in the search pathMAN_PATH := $(firstword $(MSP))ifeq (,$(MAN_PATH))  MAN_PATH := /usr/manendifMAN_INSTDIR=$(MAN_PATH)/$(MAN_TYPE)# 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=kernelendif############################################################################ Environment tests# Kernel Search Path# All the places we look for kernel sourceKSP :=  /lib/modules/$(shell uname -r)/build \        /usr/src/linux-$(shell uname -r) \        /usr/src/linux-$(shell uname -r | sed 's/-.*//') \        /usr/src/kernel-headers-$(shell uname -r) \        /usr/src/kernel-source-$(shell uname -r) \        /usr/src/linux-$(shell uname -r | 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 pathKSRC := $(firstword $(KSP))ifeq (,$(KSRC))  $(error Linux kernel source not found)endif# files we get information from in KSRC# 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 := $(KSRC)/include/linux/version.h		CONFIG_FILE  := $(KSRC)/include/linux/config.h	endifelse	VERSION_FILE := $(KSRC)/include/linux/version.h	CONFIG_FILE  := $(KSRC)/include/linux/config.hendififeq (,$(wildcard $(VERSION_FILE)))  $(error Linux kernel source not configured - missing version.h)endififeq (,$(wildcard $(CONFIG_FILE)))  $(error Linux kernel source not configured - missing config.h)endif# pick a compilerifneq (,$(findstring egcs-2.91.66, $(shell cat /proc/version)))  CC := kgcc gcc ccelse  CC := gcc ccendiftest_cc = $(shell which $(cc) > /dev/null 2>&1 && echo $(cc))CC := $(foreach cc, $(CC), $(test_cc))CC := $(firstword $(CC))ifeq (,$(CC))  $(error Compiler not found)endif# standard flags for module buildsCFLAGS += -Wall -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__ -O2 -pipeCFLAGS += -I$(KSRC)/include -I. -Wstrict-prototypes -fomit-frame-pointerCFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \            echo "-DMODVERSIONS -include $(KSRC)/include/linux/modversions.h")CFLAGS += $(CFLAGS_EXTRA)RHC := $(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)endififneq ($(KVER),$(shell uname -r))  $(warning ***)  $(warning *** Warning: kernel source version ($(KVER)))  $(warning *** does not match running kernel  ($(shell uname -r)))  $(warning *** Continuing with build,)  $(warning *** resulting driver may not be what you want)  $(warning ***)endif# pick an appropriate install pathifneq (,$(wildcard /lib/modules/$(KVER)/kernel))  INSTDIR := /lib/modules/$(KVER)/kernel/drivers/netelse  INSTDIR := /lib/modules/$(KVER)/netendif# look for SMP in config.hSMP := $(shell $(CC) $(CFLAGS) -E -dM $(CONFIG_FILE) | \         grep 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__endifARCH := $(shell uname -m | sed 's/i.86/i386/')ifeq ($(ARCH),ia64)  CFLAGS += -DSTB_WA endif# Check if it is 2.5 or 2.6 kernelsMATCH=$(shell uname -r | awk '{ if (/2\.[5-6]\./) print "1"; else print "0"}')ifeq ($(MATCH),1)CFLAGS += -DKBUILD_MODNAME=$(TARGET:.o=)ifeq ($(ARCH),i386)  CFLAGS += -I$(KSRC)/arch/i386/mach-generic -I$(KSRC)/include/asm-i386/mach-defaultendifendif# Get rid of compile warnings in kernel header files from SuSUifneq (,$(wildcard /etc/SuSE-release))  CFLAGS += -Wno-sign-compare -fno-strict-aliasingendif############################################################################ Build rules.SILENT: $(TARGET)$(TARGET): $(filter-out $(TARGET), $(CFILES:.c=.o))	$(LD) -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) Makefile$(MAN_FILE).gz: ../$(MAN_FILE)	gzip -c $< > $@install: $(TARGET) $(MAN_FILE).gz	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	mkdir -p $(INSTALL_MOD_PATH)$(INSTDIR)	install -m 644 -o `id -u` $(TARGET) $(INSTALL_MOD_PATH)$(INSTDIR)	mkdir -p $(INSTALL_MOD_PATH)$(MAN_INSTDIR)	install -m 644 -o `id -u` $(MAN_FILE).gz $(INSTALL_MOD_PATH)$(MAN_INSTDIR)ifeq (,$(INSTALL_MOD_PATH))	/sbin/depmod -a || trueelse	/sbin/depmod -b $(INSTALL_MOD_PATH) -a -n > /dev/null || trueendifuninstall:	rm -f $(INSTDIR)/$(TARGET)	rm -f $(MAN_INSTDIR)/$(MAN_FILE).gz	/sbin/depmod -aqsclean:	rm -rf $(TARGET) $(CFILES:.c=.o) $(MAN_FILE).gz

⌨️ 快捷键说明

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