Add build number to datapath version and --version output from programs.
[sliver-openvswitch.git] / datapath / linux-2.4 / Kbuild.in
1 # -*- makefile -*-
2 builddir = @abs_builddir@
3 srcdir = @abs_srcdir@
4 top_srcdir = @abs_top_srcdir@
5 KSRC = @KSRC24@
6 VERSION = @VERSION@
7 BUILDNR = @BUILDNR@
8
9 # File Lists
10 include $(srcdir)/../Modules.mk
11 include $(srcdir)/Modules.mk
12 include @HW_TABLES@
13
14 # This is somewhat hacky. We want to include our compatibility headers before
15 # any header files in the kernel by the same name. Unfortunately, the only
16 # mechanism the kernel provides to add cflags is the EXTRA_CFLAGS variable,
17 # which gets inserted into the build command after the internal kernel CFLAGS.
18 # Since our stuff needs to come first, we override the variable.
19 OF_CFLAGS = -I$(srcdir)/compat-2.4/include \
20             -I$(srcdir)/compat-2.4/include-$(ARCH) \
21             -I$(srcdir)/compat-2.4 -I$(srcdir)/.. \
22             -I$(srcdir)/../../include \
23             -I$(builddir)/.. $(CFLAGS) \
24             -DVERSION=\"$(VERSION)\"
25 ifeq '$(BUILDNR)' '0'
26 OF_CFLAGS += -DBUILDNR=\"\"
27 else
28 OF_CFLAGS += -DBUILDNR=\"+build$(BUILDNR)\"
29 endif
30 override CFLAGS := $(OF_CFLAGS)
31
32 # Multipart objects
33 list-multi := $(patsubst %,%_mod.o,$(all_modules))
34
35 # Module objects that we can build
36 obj-m += $(list-multi)
37
38 # Object Parts
39 define parts_template
40 $(1)_mod-objs = $$(patsubst %.c,%.o,$(notdir $($(1)_sources)))
41 endef
42 $(foreach module,$(all_modules),$(eval $(call parts_template,$(module))))
43
44 # Objects that export symbols
45 export-objs = $(all_objects)
46
47 # Include the kernel's global Rules.make
48 include $(TOPDIR)/Rules.make
49
50 # Link rules for multi-part objects
51 define link_template
52 $(1)_mod.o: $($(1)_mod-objs)
53         $(LD) -r -o $$@ $($(1)_mod-objs)
54 endef
55 $(foreach module,$(all_modules),$(eval $(call link_template,$(module))))
56
57 # Build system rewrite May 2008: Bobby Holley <bh10@stanford.edu>
58 #
59 # A few bits and pieces of this file might be derived from Intel's e1000
60 # distribution, with the following license:
61
62 ################################################################################
63 #
64 # Intel PRO/1000 Linux driver
65 # Copyright(c) 1999 - 2007 Intel Corporation.
66 #
67 # This program is free software; you can redistribute it and/or modify it
68 # under the terms and conditions of the GNU General Public License,
69 # version 2, as published by the Free Software Foundation.
70 #
71 # This program is distributed in the hope it will be useful, but WITHOUT
72 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
73 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
74 # more details.
75 #
76 # You should have received a copy of the GNU General Public License along with
77 # this program; if not, write to the Free Software Foundation, Inc.,
78 # 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
79 #
80 # The full GNU General Public License is included in this distribution in
81 # the file called "COPYING".
82 #
83 # Contact Information:
84 # Linux NICS <linux.nics@intel.com>
85 # e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
86 # Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
87 #
88 ################################################################################