1 builddir = @abs_builddir@
3 top_srcdir = @abs_top_srcdir@
8 # The names vpath and VPATH are very special for GNU Make and Automake.
9 # The following odd construction works around these oddities, whereas
10 # the straightforward "VPATH = $(srcdir)/.." will not work.
14 include $(srcdir)/../Modules.mk
15 include $(srcdir)/Modules.mk
23 rm -f $(all_objects) *_mod.o $(all_dummies)
24 for d in $(all_objdirs); do \
26 rmdir $$d 2> /dev/null; \
35 ifeq (/lib/modules/$(shell uname -r)/source, $(KSRC))
36 KOBJ := /lib/modules/$(shell uname -r)/build
41 ifneq ($(shell grep -c 'PATCHLEVEL = 4' $(KSRC)/Makefile),1)
42 $(error Linux kernel source in $(KSRC) not 2.4)
45 VERSION_FILE := $(KOBJ)/include/linux/version.h
46 ifeq (,$(wildcard $(VERSION_FILE)))
47 $(error Linux kernel source not configured - missing version.h)
50 CONFIG_FILE := $(KSRC)/include/linux/autoconf.h
51 ifeq (,$(wildcard $(CONFIG_FILE)))
52 $(error Linux kernel source not configured - missing autoconf.h)
55 K_SUBLEVEL := $(shell sed -n 's/SUBLEVEL = // p' $(KSRC)/Makefile)
56 ifeq ($(shell test $(K_SUBLEVEL) -le 20; echo $?), 0)
57 # 2.4.20 and before require GCC 2.95.
60 # Later 2.4 versions are more flexible.
61 CC := gcc-3.4 gcc-3.3 gcc-2.95
63 test_cc = $(shell $(cc) --version > /dev/null 2>&1 && echo $(cc))
64 CC := $(foreach cc, $(CC), $(test_cc))
65 CC := $(firstword $(CC))
67 $(error Compiler not found)
70 CFLAGS = -DVERSION=\"$(VERSION)\" -O2 -g
71 CFLAGS += -I $(srcdir)/.. -I $(builddir)/.. -I $(top_srcdir)/include
73 ARCH := $(shell uname -m | sed 's/i.86/i386/')
75 CFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall
76 CFLAGS += -I$(srcdir)/compat-2.4/include-$(ARCH)
77 CFLAGS += -I$(srcdir)/compat-2.4/include
78 CFLAGS += -I$(srcdir)/compat-2.4
79 CFLAGS += -I$(KSRC)/include -I.
80 CFLAGS += -Wno-sign-compare -fno-strict-aliasing
81 CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \
82 echo "-DMODVERSIONS -DEXPORT_SYMTAB \
83 -include $(KSRC)/include/linux/modversions.h")
85 $(all_objects): $(all_dummies)
90 default: $(patsubst %,%_mod.o,$(all_modules))
92 define module_template
93 $(1)_objects = $$(patsubst %.c,%.o,$($(1)_sources))
94 $($(1)_sources): $(headers)
95 $(1)_mod.o: $$($(1)_objects)
96 $(LD) $(LDFLAGS) -r $$^ -o $$@
99 $(foreach module,$(all_modules),$(eval $(call module_template,$(module))))
102 # Much of the kernel build system in this file is derived from Intel's
103 # e1000 distribution, with the following license:
105 ################################################################################
107 # Intel PRO/1000 Linux driver
108 # Copyright(c) 1999 - 2007 Intel Corporation.
110 # This program is free software; you can redistribute it and/or modify it
111 # under the terms and conditions of the GNU General Public License,
112 # version 2, as published by the Free Software Foundation.
114 # This program is distributed in the hope it will be useful, but WITHOUT
115 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
116 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
119 # You should have received a copy of the GNU General Public License along with
120 # this program; if not, write to the Free Software Foundation, Inc.,
121 # 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
123 # The full GNU General Public License is included in this distribution in
124 # the file called "COPYING".
126 # Contact Information:
127 # Linux NICS <linux.nics@intel.com>
128 # e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
129 # Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
131 ################################################################################