On Thu, Apr 06, 2006 at 07:52:32AM +0100, Keir Fraser wrote:
>
> On 6 Apr 2006, at 06:54, Muli Ben-Yehuda wrote:
>
> >> X11_LDPATH = -L/usr/X11R6/$(LIBDIR)
> >>+
> >>+CFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030101
> >
> >This is now another place you have to remember to change the version
> >string. Can we stick it in its own file with nothing else and have
> >other users include it?
>
> Where would you place it such that it's guaranteed to be included
> everywhere?
How about something like the attached?
- define XEN_LATEST_INTERFACE_VERSION in Config.mk
- for the tools, it's included from tools/Makefile directly
- for the Xen and kernel builds, generate public/interface.h with it
and include that.
- this has one drawback - the public/ headers aren't self contained
any more, since interface.h needs to be generated before it's
used. The only case is this bits us is if someone copies
include/public.h and tries to use that out of the tree, which doesn't
seem like a very likely occurance.
Comments?
diff -r ece9b5710b29 Config.mk
--- a/Config.mk Thu Apr 06 00:59:18 2006 +0100
+++ b/Config.mk Thu Apr 06 12:02:56 2006 +0300
@@ -1,4 +1,6 @@
# -*- mode: Makefile; -*-
+
+export XEN_LATEST_INTERFACE_VERSION = 0x00030101
# A debug build of Xen and tools?
debug ?= n
diff -r ece9b5710b29 Makefile
--- a/Makefile Thu Apr 06 00:59:18 2006 +0100
+++ b/Makefile Thu Apr 06 12:02:56 2006 +0300
@@ -69,6 +69,7 @@ install-tools:
$(MAKE) -C tools install
install-kernels:
+ make -C xen include/public/interface.h
for i in $(XKERNELS) ; do $(MAKE) $$i-install || exit 1; done
install-docs:
diff -r ece9b5710b29 tools/Rules.mk
--- a/tools/Rules.mk Thu Apr 06 00:59:18 2006 +0100
+++ b/tools/Rules.mk Thu Apr 06 12:02:56 2006 +0300
@@ -12,7 +12,7 @@ XEN_LIBXENSTAT = $(XEN_ROOT)/tools/x
X11_LDPATH = -L/usr/X11R6/$(LIBDIR)
-CFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030101
+CFLAGS += -D__XEN_INTERFACE_VERSION__=$(XEN_LATEST_INTERFACE_VERSION)
%.opic: %.c
$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
diff -r ece9b5710b29 xen/Makefile
--- a/xen/Makefile Thu Apr 06 00:59:18 2006 +0100
+++ b/xen/Makefile Thu Apr 06 12:02:56 2006 +0300
@@ -54,7 +54,7 @@ debug: FORCE
$(TARGET): delete-unfresh-files
$(MAKE) -C tools
- $(MAKE) -f $(BASEDIR)/Rules.mk include/xen/compile.h
+ $(MAKE) -f $(BASEDIR)/Rules.mk include/xen/compile.h
include/public/interface.h
$(MAKE) -f $(BASEDIR)/Rules.mk include/xen/acm_policy.h
[ -e include/asm ] || ln -sf asm-$(TARGET_ARCH) include/asm
$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) asm-offsets.s
@@ -66,6 +66,9 @@ delete-unfresh-files:
delete-unfresh-files:
@if [ ! -r include/xen/compile.h -o -O include/xen/compile.h ]; then \
rm -f include/xen/{banner,compile}.h; \
+ fi
+ @if [ ! -r include/public/interface.h -o -O include/public/interface.h
]; then \
+ rm -f include/public/interface.h; \
fi
# acm_policy.h contains security policy for Xen
@@ -103,6 +106,13 @@ include/xen/banner.h:
tools/figlet/figlet -d tools/figlet Xen $(XEN_FULLVERSION) > $@.new
@mv -f $@.new $@
+# interface.h contains our interface version information. Rebuilt on every
'make' invocation.
+include/public/interface.h: LANG=C
+include/public/interface.h: include/public/interface.h.in
+ @sed -e
's/@@xenlatestinterfaceversion@@/$(XEN_LATEST_INTERFACE_VERSION)/g' \
+ < include/public/interface.h.in > $@.new
+ @mv -f $@.new $@
+
include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s
@(set -e; \
echo "/*"; \
diff -r ece9b5710b29 xen/include/public/xen-compat.h
--- a/xen/include/public/xen-compat.h Thu Apr 06 00:59:18 2006 +0100
+++ b/xen/include/public/xen-compat.h Thu Apr 06 12:02:56 2006 +0300
@@ -9,7 +9,7 @@
#ifndef __XEN_PUBLIC_XEN_COMPAT_H__
#define __XEN_PUBLIC_XEN_COMPAT_H__
-#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030101
+#include "interface.h"
#if defined(__XEN__)
/* Xen is built with matching headers and implements the latest interface. */
diff -r ece9b5710b29 xen/include/public/interface.h.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/public/interface.h.in Thu Apr 06 12:02:56 2006 +0300
@@ -0,0 +1,1 @@
+#define __XEN_LATEST_INTERFACE_VERSION__ @@xenlatestinterfaceversion@@
--
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|