Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 head    1.1;
  2 access;
  3 symbols;
  4 locks
  5         baker:1.1; strict;
  6 comment @# @;
  7 
  8 
  9 1.1
 10 date    2004.08.30.18.58.34;    author baker;   state Exp;
 11 branches;
 12 next    ;
 13 
 14 
 15 desc
 16 @@
 17 
 18 
 19 1.1
 20 log
 21 @Initial revision
 22 @
 23 text
 24 @# -*-makefile-*-
 25 #
 26 # This file is part of the sample code for the book "Linux Device Drivers",
 27 # second edition. It is meant to be generic and is designed to be recycled
 28 # by other drivers. The comments should be clear enough.
 29 # It partly comes from Linux Makefile, and needs GNU make. <rubini@@linux.it>
 30 
 31 # TOPDIR is declared by the Makefile including this file.
 32 ifndef TOPDIR
 33         TOPDIR = .
 34 endif
 35 
 36 # KERNELDIR can be speficied on the command line or environment
 37 ifndef KERNELDIR
 38         KERNELDIR = /usr/src/linux
 39 endif
 40 # The headers are taken from the kernel
 41         INCLUDEDIR = $(KERNELDIR)/include
 42 
 43 # We need the configuration file, for CONFIG_SMP and possibly other stuff
 44 # (especiall for RISC platforms, where CFLAGS depends on the exact
 45 # processor being used).
 46 ifeq ($(KERNELDIR)/.config,$(wildcard $(KERNELDIR))/.config)
 47         include $(KERNELDIR)/.config
 48 else
 49         MESSAGE := $(shell echo "WARNING: no .config file in $(KERNELDIR)")
 50 endif
 51 
 52 # ARCH can be speficed on the comdline or env. too, and defaults to this arch
 53 # Unfortunately, we can't easily extract if from kernel configuration
 54 # (well, we could look athe asm- symlink... don't know if worth the effort)
 55 ifndef ARCH
 56   ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
 57                 -e s/arm.*/arm/ -e s/sa110/arm/)
 58 endif
 59 
 60 # This is useful if cross-compiling. Taken from kernel Makefile (CC changed)
 61 AS      =$(CROSS_COMPILE)as
 62 LD      =$(CROSS_COMPILE)ld
 63 CC      =$(CROSS_COMPILE)gcc
 64 CPP     =$(CC) -E
 65 AR      =$(CROSS_COMPILE)ar
 66 NM      =$(CROSS_COMPILE)nm
 67 STRIP   =$(CROSS_COMPILE)strip
 68 OBJCOPY =$(CROSS_COMPILE)objcopy
 69 OBJDUMP =$(CROSS_COMPILE)objdump
 70 
 71 # The platform-specific Makefiles include portability nightmares.
 72 # Some platforms, though, don't have one, so check for existence first
 73 ARCHMAKEFILE = $(TOPDIR)/Makefile.$(ARCH)
 74 ifeq ($(ARCHMAKEFILE),$(wildcard $(ARCHMAKEFILE)))
 75   include $(ARCHMAKEFILE)
 76 endif
 77 
 78 # CFLAGS: all assignments to CFLAGS are inclremental, so you can specify
 79 # the initial flags on the command line or environment, if needed.
 80 
 81         CFLAGS +=  -D__KERNEL__ -DMODULE -I$(INCLUDEDIR)
 82 
 83 ifdef CONFIG_SMP
 84         CFLAGS += -D__SMP__ -DSMP
 85 endif
 86 
 87 # Prepend modversions.h if we're running with versioning.
 88 ifdef CONFIG_MODVERSIONS
 89         CFLAGS += -DMODVERSIONS -include $(KERNELDIR)/include/linux/modversions.h
 90 endif
 91 
 92 #Install dir
 93 VERSIONFILE = $(INCLUDEDIR)/linux/version.h
 94 VERSION     = $(shell awk -F\" '/REL/ {print $$2}' $(VERSIONFILE))
 95 INSTALLDIR = /lib/modules/$(VERSION)/misc
 96 @
  This page was automatically generated by the LXR engine.