xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0 of 2 v2] tools: add two new compile flags and perform checks on user defined folders.
@ 2011-10-18  9:29 Roger Pau Monne
  2011-10-18  9:29 ` [PATCH 1 of 2 v2] 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 Roger Pau Monne
  2011-10-18  9:29 ` [PATCH 2 of 2 v2] tools/check: check for headers and libraries in user defined folders Roger Pau Monne
  0 siblings, 2 replies; 6+ messages in thread
From: Roger Pau Monne @ 2011-10-18  9:29 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian.Jackson

Added two new sets of compile flags, and passed them to the check scripts, so libraries and includes are searched there also.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1 of 2 v2] 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
  2011-10-18  9:29 [PATCH 0 of 2 v2] tools: add two new compile flags and perform checks on user defined folders Roger Pau Monne
@ 2011-10-18  9:29 ` Roger Pau Monne
  2011-11-14 18:17   ` Ian Jackson
  2011-10-18  9:29 ` [PATCH 2 of 2 v2] tools/check: check for headers and libraries in user defined folders Roger Pau Monne
  1 sibling, 1 reply; 6+ messages in thread
From: Roger Pau Monne @ 2011-10-18  9:29 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian.Jackson

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1318929988 -7200
# Node ID 8e4ffea9c9d0e41c0887b476aa34f305cf241b55
# Parent  f3e94220364b30e49c3324100622a0b241880123
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.

Added a new semantic for user defined compile flags, here is the list of possible options:

PREPEND_LIB: add libraries to the search path before xen (before xen installation folders).
PREPEND_INCLUDES: add headers to the search path before xen (before xen installation folders).
APPEND_LIB: add libraries to the search path at the end (after all xen installation folders have been added).
APPEND_INCLUDES: add libraries to the search path at the end (after all xen installation folders have been added).

EXTRA_INCLUDES and EXTRA_LIB can still be used, and they will have the same effect as PREPEND_INCLUDES and PREPEND_LIB.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>

diff -r f3e94220364b -r 8e4ffea9c9d0 Config.mk
--- a/Config.mk	Mon Oct 17 16:23:54 2011 +0200
+++ b/Config.mk	Tue Oct 18 11:26:28 2011 +0200
@@ -171,6 +171,10 @@ CFLAGS-$(clang) += -Wno-parentheses -Wno
 
 LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) 
 CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
+LDFLAGS += $(foreach i, $(PREPEND_LIB), -L$(i))
+CFLAGS += $(foreach i, $(PREPEND_INCLUDES), -I$(i))
+APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i))
+APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/Rules.mk
--- a/tools/Rules.mk	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/Rules.mk	Tue Oct 18 11:26:28 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 $@ $< $(APPEND_CFLAGS)
 
 %.o: %.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -o $@ $< $(APPEND_CFLAGS)
 
 %.o: %.cc
-	$(CC) $(CPPFLAGS) $(CXXFLAGS) $(CXXFLAGS_$*.o) -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(CXXFLAGS) $(CXXFLAGS_$*.o) -c -o $@ $< $(APPEND_CFLAGS)
 
 %.o: %.S
-	$(CC) $(CFLAGS) $(CFLAGS_$*.o) -c $< -o $@
+	$(CC) $(CFLAGS) $(CFLAGS_$*.o) -c $< -o $@ $(APPEND_CFLAGS)
 %.opic: %.S
-	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS.opic) -fPIC -c -o $@ $<
+	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS.opic) -fPIC -c -o $@ $< $(APPEND_CFLAGS)
 
 subdirs-all subdirs-clean subdirs-install subdirs-distclean: .phony
 	@set -e; for subdir in $(SUBDIRS) $(SUBDIRS-y); do \
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/console/Makefile
--- a/tools/console/Makefile	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/console/Makefile	Tue Oct 18 11:26:28 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) $(APPEND_LDFLAGS)
 
 xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c))
-	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_xenconsole)
+	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_xenconsole) $(APPEND_LDFLAGS)
 
 .PHONY: install
 install: $(BIN)
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/libfsimage/Rules.mk
--- a/tools/libfsimage/Rules.mk	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/libfsimage/Rules.mk	Tue Oct 18 11:26:28 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) $(APPEND_LDFLAGS)
 
 clean distclean:
 	rm -f $(PIC_OBJS) $(FSLIB) $(DEPS)
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/libvchan/Makefile
--- a/tools/libvchan/Makefile	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/libvchan/Makefile	Tue Oct 18 11:26:28 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) $(APPEND_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) $(APPEND_LDFLAGS)
 
 vchan-node2: $(NODE2_OBJS) libxenvchan.so
-	$(CC) $(LDFLAGS) -o $@ $(NODE2_OBJS) $(LDLIBS_libxenvchan)
+	$(CC) $(LDFLAGS) -o $@ $(NODE2_OBJS) $(LDLIBS_libxenvchan) $(APPEND_LDFLAGS)
 
 .PHONY: install
 install: all
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/libxc/Makefile
--- a/tools/libxc/Makefile	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/libxc/Makefile	Tue Oct 18 11:26:28 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) $(APPEND_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) $(APPEND_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) $(APPEND_LDFLAGS)
 
 -include $(DEPS)
 
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/libxen/Makefile
--- a/tools/libxen/Makefile	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/libxen/Makefile	Tue Oct 18 11:26:28 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 $@ $^ $(APPEND_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 $(APPEND_LDFLAGS)
 
 
 .PHONY: install
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/libxl/Makefile	Tue Oct 18 11:26:28 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) $(APPEND_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) $(APPEND_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) $(APPEND_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) $(APPEND_LDFLAGS)
 
 .PHONY: install
 install: all
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/misc/Makefile
--- a/tools/misc/Makefile	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/misc/Makefile	Tue Oct 18 11:26:28 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) $(APPEND_LDFLAGS)
 
 xen-hvmcrash: xen-hvmcrash.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 xenperf: xenperf.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 xenpm: xenpm.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 gtracestat: gtracestat.o
-	$(CC) $(LDFLAGS) -o $@ $<
+	$(CC) $(LDFLAGS) -o $@ $< $(APPEND_LDFLAGS)
 
 xenlockprof: xenlockprof.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 xen-hptool: xen-hptool.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(APPEND_LDFLAGS)
 
 xenwatchdogd: xenwatchdogd.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 gtraceview: gtraceview.o
-	$(CC) $(LDFLAGS) -o $@ $< $(CURSES_LIBS)
+	$(CC) $(LDFLAGS) -o $@ $< $(CURSES_LIBS) $(APPEND_LDFLAGS)
 
 -include $(DEPS)
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/xcutils/Makefile
--- a/tools/xcutils/Makefile	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/xcutils/Makefile	Tue Oct 18 11:26:28 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) $(APPEND_LDFLAGS)
 
 xc_save: xc_save.o
-	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore)
+	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(APPEND_LDFLAGS)
 
 readnotes: readnotes.o
-	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest)
+	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(APPEND_LDFLAGS)
 
 lsevtchn: lsevtchn.o
-	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl)
+	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 .PHONY: install
 install: build
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/xenbackendd/Makefile
--- a/tools/xenbackendd/Makefile	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/xenbackendd/Makefile	Tue Oct 18 11:26:28 2011 +0200
@@ -33,6 +33,6 @@ clean:
 	rm -f $(DEPS)
 
 xenbackendd: xenbackendd.o
-	$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS)
+	$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) $(APPEND_LDFLAGS)
 
 -include $(DEPS)
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/xenmon/Makefile
--- a/tools/xenmon/Makefile	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/xenmon/Makefile	Tue Oct 18 11:26:28 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) $(APPEND_LDFLAGS)
 
 xentrace_setmask: setmask.o Makefile
-	$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS)
+	$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) $(APPEND_LDFLAGS)
 
 -include $(DEPS)
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/xenpaging/Makefile
--- a/tools/xenpaging/Makefile	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/xenpaging/Makefile	Tue Oct 18 11:26:28 2011 +0200
@@ -20,7 +20,7 @@ IBINS    = xenpaging
 all: $(IBINS)
 
 xenpaging: $(OBJS)
-	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(APPEND_LDFLAGS)
 
 install: all
 	$(INSTALL_DIR) $(DESTDIR)/var/lib/xen/xenpaging
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/xenpmd/Makefile
--- a/tools/xenpmd/Makefile	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/xenpmd/Makefile	Tue Oct 18 11:26:28 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) $(APPEND_LDFLAGS)
 
 -include $(DEPS)
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/xenstat/libxenstat/Makefile
--- a/tools/xenstat/libxenstat/Makefile	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/xenstat/libxenstat/Makefile	Tue Oct 18 11:26:28 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) $(APPEND_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 $@ $< $(APPEND_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 $@ $< $(APPEND_LDFLAGS)
 
 .PHONY: perl-bindings
 perl-bindings: $(PERLLIB) $(PERLMOD)
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/xenstore/Makefile
--- a/tools/xenstore/Makefile	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/xenstore/Makefile	Tue Oct 18 11:26:28 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 $@ $(APPEND_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 $@ $(APPEND_LDFLAGS)
 
 xenstore-control: xenstore_control.o $(LIBXENSTORE)
-	$(CC) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@
+	$(CC) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
 
 xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o
-	$(CC) $(LDFLAGS) $^ -o $@
+	$(CC) $(LDFLAGS) $^ -o $@ $(APPEND_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 $(APPEND_LDFLAGS)
 
 libxenstore.a: xs.o xs_lib.o
 	$(AR) rcs $@ $^
diff -r f3e94220364b -r 8e4ffea9c9d0 tools/xentrace/Makefile
--- a/tools/xentrace/Makefile	Mon Oct 17 16:23:54 2011 +0200
+++ b/tools/xentrace/Makefile	Tue Oct 18 11:26:28 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) $(APPEND_LDFLAGS)
 
 xenctx: xenctx.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS)
 
 xentrace_setsize: setsize.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS)
 
 -include $(DEPS)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2 of 2 v2] tools/check: check for headers and libraries in user defined folders
  2011-10-18  9:29 [PATCH 0 of 2 v2] tools: add two new compile flags and perform checks on user defined folders Roger Pau Monne
  2011-10-18  9:29 ` [PATCH 1 of 2 v2] 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 Roger Pau Monne
