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