aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore/Makefile
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-04-09 13:27:33 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-04-09 13:27:33 +0100
commitdde3e02b70682bcf0eb724be0015e6605b3ac308 (patch)
tree1df0ccbbbfb0a4948c5f6cc94e490b58b6db33c6 /tools/xenstore/Makefile
parente90bc46da35791b3bcea890b64fc2eaec74f05be (diff)
downloadxen-dde3e02b70682bcf0eb724be0015e6605b3ac308.tar.gz
xen-dde3e02b70682bcf0eb724be0015e6605b3ac308.tar.bz2
xen-dde3e02b70682bcf0eb724be0015e6605b3ac308.zip
xenstore: support building the xenstore clients statically.
This removes threading from libxenstore.a (but not libxenstore.so) since pthreads is incompatible with static linking and none of the command line clients require threads anyway. It is now possible to build these utilities statically with a uclibc toolchain which is useful for small userspace utility domains. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/xenstore/Makefile')
-rw-r--r--tools/xenstore/Makefile20
1 files changed, 16 insertions, 4 deletions
diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile
index d0a0b518f1..b42e583118 100644
--- a/tools/xenstore/Makefile
+++ b/tools/xenstore/Makefile
@@ -24,8 +24,18 @@ XENSTORED_OBJS_$(CONFIG_NetBSD) = xenstored_netbsd.o
XENSTORED_OBJS += $(XENSTORED_OBJS_y)
+ifneq ($(XENSTORE_STATIC_CLIENTS),y)
+LIBXENSTORE := libxenstore.so
+else
+LIBXENSTORE := libxenstore.a
+$(CLIENTS) xenstore-control xenstore-ls: CFLAGS += -static
+endif
+
.PHONY: all
-all: libxenstore.so libxenstore.a xenstored $(CLIENTS) xs_tdb_dump xenstore-control xenstore-ls
+all: libxenstore.so libxenstore.a xenstored clients xs_tdb_dump
+
+.PHONY: clients
+clients: $(CLIENTS) xenstore-control xenstore-ls
ifeq ($(CONFIG_SunOS),y)
xenstored_probes.h: xenstored_probes.d
@@ -42,16 +52,16 @@ endif
xenstored: $(XENSTORED_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDFLAGS_libxenctrl) $(SOCKET_LIBS) -o $@
-$(CLIENTS): xenstore-%: xenstore_%.o libxenstore.so
+$(CLIENTS): xenstore-%: xenstore_%.o $(LIBXENSTORE)
$(CC) $(CFLAGS) $(LDFLAGS) $< -L. -lxenstore $(SOCKET_LIBS) -o $@
$(CLIENTS_OBJS): xenstore_%.o: xenstore_client.c
$(COMPILE.c) -DCLIENT_$(*F) -o $@ $<
-xenstore-control: xenstore_control.o libxenstore.so
+xenstore-control: xenstore_control.o $(LIBXENSTORE)
$(CC) $(CFLAGS) $(LDFLAGS) $< -L. -lxenstore $(SOCKET_LIBS) -o $@
-xenstore-ls: xsls.o libxenstore.so
+xenstore-ls: xsls.o $(LIBXENSTORE)
$(CC) $(CFLAGS) $(LDFLAGS) $< -L. -lxenstore $(SOCKET_LIBS) -o $@
xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o
@@ -62,6 +72,8 @@ libxenstore.so: libxenstore.so.$(MAJOR)
libxenstore.so.$(MAJOR): libxenstore.so.$(MAJOR).$(MINOR)
ln -sf $< $@
+xs.opic: CFLAGS += -DUSE_PTHREAD
+
libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic
$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread