Roger Pau Monne
2011-Oct-14 12:16 UTC
[Xen-devel] [PATCH] tools/build: append user includes and libraries at the end of the compile flags
# HG changeset patch # User Roger Pau Monne <roger.pau@entel.upc.edu> # Date 1318594517 -7200 # Node ID ae251a2f9490dfa98553837d54b502a2606c566e # Parent 064c3cd0ec161e3e4671c7c0c8c0795ce226bca8 tools/build: append user includes and libraries at the end of the compile flags Appending EXTRA_LIB and EXTRA_INCLUDES to LDFLAGS and CFLAGS respectively made the compiler and linker choose the libraries and header files present in the user''s local folder rather than the ones present in the Xen build folder. EXTRA_LIB and EXTRA_INCLUDES are now appended at the end to prevent this. Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu> diff -r 064c3cd0ec16 -r ae251a2f9490 Config.mk --- a/Config.mk Fri Oct 14 13:38:30 2011 +0200 +++ b/Config.mk Fri Oct 14 14:15:17 2011 +0200 @@ -169,8 +169,8 @@ CFLAGS-$(clang) += -Wno-parentheses -Wno $(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement) $(call cc-option-add,CFLAGS,CC,-Wno-unused-but-set-variable) -LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) -CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i)) +USER_LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) +USER_CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i)) EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all EMBEDDED_EXTRA_CFLAGS += -fno-exceptions diff -r 064c3cd0ec16 -r ae251a2f9490 tools/Rules.mk --- a/tools/Rules.mk Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/Rules.mk Fri Oct 14 14:15:17 2011 +0200 @@ -86,18 +86,18 @@ INSTALL_PYTHON_PROG = \ $(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH)" $(INSTALL_PROG) %.opic: %.c - $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS_$*.opic) -fPIC -c -o $@ $< + $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS_$*.opic) -fPIC -c -o $@ $< $(USER_CFLAGS) %.o: %.c - $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -o $@ $< + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -o $@ $< $(USER_CFLAGS) %.o: %.cc - $(CC) $(CPPFLAGS) $(CXXFLAGS) $(CXXFLAGS_$*.o) -c -o $@ $< + $(CC) $(CPPFLAGS) $(CXXFLAGS) $(CXXFLAGS_$*.o) -c -o $@ $< $(USER_CFLAGS) %.o: %.S - $(CC) $(CFLAGS) $(CFLAGS_$*.o) -c $< -o $@ + $(CC) $(CFLAGS) $(CFLAGS_$*.o) -c $< -o $@ $(USER_CFLAGS) %.opic: %.S - $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS.opic) -fPIC -c -o $@ $< + $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS.opic) -fPIC -c -o $@ $< $(USER_CFLAGS) subdirs-all subdirs-clean subdirs-install subdirs-distclean: .phony @set -e; for subdir in $(SUBDIRS) $(SUBDIRS-y); do \ diff -r 064c3cd0ec16 -r ae251a2f9490 tools/console/Makefile --- a/tools/console/Makefile Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/console/Makefile Fri Oct 14 14:15:17 2011 +0200 @@ -23,10 +23,10 @@ clean: $(RM) client/*.o daemon/*.o xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c)) - $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_xenconsoled) + $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_xenconsoled) $(USER_LDFLAGS) xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c)) - $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_xenconsole) + $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_xenconsole) $(USER_LDFLAGS) .PHONY: install install: $(BIN) diff -r 064c3cd0ec16 -r ae251a2f9490 tools/libfsimage/Rules.mk --- a/tools/libfsimage/Rules.mk Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/libfsimage/Rules.mk Fri Oct 14 14:15:17 2011 +0200 @@ -24,7 +24,7 @@ fs-install: fs-all $(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR) $(FSLIB): $(PIC_OBJS) - $(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) + $(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) $(USER_LDFLAGS) clean distclean: rm -f $(PIC_OBJS) $(FSLIB) $(DEPS) diff -r 064c3cd0ec16 -r ae251a2f9490 tools/libvchan/Makefile --- a/tools/libvchan/Makefile Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/libvchan/Makefile Fri Oct 14 14:15:17 2011 +0200 @@ -29,16 +29,16 @@ libxenvchan.so.$(MAJOR): libxenvchan.so. ln -sf $< $@ libxenvchan.so.$(MAJOR).$(MINOR): $(LIBVCHAN_PIC_OBJS) - $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenvchan.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBVCHAN_LIBS) + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenvchan.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBVCHAN_LIBS) $(USER_LDFLAGS) libxenvchan.a: $(LIBVCHAN_OBJS) $(AR) rcs libxenvchan.a $^ vchan-node1: $(NODE_OBJS) libxenvchan.so - $(CC) $(LDFLAGS) -o $@ $(NODE_OBJS) $(LDLIBS_libxenvchan) + $(CC) $(LDFLAGS) -o $@ $(NODE_OBJS) $(LDLIBS_libxenvchan) $(USER_LDFLAGS) vchan-node2: $(NODE2_OBJS) libxenvchan.so - $(CC) $(LDFLAGS) -o $@ $(NODE2_OBJS) $(LDLIBS_libxenvchan) + $(CC) $(LDFLAGS) -o $@ $(NODE2_OBJS) $(LDLIBS_libxenvchan) $(USER_LDFLAGS) .PHONY: install install: all diff -r 064c3cd0ec16 -r ae251a2f9490 tools/libxc/Makefile --- a/tools/libxc/Makefile Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/libxc/Makefile Fri Oct 14 14:15:17 2011 +0200 @@ -156,7 +156,7 @@ libxenctrl.so.$(MAJOR): libxenctrl.so.$( ln -sf $< $@ libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS) - $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(DLOPEN_LIBS) $(PTHREAD_LIBS) + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(DLOPEN_LIBS) $(PTHREAD_LIBS) $(USER_LDFLAGS) # libxenguest @@ -192,10 +192,10 @@ xc_dom_bzimageloader.opic: CFLAGS += $(c libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(call zlib-options,l) libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so - $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz $(LDLIBS_libxenctrl) $(PTHREAD_LIBS) + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz $(LDLIBS_libxenctrl) $(PTHREAD_LIBS) $(USER_LDFLAGS) xenctrl_osdep_ENOSYS.so: $(OSDEP_PIC_OBJS) libxenctrl.so - $(CC) -g $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $(OSDEP_PIC_OBJS) $(LDLIBS_libxenctrl) + $(CC) -g $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $(OSDEP_PIC_OBJS) $(LDLIBS_libxenctrl) $(USER_LDFLAGS) -include $(DEPS) diff -r 064c3cd0ec16 -r ae251a2f9490 tools/libxen/Makefile --- a/tools/libxen/Makefile Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/libxen/Makefile Fri Oct 14 14:15:17 2011 +0200 @@ -44,13 +44,13 @@ libxenapi.so.$(MAJOR): libxenapi.so.$(MA ln -sf $< $@ libxenapi.so.$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS) - $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(USER_LDFLAGS) libxenapi.a: $(LIBXENAPI_OBJS) $(AR) rcs libxenapi.a $^ $(TEST_PROGRAMS): test/%: test/%.o libxenapi.so - $(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi + $(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi $(USER_LDFLAGS) .PHONY: install diff -r 064c3cd0ec16 -r ae251a2f9490 tools/libxl/Makefile --- a/tools/libxl/Makefile Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/libxl/Makefile Fri Oct 14 14:15:17 2011 +0200 @@ -108,7 +108,7 @@ libxenlight.so.$(MAJOR): libxenlight.so. ln -sf $< $@ libxenlight.so.$(MAJOR).$(MINOR): $(LIBXL_OBJS) - $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXL_LIBS) + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXL_LIBS) $(USER_LDFLAGS) libxenlight.a: $(LIBXL_OBJS) $(AR) rcs libxenlight.a $^ @@ -120,16 +120,16 @@ libxlutil.so.$(XLUMAJOR): libxlutil.so.$ ln -sf $< $@ libxlutil.so.$(XLUMAJOR).$(XLUMINOR): $(LIBXLU_OBJS) - $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxlutil.so.$(XLUMAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXLU_LIBS) + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxlutil.so.$(XLUMAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXLU_LIBS) $(USER_LDFLAGS) libxlutil.a: $(LIBXLU_OBJS) $(AR) rcs libxlutil.a $^ xl: $(XL_OBJS) libxlutil.so libxenlight.so - $(CC) $(LDFLAGS) -o $@ $(XL_OBJS) libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl) + $(CC) $(LDFLAGS) -o $@ $(XL_OBJS) libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl) $(USER_LDFLAGS) testidl: testidl.o libxlutil.so libxenlight.so - $(CC) $(LDFLAGS) -o $@ testidl.o libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl) + $(CC) $(LDFLAGS) -o $@ testidl.o libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl) $(USER_LDFLAGS) .PHONY: install install: all diff -r 064c3cd0ec16 -r ae251a2f9490 tools/misc/Makefile --- a/tools/misc/Makefile Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/misc/Makefile Fri Oct 14 14:15:17 2011 +0200 @@ -47,30 +47,30 @@ clean: set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done xen-hvmctx: xen-hvmctx.o - $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(USER_LDFLAGS) xen-hvmcrash: xen-hvmcrash.o - $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(USER_LDFLAGS) xenperf: xenperf.o - $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(USER_LDFLAGS) xenpm: xenpm.o - $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(USER_LDFLAGS) gtracestat: gtracestat.o $(CC) $(LDFLAGS) -o $@ $< xenlockprof: xenlockprof.o - $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(USER_LDFLAGS) xen-hptool: xen-hptool.o - $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(USER_LDFLAGS) xenwatchdogd: xenwatchdogd.o - $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(USER_LDFLAGS) gtraceview: gtraceview.o - $(CC) $(LDFLAGS) -o $@ $< $(CURSES_LIBS) + $(CC) $(LDFLAGS) -o $@ $< $(CURSES_LIBS) $(USER_LDFLAGS) -include $(DEPS) diff -r 064c3cd0ec16 -r ae251a2f9490 tools/xcutils/Makefile --- a/tools/xcutils/Makefile Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/xcutils/Makefile Fri Oct 14 14:15:17 2011 +0200 @@ -27,16 +27,16 @@ all: build build: $(PROGRAMS) xc_restore: xc_restore.o - $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) + $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(USER_LDFLAGS) xc_save: xc_save.o - $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) + $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(USER_LDFLAGS) readnotes: readnotes.o - $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) + $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(USER_LDFLAGS) lsevtchn: lsevtchn.o - $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) + $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(USER_LDFLAGS) .PHONY: install install: build diff -r 064c3cd0ec16 -r ae251a2f9490 tools/xenbackendd/Makefile --- a/tools/xenbackendd/Makefile Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/xenbackendd/Makefile Fri Oct 14 14:15:17 2011 +0200 @@ -33,6 +33,6 @@ clean: rm -f $(DEPS) xenbackendd: xenbackendd.o - $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) + $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) $(USER_LDFLAGS) -include $(DEPS) diff -r 064c3cd0ec16 -r ae251a2f9490 tools/xenmon/Makefile --- a/tools/xenmon/Makefile Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/xenmon/Makefile Fri Oct 14 14:15:17 2011 +0200 @@ -41,9 +41,9 @@ clean: $(RM) -f xentrace_setmake setmask.o xenbaked: xenbaked.o Makefile - $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) + $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) $(USER_LDFLAGS) xentrace_setmask: setmask.o Makefile - $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) + $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) $(USER_LDFLAGS) -include $(DEPS) diff -r 064c3cd0ec16 -r ae251a2f9490 tools/xenpaging/Makefile --- a/tools/xenpaging/Makefile Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/xenpaging/Makefile Fri Oct 14 14:15:17 2011 +0200 @@ -20,7 +20,7 @@ IBINS = xenpaging all: $(IBINS) xenpaging: $(OBJS) - $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) + $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(USER_LDFLAGS) install: all $(INSTALL_DIR) $(DESTDIR)/var/lib/xen/xenpaging diff -r 064c3cd0ec16 -r ae251a2f9490 tools/xenpmd/Makefile --- a/tools/xenpmd/Makefile Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/xenpmd/Makefile Fri Oct 14 14:15:17 2011 +0200 @@ -19,6 +19,6 @@ clean: $(RM) -f xenpmd xenpmd.o $(DEPS) xenpmd: xenpmd.o Makefile - $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) + $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) $(USER_LDFLAGS) -include $(DEPS) diff -r 064c3cd0ec16 -r ae251a2f9490 tools/xenstat/libxenstat/Makefile --- a/tools/xenstat/libxenstat/Makefile Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/xenstat/libxenstat/Makefile Fri Oct 14 14:15:17 2011 +0200 @@ -51,7 +51,7 @@ all: $(LIB) $(SHLIB) $(SHLIB_LINKS) $(SHLIB): $(OBJECTS-y) $(CC) $(LDFLAGS) $(SONAME_FLAGS) $(SHLIB_LDFLAGS) -o $@ \ - $(OBJECTS-y) $(LDLIBS-y) + $(OBJECTS-y) $(LDLIBS-y) $(USER_LDFLAGS) src/libxenstat.so.$(MAJOR): $(SHLIB) $(MAKE_LINK) $(<F) $@ @@ -95,7 +95,7 @@ PYTHON_FLAGS=-I/usr/include/python$(PYTH swig -python $(SWIG_FLAGS) -outdir $(@D) -o $(PYSRC) $< $(PYLIB): $(PYSRC) - $(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $< + $(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $< $(USER_LDFLAGS) python-bindings: $(PYLIB) $(PYMOD) @@ -117,7 +117,7 @@ PERL_FLAGS=`perl -MConfig -e ''print "$$C swig -perl $(SWIG_FLAGS) -outdir $(@D) -o $(PERLSRC) $< $(PERLLIB): $(PERLSRC) - $(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $< + $(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $< $(USER_LDFLAGS) .PHONY: perl-bindings perl-bindings: $(PERLLIB) $(PERLMOD) diff -r 064c3cd0ec16 -r ae251a2f9490 tools/xenstore/Makefile --- a/tools/xenstore/Makefile Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/xenstore/Makefile Fri Oct 14 14:15:17 2011 +0200 @@ -47,19 +47,19 @@ CFLAGS += -DHAVE_DTRACE=1 endif xenstored: $(XENSTORED_OBJS) - $(CC) $(LDFLAGS) $^ $(LDLIBS_libxenctrl) $(SOCKET_LIBS) -o $@ + $(CC) $(LDFLAGS) $^ $(LDLIBS_libxenctrl) $(SOCKET_LIBS) -o $@ $(USER_LDFLAGS) $(CLIENTS): xenstore ln -f xenstore $@ xenstore: xenstore_client.o $(LIBXENSTORE) - $(CC) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@ + $(CC) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@ $(USER_LDFLAGS) xenstore-control: xenstore_control.o $(LIBXENSTORE) - $(CC) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@ + $(CC) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@ $(USER_LDFLAGS) xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o - $(CC) $(LDFLAGS) $^ -o $@ + $(CC) $(LDFLAGS) $^ -o $@ $(USER_LDFLAGS) libxenstore.so: libxenstore.so.$(MAJOR) ln -sf $< $@ @@ -69,7 +69,7 @@ libxenstore.so.$(MAJOR): libxenstore.so. xs.opic: CFLAGS += -DUSE_PTHREAD libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic - $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread $(USER_LDFLAGS) libxenstore.a: xs.o xs_lib.o $(AR) rcs $@ $^ diff -r 064c3cd0ec16 -r ae251a2f9490 tools/xentrace/Makefile --- a/tools/xentrace/Makefile Fri Oct 14 13:38:30 2011 +0200 +++ b/tools/xentrace/Makefile Fri Oct 14 14:15:17 2011 +0200 @@ -35,13 +35,13 @@ clean: $(RM) *.a *.so *.o *.rpm $(BIN) $(LIBBIN) $(DEPS) xentrace: xentrace.o - $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(USER_LDFLAGS) xenctx: xenctx.o - $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(USER_LDFLAGS) xentrace_setsize: setsize.o - $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(USER_LDFLAGS) -include $(DEPS) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Oct-17 14:33 UTC
Re: [Xen-devel] [PATCH] tools/build: append user includes and libraries at the end of the compile flags
Roger Pau Monne writes ("[Xen-devel] [PATCH] tools/build: append user includes and libraries at the end of the compile flags"):> tools/build: append user includes and libraries at the end of the compile flags > > Appending EXTRA_LIB and EXTRA_INCLUDES to LDFLAGS and CFLAGS respectively made the compiler and linker choose the libraries and header files present in the user''s local folder rather than the ones present in the Xen build folder. EXTRA_LIB and EXTRA_INCLUDES are now appended at the end to prevent this.This looks reasonable to me, although the commit message still talks about EXTRA_*. Is everyone happy with the name USER_{LDFLAGS,CFLAGS} ? I''ll give people a few days to comment, but I''m inclined to apply this one. Thanks, Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Roger Pau Monné
2011-Oct-17 14:38 UTC
Re: [Xen-devel] [PATCH] tools/build: append user includes and libraries at the end of the compile flags
> This looks reasonable to me, although the commit message still talks > about EXTRA_*. Is everyone happy with the name > USER_{LDFLAGS,CFLAGS} ?In .config extra libraries and includes should be defined with EXTRA_INCLUDES and EXTRA_LIB (the same way it is now), USER_LDFLAGS and USER_CFLAGS is an internal make variable, and should not be set directly by the user. Notice the lines: +USER_LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) +USER_CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i)) EXTRA_LIB and EXTRA_INCLUDES is added to USER_LDFLAGS and USER_CFLAGS instead of LDFLAGS and CFLAGS.> I''ll give people a few days to comment, but I''m inclined to apply this > one. > > Thanks, > Ian. >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Oct-17 14:41 UTC
Re: [Xen-devel] [PATCH] tools/build: append user includes and libraries at the end of the compile flags
Roger Pau Monné writes ("Re: [Xen-devel] [PATCH] tools/build: append user includes and libraries at the end of the compile flags"):> In .config extra libraries and includes should be defined with > EXTRA_INCLUDES and EXTRA_LIB (the same way it is now), USER_LDFLAGS > and USER_CFLAGS is an internal make variable, and should not be set > directly by the user. Notice the lines: > > +USER_LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) > +USER_CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i)) > > EXTRA_LIB and EXTRA_INCLUDES is added to USER_LDFLAGS and USER_CFLAGS > instead of LDFLAGS and CFLAGS.Oh, sorry, I didn''t spot that. In that case I think it''s not correct because that''s changing the semantics of the existing EXTRA_* variables. In particular, some people might currently set EXTRA_* expecting them to come first. We should have a new variable for the new semantics. I confess I didn''t read your patch closely enough to spot that you hadn''t done that... Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Roger Pau Monné
2011-Oct-17 14:43 UTC
Re: [Xen-devel] [PATCH] tools/build: append user includes and libraries at the end of the compile flags
2011/10/17 Ian Jackson <Ian.Jackson@eu.citrix.com>:> Roger Pau Monné writes ("Re: [Xen-devel] [PATCH] tools/build: append user includes and libraries at the end of the compile flags"): >> In .config extra libraries and includes should be defined with >> EXTRA_INCLUDES and EXTRA_LIB (the same way it is now), USER_LDFLAGS >> and USER_CFLAGS is an internal make variable, and should not be set >> directly by the user. Notice the lines: >> >> +USER_LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) >> +USER_CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i)) >> >> EXTRA_LIB and EXTRA_INCLUDES is added to USER_LDFLAGS and USER_CFLAGS >> instead of LDFLAGS and CFLAGS. > > Oh, sorry, I didn''t spot that. > > In that case I think it''s not correct because that''s changing the > semantics of the existing EXTRA_* variables. In particular, some > people might currently set EXTRA_* expecting them to come first. > > We should have a new variable for the new semantics. I confess I > didn''t read your patch closely enough to spot that you hadn''t done > that...Ok, in that case I think we should define a new variable called USER_CFLAGS and USER_LDFLAGS if everyone is comfortable with that. I will send a new version with this changes.> > Ian. >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Roger Pau Monné
2011-Oct-17 17:04 UTC
Re: [Xen-devel] [PATCH] tools/build: append user includes and libraries at the end of the compile flags
On second through, I think it would be appropriate to rename EXTRA_LIB and EXTRA_INCLUDES to PREPEND_LIB and PREPEND_INCLUDES, and create two new variables called APPEND_INCLUDES and APPEND_LIB that perform the same task as USER_CFLAGS and USER_LDFLAGS (append at the end). I think it would be much more clearer using descriptive variable names, since USER_ and EXTRA_ can lead to confusion. Regards, Roger. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Oct-18 10:53 UTC
Re: [Xen-devel] [PATCH] tools/build: append user includes and libraries at the end of the compile flags
Roger Pau Monné writes ("Re: [Xen-devel] [PATCH] tools/build: append user includes and libraries at the end of the compile flags"):> On second through, I think it would be appropriate to rename EXTRA_LIB > and EXTRA_INCLUDES to PREPEND_LIB and PREPEND_INCLUDES, and create two > new variables called APPEND_INCLUDES and APPEND_LIB that perform the > same task as USER_CFLAGS and USER_LDFLAGS (append at the end). I think > it would be much more clearer using descriptive variable names, since > USER_ and EXTRA_ can lead to confusion.That would be neater, but I don''t think it''s helpful to people for us to be renaming our build variables. Anyone who is repackaging Xen (distros, XCP, ...) would prefer the variables to say the same even if the names aren''t ideal. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-Oct-18 10:58 UTC
Re: [Xen-devel] [PATCH] tools/build: append user includes and libraries at the end of the compile flags
On Tue, 2011-10-18 at 11:53 +0100, Ian Jackson wrote:> Roger Pau Monné writes ("Re: [Xen-devel] [PATCH] tools/build: append user includes and libraries at the end of the compile flags"): > > On second through, I think it would be appropriate to rename EXTRA_LIB > > and EXTRA_INCLUDES to PREPEND_LIB and PREPEND_INCLUDES, and create two > > new variables called APPEND_INCLUDES and APPEND_LIB that perform the > > same task as USER_CFLAGS and USER_LDFLAGS (append at the end). I think > > it would be much more clearer using descriptive variable names, since > > USER_ and EXTRA_ can lead to confusion. > > That would be neater, but I don''t think it''s helpful to people for us > to be renaming our build variables. > > Anyone who is repackaging Xen (distros, XCP, ...) would prefer the > variables to say the same even if the names aren''t ideal.As long as we keep the old names as well is there harm in adding new, more descriptive names as well? i.e. $(PREPEND_LIB) $(EXTRA_LIB) ... $(APPEND_LIB) ? or even PREPEND_LIB ?= $(EXTRA_LIB) and "$(PREPEND_LIB) ... $(APPEND_LIB)". That way things don''t break today and when a packager finds they actually need the distinction they can switch. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Roger Pau Monné
2011-Oct-18 10:58 UTC
Re: [Xen-devel] [PATCH] tools/build: append user includes and libraries at the end of the compile flags
> That would be neater, but I don''t think it''s helpful to people for us > to be renaming our build variables. > > Anyone who is repackaging Xen (distros, XCP, ...) would prefer the > variables to say the same even if the names aren''t ideal.My new patch include PREPEND_ and APPEND_ while maintaining the old EXTRA_. Is that fine?> Ian. >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Roger Pau Monné
2011-Oct-18 11:24 UTC
Re: [Xen-devel] [PATCH] tools/build: append user includes and libraries at the end of the compile flags
2011/10/18 Ian Campbell <Ian.Campbell@citrix.com>:>> That would be neater, but I don''t think it''s helpful to people for us >> to be renaming our build variables. >> >> Anyone who is repackaging Xen (distros, XCP, ...) would prefer the >> variables to say the same even if the names aren''t ideal. > > As long as we keep the old names as well is there harm in adding new, > more descriptive names as well? i.e. > $(PREPEND_LIB) $(EXTRA_LIB) ... $(APPEND_LIB) > ? > > or even PREPEND_LIB ?= $(EXTRA_LIB) and "$(PREPEND_LIB) ... > $(APPEND_LIB)". That way things don''t break today and when a packager > finds they actually need the distinction they can switch.I''ve just sent the new patch, it''s called tools/build: create two new variables called APPEND_ and PREPEND_ to add compile flags at the beginning or at the end of the search path Please take a look at that one if possible. I''ve left EXTRA_LIB and EXTRA_INCLUDES as they where, so the new patch should be harmless for people still using those, while adding the new PREPEND_ and APPEND_ variables. Thanks, Roger. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel