datapath: Support 2.6.33 kernel layout in build system.
[sliver-openvswitch.git] / datapath / linux-2.6 / Makefile.main.in
1 # -*- makefile -*-
2 export builddir = @abs_builddir@
3 export srcdir = @abs_srcdir@
4 export top_srcdir = @abs_top_srcdir@
5 export KSRC = @KBUILD26@
6 export VERSION = @VERSION@
7 export BUILD_VETH = @BUILD_VETH@
8 export BUILD_GRE = @BUILD_GRE@
9
10 include $(srcdir)/../Modules.mk
11 include $(srcdir)/Modules.mk
12
13 default: $(build_links)
14
15 $(foreach s,$(sort $(foreach m,$(build_modules),$($(m)_sources))), \
16   $(eval $(notdir $(s)): ; ln -s $(srcdir)/../$(s) $@))
17
18 distclean: clean
19         rm -f kcompat.h
20 distdir: clean
21 install:
22 all: default
23 check: all
24 clean:
25         rm -f *.o *.ko *_mod.* Module.symvers *.cmd kcompat.h.new
26         for d in $(build_links); do if test -h $$d; then rm $$d; fi; done
27
28 ifneq ($(KSRC),)
29
30 ifeq (/lib/modules/$(shell uname -r)/source, $(KSRC))
31   KOBJ := /lib/modules/$(shell uname -r)/build
32 else
33   KOBJ := $(KSRC)
34 endif
35
36 ifneq ($(shell grep -c 'PATCHLEVEL = 6' $(KSRC)/Makefile),1)
37   $(error Linux kernel source in $(KSRC) not 2.6)
38 endif
39
40 VERSION_FILE := $(KOBJ)/include/linux/version.h
41 ifeq (,$(wildcard $(VERSION_FILE)))
42   $(error Linux kernel source not configured - missing version.h)
43 endif
44
45 CONFIG_FILE := $(KSRC)/include/generated/autoconf.h
46 ifeq (,$(wildcard $(CONFIG_FILE)))
47   CONFIG_FILE := $(KSRC)/include/linux/autoconf.h
48   ifeq (,$(wildcard $(CONFIG_FILE)))
49     $(error Linux kernel source not configured - missing autoconf.h)
50   endif
51 endif
52
53 default:
54         $(MAKE) -C $(KSRC) M=$(builddir) modules
55 endif
56
57 # Much of the kernel build system in this file is derived from Intel's
58 # e1000 distribution, with the following license:
59
60 ################################################################################
61 #
62 # Intel PRO/1000 Linux driver
63 # Copyright(c) 1999 - 2007, 2009 Intel Corporation.
64 #
65 # This program is free software; you can redistribute it and/or modify it
66 # under the terms and conditions of the GNU General Public License,
67 # version 2, as published by the Free Software Foundation.
68 #
69 # This program is distributed in the hope it will be useful, but WITHOUT
70 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
71 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
72 # more details.
73 #
74 # You should have received a copy of the GNU General Public License along with
75 # this program; if not, write to the Free Software Foundation, Inc.,
76 # 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
77 #
78 # The full GNU General Public License is included in this distribution in
79 # the file called "COPYING".
80 #
81 # Contact Information:
82 # Linux NICS <linux.nics@intel.com>
83 # e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
84 # Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
85 #
86 ################################################################################