WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [patch] conditionalize building ACPI (was [RFC] build config

To: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: [Xen-devel] [patch] conditionalize building ACPI (was [RFC] build configuration)
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Fri, 17 Mar 2006 19:32:25 -0600
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sat, 18 Mar 2006 01:33:59 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <3acdd7e6fa85e5e5173e0552bce53844@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: IBM Linux Technology Center
References: <200603151128.09354.hollisb@xxxxxxxxxx> <200603151201.42506.hollisb@xxxxxxxxxx> <3acdd7e6fa85e5e5173e0552bce53844@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.8.3
On Wednesday 15 March 2006 12:18, Keir Fraser wrote:
> Well, let's start by fixing your current need, which is for the 
> non-optional config parameters, and see how that pans out. Some general 
> cleaning up of the build system would be good and can probably be done 
> by a set of consecutive patches rather than a 'big bang' approach.

This patch fixes part of my current need: PPC doesn't want to build ACPI. Two 
basic problems: one was xen/drivers/Makefile; the other was ALL_OBJS in 
xen/Rules.mk.

While I was setting up ALL_OBJS-y for ACPI, I went ahead and converted the 
other users, and did the same for CFLAGS (though I really didn't have to). 
Note that this patch slightly changes the old behavior of "debug" and 
"verbose" in CFLAGS: before, if debug=y, verbose=y was set for you. Now you 
only get what you explicitly enable. Also, perf_array can be used outside of 
perfc. I don't consider either of these changes to be problematic, since 
whoever is building is already changing the config options.

Long-term, I think the following are goals to work towards:
- Every Makefile should deal only with objects in its own directory and below. 
ALL_OBJS currently violates this principle: arch/*/Makefile reaches up and 
does the final link with objects all over the tree. Instead, we can have each 
arch tell the toplevel Makefile (via arch/*/Rules.mk) how to produce the 
final image.
- Don't require explicit includes in each Makefile (see drivers/Makefile 
below). This is possible but takes some thinking; in particular, you wouldn't 
recurse into subdirectories, but rather re-invoke make at the top level with 
a different directory name as an argument. This is just a convenience thing, 
so not a high priority.
- The new drivers/Makefile below does the nice make thing that handles errors 
and parallel builds properly. This should be expanded to include all other 
Makefiles (e.g. the "clean" and "$(TARGET)" targets in xen/Makefile).
- Object files should be handled in the same way (e.g. OBJ-y). First they'll 
need to be explicitly listed, as you noted.

I did investigate a few of these, but since I don't really need them, I 
started with this patch only. If this works for you, please apply.

-- 
Hollis Blanchard
IBM Linux Technology Center


Conditionalize building the Xen ACPI driver.
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>

diff -r df0ad1c46f10 xen/Rules.mk
--- a/xen/Rules.mk      Thu Mar  9 16:03:23 2006 +0100
+++ b/xen/Rules.mk      Fri Mar 17 19:05:32 2006 -0600
@@ -33,39 +33,30 @@ OBJS    := $(patsubst %.S,%.o,$(S_SRCS))
 OBJS    := $(patsubst %.S,%.o,$(S_SRCS))
 OBJS    += $(patsubst %.c,%.o,$(C_SRCS))
 
-# Note that link order matters!
-ALL_OBJS := $(BASEDIR)/common/common.o
-ALL_OBJS += $(BASEDIR)/drivers/char/driver.o
-ALL_OBJS += $(BASEDIR)/drivers/acpi/driver.o
-ifeq ($(ACM_SECURITY),y)
-ALL_OBJS += $(BASEDIR)/acm/acm.o
-CFLAGS += -DACM_SECURITY
-endif
-ALL_OBJS += $(BASEDIR)/arch/$(TARGET_ARCH)/arch.o
-
 include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
 