@ 2011-10-18  9:29 ` Roger Pau Monne
  2011-10-25 16:37   ` [PATCH v3] " Roger Pau Monne
  1 sibling, 1 reply; 6+ messages in thread
From: Roger Pau Monne @ 2011-10-18  9:29 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian.Jackson

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1318930003 -7200
# Node ID 0a720316685a73e2d5aee56c1572b9ee8d98ab4e
# Parent  8e4ffea9c9d0e41c0887b476aa34f305cf241b55
tools/check: check for headers and libraries in user defined folders.

Parse EXTRA_INCLUDES, EXTRA_LIB, PREPEND_INCLUDES, PREPEND_LIB, APPEND_INCLUDES, APPEND_LIB during checks, to search for required files.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>

diff -r 8e4ffea9c9d0 -r 0a720316685a Config.mk
--- a/Config.mk	Tue Oct 18 11:26:28 2011 +0200
+++ b/Config.mk	Tue Oct 18 11:26:43 2011 +0200
@@ -176,6 +176,9 @@ CFLAGS += $(foreach i, $(PREPEND_INCLUDE
 APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i))
 APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
+CHECK_LIB = $(EXTRA_LIB) $(PREPEND_LIB) $(APPEND_LIB)
+CHECK_INCLUDES = $(EXTRA_INCLUDES) $(PREPEND_INCLUDES) $(APPEND_INCLUDES)
+
 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions
 
diff -r 8e4ffea9c9d0 -r 0a720316685a tools/check/Makefile
--- a/tools/check/Makefile	Tue Oct 18 11:26:28 2011 +0200
+++ b/tools/check/Makefile	Tue Oct 18 11:26:43 2011 +0200
@@ -7,12 +7,12 @@ all install: check-build
 # Check this machine is OK for building on.
 .PHONY: check-build
 check-build:
-	PYTHON=$(PYTHON) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) ./chk build
+	PYTHON=$(PYTHON) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) CHECK_INCLUDES="$(CHECK_INCLUDES)" CHECK_LIB="$(CHECK_LIB)" ./chk build
 
 # Check this machine is OK for installing on.
 .PHONY: check-install
 check-install:
-	PYTHON=$(PYTHON) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) ./chk install
+	PYTHON=$(PYTHON) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) CHECK_INCLUDES="$(CHECK_INCLUDES)" CHECK_LIB="$(CHECK_LIB)" ./chk install
 
 .PHONY: clean
 clean:
diff -r 8e4ffea9c9d0 -r 0a720316685a tools/check/funcs.sh
--- a/tools/check/funcs.sh	Tue Oct 18 11:26:28 2011 +0200
+++ b/tools/check/funcs.sh	Tue Oct 18 11:26:43 2011 +0200
@@ -25,15 +25,23 @@ has_or_fail() {
 }
 
 has_header() {
+	check_sys_root || return 1
+
 	case $1 in
 		/*) ;;
-		*) set -- "/usr/include/$1" ;;
+		*)
+		if [ -r "$CROSS_SYS_ROOT/usr/include/$1" ]; then
+			return 0
+		fi
+		for path in ${CHECK_INCLUDES}; do
+			if [ -r "$CROSS_SYS_ROOT${path}/$1" ]; then
+				return 0
+			fi
+		done
+		;;
 	esac
 
-	check_sys_root || return 1
-
-	test -r "$CROSS_SYS_ROOT$1"
-	return $?
+	return 1
 }
 
 has_lib() {
@@ -42,6 +50,7 @@ has_lib() {
 	# subshell to prevent pollution of caller's environment
 	(
 	PATH=/sbin:$PATH        # for ldconfig
+	LIBRARIES="$CHECK_LIB /usr/lib"
 
 	# This relatively common in a sys-root; libs are installed but
 	# ldconfig hasn't run there, so ldconfig -p won't work.
@@ -49,8 +58,15 @@ has_lib() {
 	    echo "Please run ldconfig -r \"$CROSS_SYS_ROOT\" to generate ld.so.cache"
 	    # fall through; ldconfig test below should fail
 	fi
-	ldconfig -p ${CROSS_SYS_ROOT+-r "$CROSS_SYS_ROOT"} | grep -Fq "$1"
-	return $?
+	if [ "${OS}" = "Linux" ]; then
+		ldconfig -p ${CROSS_SYS_ROOT+-r "$CROSS_SYS_ROOT"} | grep -Fq "$1"
+		return $?
+	fi
+	if [ "${OS}" = "NetBSD" ]; then
+		ls -1 ${LIBRARIES} | grep -Fq "$1"
+		return $?
+	fi
+	return 1
 	)
 }

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3] tools/check: check for headers and libraries in user defined folders
  2011-10-18  9:29 ` [PATCH 2 of 2 v2] tools/check: check for headers and libraries in user defined folders Roger Pau Monne
@ 2011-10-25 16:37   ` Roger Pau Monne
  2011-11-14 18:18     ` Ian Jackson
  0 siblings, 1 reply; 6+ messages in thread
From: Roger Pau Monne @ 2011-10-25 16:37 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian.Jackson

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1319560415 -7200
# Node ID f5e0cd9fa6ee923b8524e6a3fd652714de34847d
# Parent  657f4a66dba0b5ca3ad5e89626e735d976e02141
tools/check: check for headers and libraries in user defined folders.

Parse EXTRA_INCLUDES, EXTRA_LIB, PREPEND_INCLUDES, PREPEND_LIB, APPEND_INCLUDES, APPEND_LIB during checks, to search for required files.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>

diff -r 657f4a66dba0 -r f5e0cd9fa6ee Config.mk
--- a/Config.mk	Fri Oct 21 14:03:17 2011 +0200
+++ b/Config.mk	Tue Oct 25 18:33:35 2011 +0200
@@ -176,6 +176,9 @@ CFLAGS += $(foreach i, $(PREPEND_INCLUDE
 APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i))
 APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
+CHECK_LIB = $(EXTRA_LIB) $(PREPEND_LIB) $(APPEND_LIB)
+CHECK_INCLUDES = $(EXTRA_INCLUDES) $(PREPEND_INCLUDES) $(APPEND_INCLUDES)
+
 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions
 
diff -r 657f4a66dba0 -r f5e0cd9fa6ee tools/check/Makefile
--- a/tools/check/Makefile	Fri Oct 21 14:03:17 2011 +0200
+++ b/tools/check/Makefile	Tue Oct 25 18:33:35 2011 +0200
@@ -1,18 +1,24 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
+# Export the necessary environment variables for the tests
+export PYTHON
+export LIBXENAPI_BINDINGS
+export CHECK_INCLUDES
+export CHECK_LIB
+
 .PHONY: all install
 all install: check-build
 
 # Check this machine is OK for building on.
 .PHONY: check-build
 check-build:
-	PYTHON=$(PYTHON) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) ./chk build
+	./chk build
 
 # Check this machine is OK for installing on.
 .PHONY: check-install
 check-install:
-	PYTHON=$(PYTHON) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) ./chk install
+	./chk install
 
 .PHONY: clean
 clean:
diff -r 657f4a66dba0 -r f5e0cd9fa6ee tools/check/funcs.sh
--- a/tools/check/funcs.sh	Fri Oct 21 14:03:17 2011 +0200
+++ b/tools/check/funcs.sh	Tue Oct 25 18:33:35 2011 +0200
@@ -25,15 +25,23 @@ has_or_fail() {
 }
 
 has_header() {
+	check_sys_root || return 1
+
 	case $1 in
 		/*) ;;
-		*) set -- "/usr/include/$1" ;;
+		*)
+		if [ -r "$CROSS_SYS_ROOT/usr/include/$1" ]; then
+			return 0
+		fi
+		for path in ${CHECK_INCLUDES}; do
+			if [ -r "$CROSS_SYS_ROOT${path}/$1" ]; then
+				return 0
+			fi
+		done
+		;;
 	esac
 
-	check_sys_root || return 1
-
-	test -r "$CROSS_SYS_ROOT$1"
-	return $?
+	return 1
 }
 
 has_lib() {
@@ -42,6 +50,7 @@ has_lib() {
 	# subshell to prevent pollution of caller's environment
 	(
 	PATH=/sbin:$PATH        # for ldconfig
+	LIBRARIES="$CHECK_LIB /usr/lib"
 
 	# This relatively common in a sys-root; libs are installed but
 	# ldconfig hasn't run there, so ldconfig -p won't work.
@@ -49,8 +58,15 @@ has_lib() {
 	    echo "Please run ldconfig -r \"$CROSS_SYS_ROOT\" to generate ld.so.cache"
 	    # fall through; ldconfig test below should fail
 	fi
-	ldconfig -p ${CROSS_SYS_ROOT+-r "$CROSS_SYS_ROOT"} | grep -Fq "$1"
-	return $?
+	if [ "${OS}" = "Linux" ]; then
+		ldconfig -p ${CROSS_SYS_ROOT+-r "$CROSS_SYS_ROOT"} | grep -Fq "$1"
+		return $?
+	fi
+	if [ "${OS}" = "NetBSD" ]; then
+		ls -1 ${LIBRARIES} | grep -Fq "$1"
+		return $?
+	fi
+	return 1
 	)
 }

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1 of 2 v2] 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
  2011-10-18  9:29 ` [PATCH 1 of 2 v2] 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 Roger Pau Monne
@ 2011-11-14 18:17   ` Ian Jackson
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Jackson @ 2011-11-14 18:17 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel

Roger Pau Monne writes ("[Xen-devel] [PATCH 1 of 2 v2] 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"):
> 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.

Thanks, I applied this (after a build test).

Can you please next time keep your commit message within 70 columns,
including the summary line ?  I reformatted for you.

(Your code lines were quite long too but in general we seem to only
mind overly-long lines in some parts of the Xen tree.)

Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

Thanks,
Ian.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] tools/check: check for headers and libraries in user defined folders
  2011-10-25 16:37   ` [PATCH v3] " Roger Pau Monne
@ 2011-11-14 18:18     ` Ian Jackson
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Jackson @ 2011-11-14 18:18 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel

Roger Pau Monne writes ("[Xen-devel] [PATCH v3] tools/check: check for headers and libraries in user defined folders"):
> tools/check: check for headers and libraries in user defined folders.

Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-11-14 18:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-18  9:29 [PATCH 0 of 2 v2] tools: add two new compile flags and perform checks on user defined folders Roger Pau Monne
2011-10-18  9:29 ` [PATCH 1 of 2 v2] 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 Roger Pau Monne
2011-11-14 18:17   ` Ian Jackson
2011-10-18  9:29 ` [PATCH 2 of 2 v2] tools/check: check for headers and libraries in user defined folders Roger Pau Monne
2011-10-25 16:37   ` [PATCH v3] " Roger Pau Monne
2011-11-14 18:18     ` Ian Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).