2 builddir = @abs_builddir@
4 top_srcdir = @abs_top_srcdir@
11 include $(srcdir)/../Modules.mk
12 include $(srcdir)/Modules.mk
16 $(foreach m,$(all_modules), \
17 $(foreach s,$($(m)_sources), \
18 $(eval $(notdir $(s)): ; ln -s $(srcdir)/../$(s) .)))
26 rm -f *.o *_mod.o .*.o.flags
27 for d in $(all_links); do if test -h $$d; then rm $$d; fi; done
31 ifneq ($(shell grep -c 'PATCHLEVEL = 4' $(KSRC)/Makefile),1)
32 $(error Linux kernel source in $(KSRC) not 2.4)
35 ifeq (/lib/modules/$(shell uname -r)/source, $(KSRC))
36 KOBJ := /lib/modules/$(shell uname -r)/build
41 VERSION_FILE := $(KOBJ)/include/linux/version.h
42 ifeq (,$(wildcard $(VERSION_FILE)))
43 $(error Linux kernel source not configured - missing version.h)
46 CONFIG_FILE := $(KSRC)/include/linux/autoconf.h
47 ifeq (,$(wildcard $(CONFIG_FILE)))
48 $(error Linux kernel source not configured - missing autoconf.h)
51 # Determine the Cross-compile string for the kernel, which should just be the
52 # c compiler with 'gcc' removed from the end. We're obviously assuming gcc
54 CROSS_COMPILE = $(shell echo $(AC_CC) | perl -p -e 's/(.*)gcc.*/$$1/')
56 # Determine if we want to override the ARCH for the kernel
58 ARCH_OVERRIDE := ARCH=$(KARCH)
63 .PHONY: all distclean distdir clean check
65 # Invoke the kernel build system
67 $(MAKE) -C $(KSRC) $(ARCH_OVERRIDE) CROSS_COMPILE=$(CROSS_COMPILE) SUBDIRS=$(PWD) modules