-CFLAGS += -g -D__XEN__
+# Note that link order matters!
+ALL_OBJS-y := $(BASEDIR)/common/common.o
+ALL_OBJS-y += $(BASEDIR)/drivers/char/driver.o
+ALL_OBJS-$(HAS_ACPI) += $(BASEDIR)/drivers/acpi/driver.o
+ALL_OBJS-$(ACM_SECURITY) += $(BASEDIR)/acm/acm.o
+ALL_OBJS-y += $(BASEDIR)/arch/$(TARGET_ARCH)/arch.o
+ALL_OBJS := $(ALL_OBJS-y)
 
-ifneq ($(debug),y)
-CFLAGS += -DNDEBUG
-ifeq ($(verbose),y)
-CFLAGS += -DVERBOSE
-endif
-else
-CFLAGS += -DVERBOSE
-endif
+flip_y := n
+flip_n := y
+flip_ := y
+flipyn = $(flip_$(1))
 
-ifeq ($(crash_debug),y)
-CFLAGS += -DCRASH_DEBUG
-endif
-
-ifeq ($(perfc),y)
-CFLAGS += -DPERF_COUNTERS
-ifeq ($(perfc_arrays),y)
-CFLAGS += -DPERF_ARRAYS
-endif
-endif
+__CFLAGS := $(CFLAGS)
+CFLAGS-y += -g -D__XEN__
+CFLAGS-$(call flipyn,$(debug)) += -DNDEBUG
+CFLAGS-$(ACM_SECURITY) += -DACM_SECURITY
+CFLAGS-$(verbose) += -DVERBOSE
+CFLAGS-$(crash_debug) += -DCRASH_DEBUG
+CFLAGS-$(perfc) += -DPERF_COUNTERS
+CFLAGS-$(perfc_arrays) += -DPERF_ARRAYS
+CFLAGS := $(__CFLAGS) $(CFLAGS-y)
 
 CFLAGS := $(strip $(CFLAGS))
 
diff -r df0ad1c46f10 xen/arch/ia64/Rules.mk
--- a/xen/arch/ia64/Rules.mk    Thu Mar  9 16:03:23 2006 +0100
+++ b/xen/arch/ia64/Rules.mk    Fri Mar 17 19:05:32 2006 -0600
@@ -1,6 +1,7 @@
 ########################################
 # ia64-specific definitions
 
+HAS_ACPI := y
 VALIDATE_VT    ?= n
 ifneq ($(COMPILE_ARCH),$(TARGET_ARCH))
 CROSS_COMPILE ?= /usr/local/sp_env/v2.2.5/i686/bin/ia64-unknown-linux-
diff -r df0ad1c46f10 xen/arch/x86/Rules.mk
--- a/xen/arch/x86/Rules.mk     Thu Mar  9 16:03:23 2006 +0100
+++ b/xen/arch/x86/Rules.mk     Fri Mar 17 19:05:32 2006 -0600
@@ -1,5 +1,7 @@
 ########################################
 # x86-specific definitions
+
+HAS_ACPI := y
 
 #
 # If you change any of these configuration options then you must
diff -r df0ad1c46f10 xen/drivers/Makefile
--- a/xen/drivers/Makefile      Thu Mar  9 16:03:23 2006 +0100
+++ b/xen/drivers/Makefile      Fri Mar 17 19:05:32 2006 -0600
@@ -1,8 +1,6 @@
+include $(BASEDIR)/Rules.mk
 
-default:
-       $(MAKE) -C char
-       $(MAKE) -C acpi
+subdirs-y := char/
+subdirs-$(HAS_ACPI) += acpi/
 
-clean:
-       $(MAKE) -C char clean
-       $(MAKE) -C acpi clean
+include $(BASEDIR)/Post.mk
diff -r df0ad1c46f10 xen/Post.mk
--- /dev/null   Thu Jan  1 00:00:00 1970 +0000
+++ b/xen/Post.mk       Fri Mar 17 19:05:32 2006 -0600
@@ -0,0 +1,15 @@
+
+subdirs-all := $(subdirs-y) $(subdirs-n)
+
+default: $(subdirs-y)
+
+.PHONY: FORCE
+FORCE:
+
+%/: FORCE
+       $(MAKE) -C $*
+
+clean: $(addprefix _clean_, $(subdirs-all))
+_clean_%/: FORCE
+       $(MAKE) -C $* clean
+

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>