📄 rules.make
字号:
# -*-makefile-*-## This file is part of the sample code for the book "Linux Device Drivers",# second edition. It is meant to be generic and is designed to be recycled# by other drivers. The comments should be clear enough.# It partly comes from Linux Makefile, and needs GNU make. <rubini@linux.it># TOPDIR is declared by the Makefile including this file.ifndef TOPDIR TOPDIR = .endif# KERNELDIR can be speficied on the command line or environmentifndef KERNELDIR KERNELDIR = /work/at-linux-sourceendif# The headers are taken from the kernel INCLUDEDIR = $(KERNELDIR)/include# We need the configuration file, for CONFIG_SMP and possibly other stuff# (especiall for RISC platforms, where CFLAGS depends on the exact# processor being used).ifeq ($(KERNELDIR)/.config,$(wildcard $(KERNELDIR))/.config) include $(KERNELDIR)/.configelse MESSAGE := $(shell echo "WARNING: no .config file in $(KERNELDIR)")endif# ARCH can be speficed on the comdline or env. too, and defaults to this arch# Unfortunately, we can't easily extract if from kernel configuration# (well, we could look athe asm- symlink... don't know if worth the effort)ifndef ARCH#ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ -e s/arm.*/arm/ -e s/sa110/arm/)ARCH := armendif# This is useful if cross-compiling. Taken from kernel Makefile (CC changed)#CROSS_COMPILE = CROSS_COMPILE = arm-linux-AS =$(CROSS_COMPILE)asLD =$(CROSS_COMPILE)ldCC =$(CROSS_COMPILE)gccCPP =$(CC) -EAR =$(CROSS_COMPILE)arNM =$(CROSS_COMPILE)nmSTRIP =$(CROSS_COMPILE)stripOBJCOPY =$(CROSS_COMPILE)objcopyOBJDUMP =$(CROSS_COMPILE)objdump# The platform-specific Makefiles include portability nightmares.# Some platforms, though, don't have one, so check for existence firstARCHMAKEFILE = $(TOPDIR)/Makefile.$(ARCH)ifeq ($(ARCHMAKEFILE),$(wildcard $(ARCHMAKEFILE))) include $(ARCHMAKEFILE)endif# CFLAGS: all assignments to CFLAGS are inclremental, so you can specify# the initial flags on the command line or environment, if needed. CFLAGS += -Wall -D__KERNEL__ -DMODULE -I$(INCLUDEDIR)ifdef CONFIG_SMP CFLAGS += -D__SMP__ -DSMPendif# Prepend modversions.h if we're running with versioning.ifdef CONFIG_MODVERSIONS CFLAGS += -DMODVERSIONS -include $(KERNELDIR)/include/linux/modversions.hendif#Install dirVERSIONFILE = $(INCLUDEDIR)/linux/version.hVERSION = $(shell awk -F\" '/REL/ {print $$2}' $(VERSIONFILE))INSTALLDIR = /lib/modules/$(VERSION)/misc
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -