debuggers.hg

view tools/Rules.mk @ 16988:0faf620bc749

build: Make PREFIX work by fixing LIBDIR

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>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jan 31 09:38:34 2008 +0000 (2008-01-31)
parents 47b8ab314cb6
children 5b4dad214f91
line source
1 # -*- mode: Makefile; -*-
3 # `all' is the default target
4 all:
6 include $(XEN_ROOT)/Config.mk
8 XEN_INCLUDE = $(XEN_ROOT)/tools/include
9 XEN_XC = $(XEN_ROOT)/tools/python/xen/lowlevel/xc
10 XEN_LIBXC = $(XEN_ROOT)/tools/libxc
11 XEN_XENSTORE = $(XEN_ROOT)/tools/xenstore
12 XEN_LIBXENSTAT = $(XEN_ROOT)/tools/xenstat/libxenstat/src
14 CFLAGS_include = -I$(XEN_INCLUDE)
16 CFLAGS_libxenctrl = -I$(XEN_LIBXC) $(CFLAGS_include)
17 LDFLAGS_libxenctrl = -L$(XEN_LIBXC) -lxenctrl
19 CFLAGS_libxenguest = -I$(XEN_LIBXC) $(CFLAGS_include)
20 LDFLAGS_libxenguest = -L$(XEN_LIBXC) -lxenguest
22 CFLAGS_libxenstore = -I$(XEN_XENSTORE) $(CFLAGS_include)
23 LDFLAGS_libxenstore = -L$(XEN_XENSTORE) -lxenstore
25 X11_LDPATH = -L/usr/X11R6/$(LIBLEAFDIR)
27 CFLAGS += -D__XEN_TOOLS__
29 # Enable implicit LFS support *and* explicit LFS names.
30 CFLAGS += $(shell getconf LFS_CFLAGS)
31 CFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
32 LDFLAGS += $(shell getconf LFS_LDFLAGS)
34 # 32-bit x86 does not perform well with -ve segment accesses on Xen.
35 CFLAGS-$(CONFIG_X86_32) += $(call cc-option,$(CC),-mno-tls-direct-seg-refs)
36 CFLAGS += $(CFLAGS-y)
38 # Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers)
39 check-$(CONFIG_X86) = $(call cc-ver-check,CC,0x030400,\
40 "Xen requires at least gcc-3.4")
41 $(eval $(check-y))
43 %.opic: %.c
44 $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
46 %.o: %.c
47 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
49 %.o: %.cc
50 $(CC) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<