build: Make PREFIX work by fixing LIBDIR
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 31 Jan 2008 09:38:34 +0000 (09:38 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 31 Jan 2008 09:38:34 +0000 (09:38 +0000)
In the current tree, setting PREFIX does not work very well.  This is
because of confusion about the meaning of LIBDIR.  In some places it
is the pathname tail of directories containing libraries (lib, lib64
or lib/amd64).  But in other places it is a destination pathname
(implicitly, including any PREFIX).  This can result in PREFIX or /usr
being added the wrong number of times.

This patch splits LIBDIR into two variables, LIBLEAFDIR and
LIBDIR.  LIBDIR is the directory into which Xen libraries and other
similar code is to be placed, and includes any PREFIX.  LIBLEAFDIR is
just the library tail and can be appended to various different
prefixes; for example, to construct the X11 library directory for -L.

Neither variable contains the value of DESTDIR, which is of course
used only to redirect the results of `make install' when desired.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Config.mk
config/StdGNU.mk
config/SunOS.mk
config/x86_64.mk
tools/Rules.mk

index f9cb75fbf008e10951f9f439af5548ef21236f1f..5715debf9b8b8d1e18c48ba1905bd65d65fe97cb 100644 (file)
--- a/Config.mk
+++ b/Config.mk
@@ -30,7 +30,7 @@ include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
 
 ifneq ($(EXTRA_PREFIX),)
 EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
-EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBDIR)
+EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
 endif
 
 # cc-option: Check if compiler supports first option, else fall back to second.
index ed383cf25db2103465ff201d10be7c23f7af318a..a26ce17c841a94745212c6c6b5f2d1e8f1d8aaa3 100644 (file)
@@ -20,8 +20,10 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
 PREFIX ?= /usr
 BINDIR = $(PREFIX)/bin
 INCLUDEDIR = $(PREFIX)/include
-LIBDIR = $(PREFIX)/lib
-LIBDIR_x86_64 = $(PREFIX)/lib64
+LIBLEAFDIR = lib
+LIBLEAFDIR_x86_64 = lib64
+LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
+LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
 MANDIR = $(PREFIX)/share/man
 MAN1DIR = $(MANDIR)/man1
 MAN8DIR = $(MANDIR)/man8
index 16163b682073440c1badaa31c733e492e2dc2bbc..d5eba747bf0e6418dec6d64338bcd7b8e6448864 100644 (file)
@@ -21,8 +21,10 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
 PREFIX ?= /usr
 BINDIR = $(PREFIX)/bin
 INCLUDEDIR = $(PREFIX)/include
-LIBDIR = $(PREFIX)/lib
-LIBDIR_x86_64 = $(PREFIX)/lib/amd64
+LIBLEAFDIR = lib
+LIBLEAFDIR_x86_64 = lib/amd64
+LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
+LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
 MANDIR = $(PREFIX)/share/man
 MAN1DIR = $(MANDIR)/man1
 MAN8DIR = $(MANDIR)/man8
index 64291837a4986e0ccc1f0ef83398b012a7ab7701..6f77053df3c329aa74877aa75ff60d5b801215f5 100644 (file)
@@ -10,6 +10,7 @@ CONFIG_IOEMU := y
 
 CFLAGS += -m64
 
+LIBLEAFDIR = $(LIBLEAFDIR_x86_64)
 LIBDIR = $(LIBDIR_x86_64)
 
 SunOS_LIBDIR = $(SunOS_LIBDIR_x86_64)
index 1b16c9230ccadc6f8bca6c9dd833ec63ce94fc15..ceb616981ef4ba9b689f0ec7d8cc23e4454892f3 100644 (file)
@@ -22,7 +22,7 @@ LDFLAGS_libxenguest = -L$(XEN_LIBXC) -lxenguest
 CFLAGS_libxenstore = -I$(XEN_XENSTORE) $(CFLAGS_include)
 LDFLAGS_libxenstore = -L$(XEN_XENSTORE) -lxenstore
 
-X11_LDPATH = -L/usr/X11R6/$(LIBDIR)
+X11_LDPATH = -L/usr/X11R6/$(LIBLEAFDIR)
 
 CFLAGS += -D__XEN_TOOLS__