Index: xen-3.1-testing/Config.mk
===================================================================
--- xen-3.1-testing.orig/Config.mk
+++ xen-3.1-testing/Config.mk
@@ -18,7 +18,7 @@ SHELL     ?= /bin/sh
 
 # Tools to run on system hosting the build
 HOSTCC     = gcc
-HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
+HOSTCFLAGS:= -Wall -Werror -Wstrict-prototypes $(RPM_OPT_FLAGS)
 
 DISTDIR     ?= $(XEN_ROOT)/dist
 DESTDIR     ?= /
Index: xen-3.1-testing/tools/libxen/Makefile
===================================================================
--- xen-3.1-testing.orig/tools/libxen/Makefile
+++ xen-3.1-testing/tools/libxen/Makefile
@@ -21,10 +21,10 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR = 1.0
 MINOR = 0
 
-CFLAGS = -Iinclude                     \
+CFLAGS += -Iinclude                    \
          $(shell xml2-config --cflags) \
          $(shell curl-config --cflags) \
-         -W -Wall -Wmissing-prototypes -Werror -std=c99 -O2 -fPIC
+         -std=c99 -fPIC
 
 LDFLAGS = $(shell xml2-config --libs) \
           $(shell curl-config --libs)