debuggers.hg

changeset 22018:d3de6f484610

split LDLIBS from LDFLAGS to fix link errors in recent toolchains

Linker command lines are order-sensitive.
Move linker options -Lfoo -lfoo from LDFLAGS to LDLIBS and place this new
variable after the objects to link. This resolves build errors in xenpagin
and blktap with recent toolchains.

rename SHLIB_CFLAGS to SHLIB_LDFLAGS
rename LDFLAGS_* to LDLIBS_*
move LDFLAGS usage after CFLAGS in CC calls
remove stale comments in xenpaging Makefile

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Stefano Stabellini <sstabellini@xensource.com>
date Wed Aug 11 18:02:32 2010 +0100 (2010-08-11)
parents 6f059a340cdf
children 8bb9cfaca402 fbe6ef286e3f
files config/StdGNU.mk config/SunOS.mk tools/Rules.mk tools/blktap/drivers/Makefile tools/blktap/lib/Makefile tools/blktap2/Makefile tools/blktap2/drivers/Makefile tools/blktap2/vhd/Makefile tools/blktap2/vhd/lib/Makefile tools/console/Makefile tools/debugger/xenitp/Makefile tools/flask/libflask/Makefile tools/flask/utils/Makefile tools/fs-back/Makefile tools/libfsimage/Rules.mk tools/libfsimage/common/Makefile tools/libxc/Makefile tools/libxen/Makefile tools/libxen/Makefile.dist tools/libxl/Makefile tools/misc/Makefile tools/security/Makefile tools/vnet/libxutil/Makefile tools/xcutils/Makefile tools/xenbackendd/Makefile tools/xenmon/Makefile tools/xenpaging/Makefile tools/xenpmd/Makefile tools/xenstat/libxenstat/Makefile tools/xenstore/Makefile tools/xentrace/Makefile
line diff
     1.1 --- a/config/StdGNU.mk	Wed Aug 11 15:56:21 2010 +0100
     1.2 +++ b/config/StdGNU.mk	Wed Aug 11 18:02:32 2010 +0100
     1.3 @@ -59,7 +59,7 @@ CURSES_LIBS = -lncurses
     1.4  PTHREAD_LIBS = -lpthread
     1.5  UTIL_LIBS = -lutil
     1.6  SONAME_LDFLAG = -soname
     1.7 -SHLIB_CFLAGS = -shared
     1.8 +SHLIB_LDFLAGS = -shared
     1.9  
    1.10  ifneq ($(debug),y)
    1.11  CFLAGS += -O2 -fomit-frame-pointer
     2.1 --- a/config/SunOS.mk	Wed Aug 11 15:56:21 2010 +0100
     2.2 +++ b/config/SunOS.mk	Wed Aug 11 18:02:32 2010 +0100
     2.3 @@ -51,7 +51,7 @@ CURSES_LIBS = -lcurses
     2.4  PTHREAD_LIBS = -lpthread
     2.5  UTIL_LIBS =
     2.6  SONAME_LDFLAG = -h
     2.7 -SHLIB_CFLAGS = -R $(SunOS_LIBDIR) -shared
     2.8 +SHLIB_LDFLAGS = -R $(SunOS_LIBDIR) -shared
     2.9  
    2.10  ifneq ($(debug),y)
    2.11  CFLAGS += -O2 -fno-omit-frame-pointer
     3.1 --- a/tools/Rules.mk	Wed Aug 11 15:56:21 2010 +0100
     3.2 +++ b/tools/Rules.mk	Wed Aug 11 18:02:32 2010 +0100
     3.3 @@ -18,16 +18,16 @@ XEN_BLKTAP2        = $(XEN_ROOT)/tools/b
     3.4  CFLAGS_include = -I$(XEN_INCLUDE)
     3.5  
     3.6  CFLAGS_libxenctrl = -I$(XEN_LIBXC) $(CFLAGS_include)
     3.7 -LDFLAGS_libxenctrl = -L$(XEN_LIBXC) -lxenctrl
     3.8 +LDLIBS_libxenctrl = -L$(XEN_LIBXC) -lxenctrl
     3.9  
    3.10  CFLAGS_libxenguest = -I$(XEN_LIBXC) $(CFLAGS_include)
    3.11 -LDFLAGS_libxenguest = -L$(XEN_LIBXC) -lxenguest
    3.12 +LDLIBS_libxenguest = -L$(XEN_LIBXC) -lxenguest
    3.13  
    3.14  CFLAGS_libxenstore = -I$(XEN_XENSTORE) $(CFLAGS_include)
    3.15 -LDFLAGS_libxenstore = -L$(XEN_XENSTORE) -lxenstore
    3.16 +LDLIBS_libxenstore = -L$(XEN_XENSTORE) -lxenstore
    3.17  
    3.18  CFLAGS_libblktapctl = -I$(XEN_BLKTAP2)/control -I$(XEN_BLKTAP2)/include $(CFLAGS_include)
    3.19 -LDFLAGS_libblktapctl = -L$(XEN_BLKTAP2)/control -lblktapctl
    3.20 +LDLIBS_libblktapctl = -L$(XEN_BLKTAP2)/control -lblktapctl
    3.21  
    3.22  X11_LDPATH = -L/usr/X11R6/$(LIBLEAFDIR)
    3.23  
     4.1 --- a/tools/blktap/drivers/Makefile	Wed Aug 11 15:56:21 2010 +0100
     4.2 +++ b/tools/blktap/drivers/Makefile	Wed Aug 11 18:02:32 2010 +0100
     4.3 @@ -29,8 +29,8 @@ CFLAGS += -DMEMSHR
     4.4  MEMSHRLIBS += $(MEMSHR_DIR)/libmemshr.a
     4.5  endif
     4.6  
     4.7 -LDFLAGS_blktapctrl := $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore) $(MEMSHRLIBS) -L../lib -lblktap -lrt -lm -lpthread
     4.8 -LDFLAGS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) -lpthread -lz
     4.9 +LDLIBS_blktapctrl := $(MEMSHRLIBS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -L../lib -lblktap -lrt -lm -lpthread
    4.10 +LDLIBS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) -lpthread -lz
    4.11  
    4.12  BLK-OBJS-y  := block-aio.o
    4.13  BLK-OBJS-y  += block-sync.o
    4.14 @@ -48,16 +48,16 @@ BLKTAB-OBJS-$(CONFIG_Linux) += blktapctr
    4.15  all: $(IBIN) qcow-util
    4.16  
    4.17  blktapctrl: $(BLKTAB-OBJS-y)
    4.18 -	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDFLAGS_blktapctrl)
    4.19 +	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_blktapctrl)
    4.20  
    4.21  tapdisk: tapdisk.o $(BLK-OBJS-y)
    4.22 -	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDFLAGS_img)
    4.23 +	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_img)
    4.24  
    4.25  .PHONY: qcow-util
    4.26  qcow-util: img2qcow qcow2raw qcow-create
    4.27  
    4.28  img2qcow qcow2raw qcow-create: %: %.o $(BLK-OBJS-y)
    4.29 -	$(CC) $(CFLAGS) -o $* $^ $(LDFLAGS) $(LDFLAGS_img)
    4.30 +	$(CC) $(CFLAGS) $(LDFLAGS) -o $* $^ $(LDLIBS_img)
    4.31  
    4.32  install: all
    4.33  	$(INSTALL_PROG) $(IBIN) $(QCOW_UTIL) $(VHD_UTIL) $(DESTDIR)$(SBINDIR)
     5.1 --- a/tools/blktap/lib/Makefile	Wed Aug 11 15:56:21 2010 +0100
     5.2 +++ b/tools/blktap/lib/Makefile	Wed Aug 11 18:02:32 2010 +0100
     5.3 @@ -8,7 +8,7 @@ SONAME   = libblktap.so.$(MAJOR)
     5.4  CFLAGS   += -I.
     5.5  CFLAGS   += $(CFLAGS_libxenctrl)
     5.6  CFLAGS   += $(CFLAGS_libxenstore)
     5.7 -LDFLAGS  += $(LDFLAGS_libxenstore)
     5.8 +LDLIBS   += $(LDLIBS_libxenstore)
     5.9  
    5.10  SRCS     :=
    5.11  SRCS     += xenbus.c blkif.c xs_api.c
    5.12 @@ -46,8 +46,8 @@ clean:
    5.13  	rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen TAGS
    5.14  
    5.15  libblktap.so.$(MAJOR).$(MINOR): $(OBJS_PIC) 
    5.16 -	$(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,$(SONAME) $(SHLIB_CFLAGS) \
    5.17 -	      $(LDFLAGS) -o $@ $^
    5.18 +	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,$(SONAME) $(SHLIB_LDFLAGS) \
    5.19 +	      -o $@ $^ $(LDLIBS)
    5.20  	ln -sf libblktap.so.$(MAJOR).$(MINOR) libblktap.so.$(MAJOR)
    5.21  	ln -sf libblktap.so.$(MAJOR) libblktap.so
    5.22  
     6.1 --- a/tools/blktap2/Makefile	Wed Aug 11 15:56:21 2010 +0100
     6.2 +++ b/tools/blktap2/Makefile	Wed Aug 11 18:02:32 2010 +0100
     6.3 @@ -2,7 +2,7 @@ XEN_ROOT = ../..
     6.4  include $(XEN_ROOT)/tools/Rules.mk
     6.5  
     6.6  CFLAGS  += $(CFLAGS_libxenctrl)
     6.7 -LDFLAGS += $(LDFLAGS_libxenctrl)
     6.8 +LDLIBS += $(LDLIBS_libxenctrl)
     6.9  
    6.10  SUBDIRS-y :=
    6.11  SUBDIRS-y += include
     7.1 --- a/tools/blktap2/drivers/Makefile	Wed Aug 11 15:56:21 2010 +0100
     7.2 +++ b/tools/blktap2/drivers/Makefile	Wed Aug 11 18:02:32 2010 +0100
     7.3 @@ -25,7 +25,7 @@ endif
     7.4  
     7.5  LIBS      += -lrt -lz
     7.6  
     7.7 -LDFLAGS_img := $(LDFLAGS_libxenctrl) $(CRYPT_LIB) -lpthread -lz -lm
     7.8 +LBLIBS_img := $(LDLIBS_libxenctrl) $(CRYPT_LIB) -lpthread -lz -lm
     7.9  
    7.10  LIBS += -L$(LIBVHDDIR) -lvhd
    7.11  
    7.12 @@ -93,16 +93,16 @@ all: $(IBIN) lock-util qcow-util
    7.13  
    7.14  
    7.15  tapdisk2: $(TAP-OBJS-y) $(BLK-OBJS-y) $(MISC-OBJS-y) tapdisk2.c
    7.16 -	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(MEMSHRLIBS) $(LDFLAGS_img)
    7.17 +	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(MEMSHRLIBS) $(LBLIBS_img)
    7.18  
    7.19  tapdisk-client: tapdisk-client.o
    7.20 -	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)  $(LDFLAGS_img)
    7.21 +	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)  $(LBLIBS_img)
    7.22  
    7.23  tapdisk-stream tapdisk-diff: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y)
    7.24 -	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(MEMSHRLIBS) $(LDFLAGS_img)
    7.25 +	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(MEMSHRLIBS) $(LBLIBS_img)
    7.26  
    7.27  td-util: td.o tapdisk-utils.o tapdisk-log.o $(PORTABLE-OBJS-y)
    7.28 -	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)  $(LDFLAGS_img)
    7.29 +	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)  $(LBLIBS_img)
    7.30  
    7.31  lock-util: lock.c
    7.32  	$(CC) $(CFLAGS) -DUTIL -o lock-util lock.c $(LDFLAGS) $(LIBS)
    7.33 @@ -111,7 +111,7 @@ lock-util: lock.c
    7.34  qcow-util: img2qcow qcow2raw qcow-create
    7.35  
    7.36  img2qcow qcow2raw qcow-create: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y)
    7.37 -	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(MEMSHRLIBS) $(LDFLAGS_img)
    7.38 +	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(MEMSHRLIBS) $(LBLIBS_img)
    7.39  
    7.40  install: all
    7.41  	$(INSTALL_DIR) -p $(DESTDIR)$(INST_DIR)
     8.1 --- a/tools/blktap2/vhd/Makefile	Wed Aug 11 15:56:21 2010 +0100
     8.2 +++ b/tools/blktap2/vhd/Makefile	Wed Aug 11 18:02:32 2010 +0100
     8.3 @@ -38,10 +38,10 @@ LIBS_DEPENDS	  := lib/libvhd.so lib/vhd.
     8.4  $(LIBS_DEPENDS):subdirs-all
     8.5  
     8.6  vhd-util: vhd-util.o $(LIBS_DEPENDS)
     8.7 -	$(CC) $(CFLAGS) -o vhd-util vhd-util.o $(LDFLAGS) $(LIBS)
     8.8 +	$(CC) $(CFLAGS) $(LDFLAGS) -o vhd-util vhd-util.o $(LIBS)
     8.9  
    8.10  vhd-update: vhd-update.o $(LIBS_DEPENDS)
    8.11 -	$(CC) $(CFLAGS) -o vhd-update vhd-update.o $(LDFLAGS) $(LIBS)
    8.12 +	$(CC) $(CFLAGS) $(LDFLAGS) -o vhd-update vhd-update.o $(LIBS)
    8.13  
    8.14  install: all
    8.15  	$(MAKE) subdirs-install
     9.1 --- a/tools/blktap2/vhd/lib/Makefile	Wed Aug 11 15:56:21 2010 +0100
     9.2 +++ b/tools/blktap2/vhd/lib/Makefile	Wed Aug 11 18:02:32 2010 +0100
     9.3 @@ -55,7 +55,7 @@ all: build
     9.4  build: $(LIBVHD-BUILD)
     9.5  
     9.6  libvhd.a: $(LIB-OBJS)
     9.7 -	$(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG),$(LIBVHD-SONAME) $(SHLIB_CFLAGS) \
     9.8 +	$(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG),$(LIBVHD-SONAME) $(SHLIB_LDFLAGS) \
     9.9  		$(LDFLAGS) -o libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $(LIBS) $^
    9.10  	ln -sf libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) libvhd.so.$(LIBVHD-MAJOR)
    9.11  	ln -sf libvhd.so.$(LIBVHD-MAJOR) libvhd.so
    10.1 --- a/tools/console/Makefile	Wed Aug 11 15:56:21 2010 +0100
    10.2 +++ b/tools/console/Makefile	Wed Aug 11 18:02:32 2010 +0100
    10.3 @@ -6,8 +6,11 @@ CFLAGS  += -Werror
    10.4  
    10.5  CFLAGS  += $(CFLAGS_libxenctrl)
    10.6  CFLAGS  += $(CFLAGS_libxenstore)
    10.7 -LDFLAGS += $(LDFLAGS_libxenctrl)
    10.8 -LDFLAGS += $(LDFLAGS_libxenstore)
    10.9 +LDLIBS += $(LDLIBS_libxenctrl)
   10.10 +LDLIBS += $(LDLIBS_libxenstore)
   10.11 +LDLIBS += $(UTIL_LIBS)
   10.12 +LDLIBS += $(SOCKET_LIBS)
   10.13 +LDLIBS += -lrt
   10.14  
   10.15  BIN      = xenconsoled xenconsole
   10.16  
   10.17 @@ -20,12 +23,10 @@ clean:
   10.18  	$(RM) client/*.o daemon/*.o
   10.19  
   10.20  xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c))
   10.21 -	$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) \
   10.22 -              $(UTIL_LIBS) $(SOCKET_LIBS) -lrt
   10.23 +	$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS)
   10.24  
   10.25  xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c))
   10.26 -	$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) \
   10.27 -	      $(UTIL_LIBS) $(SOCKET_LIBS)
   10.28 +	$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS)
   10.29  
   10.30  .PHONY: install
   10.31  install: $(BIN)
    11.1 --- a/tools/debugger/xenitp/Makefile	Wed Aug 11 15:56:21 2010 +0100
    11.2 +++ b/tools/debugger/xenitp/Makefile	Wed Aug 11 18:02:32 2010 +0100
    11.3 @@ -46,8 +46,8 @@ clean:
    11.4  	$(RM) *.a *.so *.o *.rpm $(BIN) $(LIBBIN)
    11.5  
    11.6  %: %.c $(HDRS) Makefile
    11.7 -	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS_libxenctrl)
    11.8 +	$(CC) $(CFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
    11.9  
   11.10  XENITP_OBJS=xenitp.o ia64-dis.o ia64-opc.o cpu-ia64-opc.o
   11.11  xenitp: $(XENITP_OBJS)
   11.12 -	$(CC) $(CFLAGS) -o $@ $(XENITP_OBJS) $(LDFLAGS_libxenctrl)
   11.13 +	$(CC) $(CFLAGS) -o $@ $(XENITP_OBJS) $(LDLIBS_libxenctrl)
    12.1 --- a/tools/flask/libflask/Makefile	Wed Aug 11 15:56:21 2010 +0100
    12.2 +++ b/tools/flask/libflask/Makefile	Wed Aug 11 18:02:32 2010 +0100
    12.3 @@ -59,6 +59,6 @@ libflask.so.$(MAJOR): libflask.so.$(MAJO
    12.4  	ln -sf $< $@
    12.5  
    12.6  libflask.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
    12.7 -	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libflask.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
    12.8 +	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libflask.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
    12.9  
   12.10  -include $(DEPS)
    13.1 --- a/tools/flask/utils/Makefile	Wed Aug 11 15:56:21 2010 +0100
    13.2 +++ b/tools/flask/utils/Makefile	Wed Aug 11 18:02:32 2010 +0100
    13.3 @@ -14,7 +14,7 @@ BASECFLAGS+= -I$(LIBFLASK_ROOT)/include
    13.4  BASECFLAGS+= -I.
    13.5  
    13.6  CFLAGS  += $(BASECFLAGS)
    13.7 -LDFLAGS += $(PROFILE) -L$(XEN_LIBXC) -L$(LIBFLASK_ROOT)
    13.8 +LDLIBS += $(PROFILE) -L$(XEN_LIBXC) -L$(LIBFLASK_ROOT)
    13.9  TESTDIR  = testsuite/tmp
   13.10  TESTFLAGS= -DTESTING
   13.11  TESTENV  = XENSTORED_ROOTDIR=$(TESTDIR) XENSTORED_RUNDIR=$(TESTDIR)
   13.12 @@ -27,7 +27,7 @@ CLIENTS_OBJS := $(patsubst flask-%,%.o,$
   13.13  all: $(CLIENTS)
   13.14  
   13.15  $(CLIENTS): flask-%: %.o
   13.16 -	$(CC) $(CFLAGS) $(LDFLAGS) $< $(LOADLIBES) $(LDLIBS) -L. -lflask $(LDFLAGS_libxenctrl) -o $@
   13.17 +	$(CC) $(CFLAGS) $(LDFLAGS) $< $(LOADLIBES) $(LDLIBS) -L. -lflask $(LDLIBS_libxenctrl) -o $@
   13.18  
   13.19  .PHONY: clean
   13.20  clean: 
    14.1 --- a/tools/fs-back/Makefile	Wed Aug 11 15:56:21 2010 +0100
    14.2 +++ b/tools/fs-back/Makefile	Wed Aug 11 18:02:32 2010 +0100
    14.3 @@ -14,8 +14,8 @@ CFLAGS   += $(INCLUDES) -I.
    14.4  CFLAGS   += -D_GNU_SOURCE
    14.5  
    14.6  LIBS      := -L. -L.. -L../lib
    14.7 -LIBS      += $(LDFLAGS_libxenctrl)
    14.8 -LIBS      += $(LDFLAGS_libxenstore)
    14.9 +LIBS      += $(LDLIBS_libxenctrl)
   14.10 +LIBS      += $(LDLIBS_libxenstore)
   14.11  LIBS      += -lrt -lpthread
   14.12  
   14.13  OBJS	  := fs-xenbus.o fs-ops.o
    15.1 --- a/tools/libfsimage/Rules.mk	Wed Aug 11 15:56:21 2010 +0100
    15.2 +++ b/tools/libfsimage/Rules.mk	Wed Aug 11 18:02:32 2010 +0100
    15.3 @@ -24,7 +24,7 @@ fs-install: fs-all
    15.4  	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)
    15.5  
    15.6  $(FSLIB): $(PIC_OBJS)
    15.7 -	$(CC) $(CFLAGS) $(LDFLAGS) $(SHLIB_CFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS)
    15.8 +	$(CC) $(CFLAGS) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS)
    15.9  
   15.10  clean distclean:
   15.11  	rm -f $(PIC_OBJS) $(FSLIB) $(DEPS)
    16.1 --- a/tools/libfsimage/common/Makefile	Wed Aug 11 15:56:21 2010 +0100
    16.2 +++ b/tools/libfsimage/common/Makefile	Wed Aug 11 18:02:32 2010 +0100
    16.3 @@ -37,7 +37,7 @@ libfsimage.so.$(MAJOR): libfsimage.so.$(
    16.4  	ln -sf $< $@
    16.5  
    16.6  libfsimage.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
    16.7 -	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libfsimage.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^ -lpthread
    16.8 +	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ -lpthread
    16.9  
   16.10  -include $(DEPS)
   16.11  
    17.1 --- a/tools/libxc/Makefile	Wed Aug 11 15:56:21 2010 +0100
    17.2 +++ b/tools/libxc/Makefile	Wed Aug 11 18:02:32 2010 +0100
    17.3 @@ -145,7 +145,7 @@ libxenctrl.so.$(MAJOR): libxenctrl.so.$(
    17.4  	ln -sf $< $@
    17.5  
    17.6  libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS)
    17.7 -	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^ $(PTHREAD_LIBS)
    17.8 +	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(PTHREAD_LIBS)
    17.9  
   17.10  # libxenguest
   17.11  
   17.12 @@ -181,7 +181,7 @@ xc_dom_bzimageloader.opic: CFLAGS += $(c
   17.13  
   17.14  libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(call zlib-options,l)
   17.15  libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so
   17.16 -	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz -lxenctrl $(PTHREAD_LIBS)
   17.17 +	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz -lxenctrl $(PTHREAD_LIBS)
   17.18  
   17.19  -include $(DEPS)
   17.20  
    18.1 --- a/tools/libxen/Makefile	Wed Aug 11 15:56:21 2010 +0100
    18.2 +++ b/tools/libxen/Makefile	Wed Aug 11 18:02:32 2010 +0100
    18.3 @@ -44,7 +44,7 @@ libxenapi.so.$(MAJOR): libxenapi.so.$(MA
    18.4  	ln -sf $< $@
    18.5  
    18.6  libxenapi.so.$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS)
    18.7 -	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
    18.8 +	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
    18.9  
   18.10  libxenapi.a: $(LIBXENAPI_OBJS)
   18.11  	$(AR) rcs libxenapi.a $^
    19.1 --- a/tools/libxen/Makefile.dist	Wed Aug 11 15:56:21 2010 +0100
    19.2 +++ b/tools/libxen/Makefile.dist	Wed Aug 11 18:02:32 2010 +0100
    19.3 @@ -30,7 +30,7 @@ LDFLAGS = $(shell xml2-config --libs) \
    19.4  # -h for Solaris
    19.5  SONAME_LDFLAG ?= -soname
    19.6  # -R /usr/sfw/$(LIBDIR) -shared for Solaris
    19.7 -SHLIB_CFLAGS ?= -shared
    19.8 +SHLIB_LDFLAGS ?= -shared
    19.9  
   19.10  # ginstall for Solaris
   19.11  INSTALL      = install
   19.12 @@ -54,7 +54,7 @@ libxenapi.so.$(MAJOR): libxenapi.so.$(MA
   19.13  	ln -sf $< $@
   19.14  
   19.15  libxenapi.so.$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS)
   19.16 -	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
   19.17 +	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
   19.18  
   19.19  libxenapi.a: $(LIBXENAPI_OBJS)
   19.20  	$(AR) rcs libxenapi.a $^
    20.1 --- a/tools/libxl/Makefile	Wed Aug 11 15:56:21 2010 +0100
    20.2 +++ b/tools/libxl/Makefile	Wed Aug 11 18:02:32 2010 +0100
    20.3 @@ -15,7 +15,7 @@ CFLAGS += -Werror -Wno-format-zero-lengt
    20.4  CFLAGS += -I. -fPIC
    20.5  CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl)
    20.6  
    20.7 -LIBS = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore) $(LDFLAGS_libblktapctl) $(UTIL_LIBS)
    20.8 +LIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl) $(UTIL_LIBS)
    20.9  
   20.10  LIBXL_OBJS-y = osdeps.o libxl_paths.o libxl_bootloader.o
   20.11  LIBXL_OBJS = flexarray.o libxl.o libxl_pci.o libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o libxl_internal.o xenguest.o libxl_utils.o $(LIBXL_OBJS-y)
   20.12 @@ -59,7 +59,7 @@ libxenlight.so.$(MAJOR): libxenlight.so.
   20.13  	ln -sf $< $@
   20.14  
   20.15  libxenlight.so.$(MAJOR).$(MINOR): $(LIBXL_OBJS)
   20.16 -	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
   20.17 +	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
   20.18  
   20.19  libxenlight.a: $(LIBXL_OBJS)
   20.20  	$(AR) rcs libxenlight.a $^
   20.21 @@ -71,7 +71,7 @@ libxlutil.so.$(XLUMAJOR): libxlutil.so.$
   20.22  	ln -sf $< $@
   20.23  
   20.24  libxlutil.so.$(XLUMAJOR).$(XLUMINOR): $(LIBXLU_OBJS)
   20.25 -	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxlutil.so.$(XLUMAJOR) $(SHLIB_CFLAGS) -o $@ $^
   20.26 +	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxlutil.so.$(XLUMAJOR) $(SHLIB_LDFLAGS) -o $@ $^
   20.27  
   20.28  libxlutil.a: $(LIBXLU_OBJS)
   20.29  	$(AR) rcs libxlutil.a $^
    21.1 --- a/tools/misc/Makefile	Wed Aug 11 15:56:21 2010 +0100
    21.2 +++ b/tools/misc/Makefile	Wed Aug 11 18:02:32 2010 +0100
    21.3 @@ -52,7 +52,7 @@ clean:
    21.4  	$(CC) -c $(CFLAGS) -o $@ $<
    21.5  
    21.6  xen-hvmctx xen-hvmcrash xenperf xenpm gtracestat xenlockprof xen-hptool xenwatchdogd: %: %.o Makefile
    21.7 -	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore)
    21.8 +	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore)
    21.9  
   21.10  gtraceview: %: %.o Makefile
   21.11  	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(CURSES_LIBS)
    22.1 --- a/tools/security/Makefile	Wed Aug 11 15:56:21 2010 +0100
    22.2 +++ b/tools/security/Makefile	Wed Aug 11 18:02:32 2010 +0100
    22.3 @@ -76,7 +76,7 @@ build: $(ACM_INST_TOOLS) $(ACM_NOINST_TO
    22.4  	chmod 700 $(ACM_SCRIPTS)
    22.5  
    22.6  xensec_tool: $(OBJS_TOOL)
    22.7 -	$(CC) -g $(CFLAGS) $(LDFLAGS) -O0 -o $@ $^ $(LDFLAGS_libxenctrl)
    22.8 +	$(CC) -g $(CFLAGS) $(LDFLAGS) -O0 -o $@ $^ $(LDLIBS_libxenctrl)
    22.9  
   22.10  xensec_gen: xensec_gen.py
   22.11  	cp -f $^ $@
    23.1 --- a/tools/vnet/libxutil/Makefile	Wed Aug 11 15:56:21 2010 +0100
    23.2 +++ b/tools/vnet/libxutil/Makefile	Wed Aug 11 18:02:32 2010 +0100
    23.3 @@ -52,7 +52,7 @@ libxutil.so.$(MAJOR): libxutil.so.$(MAJO
    23.4  	ln -sf $^ $@
    23.5  
    23.6  libxutil.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
    23.7 -	$(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxutil.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
    23.8 +	$(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxutil.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
    23.9  
   23.10  libxutil.a: $(LIB_OBJS)
   23.11  	$(AR) rc $@ $^
    24.1 --- a/tools/xcutils/Makefile	Wed Aug 11 15:56:21 2010 +0100
    24.2 +++ b/tools/xcutils/Makefile	Wed Aug 11 18:02:32 2010 +0100
    24.3 @@ -16,7 +16,7 @@ CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_
    24.4  
    24.5  PROGRAMS = xc_restore xc_save readnotes lsevtchn
    24.6  
    24.7 -LDLIBS   = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore)
    24.8 +LDLIBS   = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore)
    24.9  
   24.10  .PHONY: all
   24.11  all: build
    25.1 --- a/tools/xenbackendd/Makefile	Wed Aug 11 15:56:21 2010 +0100
    25.2 +++ b/tools/xenbackendd/Makefile	Wed Aug 11 18:02:32 2010 +0100
    25.3 @@ -15,7 +15,7 @@ include $(XEN_ROOT)/tools/Rules.mk
    25.4  CFLAGS  += -Werror
    25.5  CFLAGS  += $(CFLAGS_libxenstore)
    25.6  CPPFLAGS += -DXEN_SCRIPT_DIR="\"$(XEN_SCRIPT_DIR)\""
    25.7 -LDFLAGS += $(LDFLAGS_libxenstore)
    25.8 +LDLIBS  += $(LDLIBS_libxenstore)
    25.9  
   25.10  SBIN = xenbackendd
   25.11  
   25.12 @@ -36,6 +36,6 @@ clean:
   25.13  
   25.14  
   25.15  %: %.c Makefile
   25.16 -	$(CC) $(CFLAGS) $(CPPFLAGS) $< $(LDFLAGS) -o $@
   25.17 +	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
   25.18  
   25.19  -include $(DEPS)
    26.1 --- a/tools/xenmon/Makefile	Wed Aug 11 15:56:21 2010 +0100
    26.2 +++ b/tools/xenmon/Makefile	Wed Aug 11 18:02:32 2010 +0100
    26.3 @@ -16,7 +16,7 @@ include $(XEN_ROOT)/tools/Rules.mk
    26.4  CFLAGS  += -Werror
    26.5  CFLAGS  += -I $(XEN_XC)
    26.6  CFLAGS  += $(CFLAGS_libxenctrl)
    26.7 -LDFLAGS += $(LDFLAGS_libxenctrl)
    26.8 +LDLIBS  += $(LDLIBS_libxenctrl)
    26.9  
   26.10  BIN = xentrace_setmask xenbaked
   26.11  SCRIPTS = xenmon.py
   26.12 @@ -42,8 +42,8 @@ clean:
   26.13  
   26.14  
   26.15  %: %.c Makefile
   26.16 -	$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
   26.17 +	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
   26.18  xentrace_%: %.c Makefile
   26.19 -	$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
   26.20 +	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
   26.21  
   26.22  -include $(DEPS)
    27.1 --- a/tools/xenpaging/Makefile	Wed Aug 11 15:56:21 2010 +0100
    27.2 +++ b/tools/xenpaging/Makefile	Wed Aug 11 18:02:32 2010 +0100
    27.3 @@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
    27.4  CFLAGS   += -I $(XEN_XC)
    27.5  CFLAGS   += -I ./
    27.6  CFLAGS   += $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore)
    27.7 -LDFLAGS  += $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore)
    27.8 +LDLIBS  += $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore)
    27.9  
   27.10  POLICY    = default
   27.11  
   27.12 @@ -15,19 +15,16 @@ CFLAGS   += -Werror
   27.13  CFLAGS   += -Wno-unused
   27.14  CFLAGS   += -g
   27.15  
   27.16 -#CFLAGS   += -Wl,-rpath,..
   27.17  CFLAGS   += -Wp,-MD,.$(@F).d
   27.18  DEPS     = .*.d
   27.19  
   27.20 -#LDFLAGS  += $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest)
   27.21 -
   27.22  OBJS     = $(SRCS:.c=.o)
   27.23  IBINS    = xenpaging
   27.24  
   27.25  all: $(IBINS)
   27.26  
   27.27  xenpaging: $(OBJS)
   27.28 -	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
   27.29 +	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
   27.30  
   27.31  install: all
   27.32  	$(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
    28.1 --- a/tools/xenpmd/Makefile	Wed Aug 11 15:56:21 2010 +0100
    28.2 +++ b/tools/xenpmd/Makefile	Wed Aug 11 18:02:32 2010 +0100
    28.3 @@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
    28.4  
    28.5  CFLAGS  += -Werror
    28.6  CFLAGS  += $(CFLAGS_libxenstore)
    28.7 -LDFLAGS += $(LDFLAGS_libxenstore)
    28.8 +LDLIBS += $(LDLIBS_libxenstore)
    28.9  
   28.10  BIN      = xenpmd
   28.11  
   28.12 @@ -20,6 +20,6 @@ clean:
   28.13  	$(RM) -f $(BIN) $(DEPS)
   28.14  
   28.15  %: %.c Makefile
   28.16 -	$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
   28.17 +	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
   28.18  
   28.19  -include $(DEPS)
    29.1 --- a/tools/xenstat/libxenstat/Makefile	Wed Aug 11 15:56:21 2010 +0100
    29.2 +++ b/tools/xenstat/libxenstat/Makefile	Wed Aug 11 18:02:32 2010 +0100
    29.3 @@ -53,7 +53,7 @@ all: $(LIB)
    29.4  	$(RANLIB) $@
    29.5  
    29.6  $(SHLIB): $(OBJECTS-y)
    29.7 -	$(CC) $(CFLAGS) $(LDFLAGS) $(SONAME_FLAGS) $(SHLIB_CFLAGS) -o $@ \
    29.8 +	$(CC) $(CFLAGS) $(LDFLAGS) $(SONAME_FLAGS) $(SHLIB_LDFLAGS) -o $@ \
    29.9  	    $(OBJECTS-y) $(LDLIBS-y)
   29.10  
   29.11  src/xenstat.o: src/xenstat.c src/xenstat.h src/xenstat_priv.h
   29.12 @@ -112,7 +112,7 @@ PYTHON_FLAGS=-I/usr/include/python$(PYTH
   29.13  	swig -python $(SWIG_FLAGS) -outdir $(@D) -o $(PYSRC) $<
   29.14  
   29.15  $(PYLIB): $(PYSRC)
   29.16 -	$(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) $(SHLIB_CFLAGS) -lxenstat -o $@ $<
   29.17 +	$(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $<
   29.18  
   29.19  python-bindings: $(PYLIB) $(PYMOD)
   29.20  
   29.21 @@ -134,7 +134,7 @@ PERL_FLAGS=`perl -MConfig -e 'print "$$C
   29.22  	swig -perl $(SWIG_FLAGS) -outdir $(@D) -o $(PERLSRC) $<
   29.23  
   29.24  $(PERLLIB): $(PERLSRC)
   29.25 -	$(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) $(SHLIB_CFLAGS) -lxenstat -o $@ $<
   29.26 +	$(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $<
   29.27  
   29.28  .PHONY: perl-bindings
   29.29  perl-bindings: $(PERLLIB) $(PERLMOD)
    30.1 --- a/tools/xenstore/Makefile	Wed Aug 11 15:56:21 2010 +0100
    30.2 +++ b/tools/xenstore/Makefile	Wed Aug 11 18:02:32 2010 +0100
    30.3 @@ -47,7 +47,7 @@ CFLAGS += -DHAVE_DTRACE=1
    30.4  endif
    30.5   
    30.6  xenstored: $(XENSTORED_OBJS)
    30.7 -	$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDFLAGS_libxenctrl) $(SOCKET_LIBS) -o $@
    30.8 +	$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS_libxenctrl) $(SOCKET_LIBS) -o $@
    30.9  
   30.10  $(CLIENTS): xenstore
   30.11  	ln -f xenstore $@
   30.12 @@ -69,7 +69,7 @@ libxenstore.so.$(MAJOR): libxenstore.so.
   30.13  xs.opic: CFLAGS += -DUSE_PTHREAD
   30.14  
   30.15  libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic
   30.16 -	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread
   30.17 +	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread
   30.18  
   30.19  libxenstore.a: xs.o xs_lib.o
   30.20  	$(AR) rcs $@ $^
    31.1 --- a/tools/xentrace/Makefile	Wed Aug 11 15:56:21 2010 +0100
    31.2 +++ b/tools/xentrace/Makefile	Wed Aug 11 18:02:32 2010 +0100
    31.3 @@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
    31.4  CFLAGS  += -Werror
    31.5  
    31.6  CFLAGS  += $(CFLAGS_libxenctrl)
    31.7 -LDFLAGS += $(LDFLAGS_libxenctrl)
    31.8 +LDLIBS += $(LDLIBS_libxenctrl)
    31.9  
   31.10  HDRS     = $(wildcard *.h)
   31.11  OBJS     = $(patsubst %.c,%.o,$(wildcard *.c))
   31.12 @@ -50,9 +50,9 @@ clean:
   31.13  	$(RM) *.a *.so *.o *.rpm $(BIN) $(LIBBIN) $(DEPS)
   31.14  
   31.15  %: %.c $(HDRS) Makefile
   31.16 -	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
   31.17 +	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
   31.18  xentrace_%: %.c $(HDRS) Makefile
   31.19 -	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
   31.20 +	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
   31.21  
   31.22  -include $(DEPS)
   31.23