ia64/xen-unstable

view tools/xenstore/Makefile @ 10911:8f452e26224a

[TOOLS] Modify xenstore_client.c to include a new utility, xenstore-chmod.
This utility permits developers and administrators to
manually change the permissions on arbitrary locations in XenStore
from the command line. This is often helpful if you're trying to debug an
application that relies on XenStore and is encountering difficulties
with permissions.

Signed-off-by: Michael LeMay <mdlemay@epoch.ncsc.mil>
author kfraser@localhost.localdomain
date Wed Aug 02 14:58:37 2006 +0100 (2006-08-02)
parents d323acca28a2
children 7ed73735fd30
line source
1 XEN_ROOT=../..
2 include $(XEN_ROOT)/tools/Rules.mk
3 XEN_LIBXC = $(XEN_ROOT)/tools/libxc
5 MAJOR = 3.0
6 MINOR = 0
8 INSTALL = install
9 INSTALL_DATA = $(INSTALL) -m0644
10 INSTALL_PROG = $(INSTALL) -m0755
11 INSTALL_DIR = $(INSTALL) -d -m0755
13 PROFILE=#-pg
14 BASECFLAGS=-Wall -g -Werror
15 # Make gcc generate dependencies.
16 BASECFLAGS += -Wp,-MD,.$(@F).d
17 PROG_DEP = .*.d
18 BASECFLAGS+= $(PROFILE)
19 #BASECFLAGS+= -I$(XEN_ROOT)/tools
20 BASECFLAGS+= -I$(XEN_ROOT)/tools/libxc
21 BASECFLAGS+= -I.
23 CFLAGS += $(BASECFLAGS)
24 LDFLAGS += $(PROFILE) -L$(XEN_LIBXC)
25 TESTDIR = testsuite/tmp
26 TESTFLAGS= -DTESTING
27 TESTENV = XENSTORED_ROOTDIR=$(TESTDIR) XENSTORED_RUNDIR=$(TESTDIR)
29 CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod
30 CLIENTS += xenstore-write
31 CLIENTS_OBJS := $(patsubst xenstore-%,xenstore_%.o,$(CLIENTS))
33 XENSTORED_OBJS = xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o tdb.o hashtable.o
35 XENSTORED_Linux = xenstored_linux.o
37 XENSTORED_OBJS += $(XENSTORED_$(OS))
39 .PHONY: all
40 all: libxenstore.so libxenstore.a xenstored $(CLIENTS) xs_tdb_dump xenstore-control xenstore-ls
42 test_interleaved_transactions: test_interleaved_transactions.o
43 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -L. -lxenstore -o $@
45 .PHONY: testcode
46 testcode: xs_test xenstored_test xs_random
48 xenstored: $(XENSTORED_OBJS)
49 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -o $@
51 $(CLIENTS): xenstore-%: xenstore_%.o libxenstore.so
52 $(LINK.o) $< $(LOADLIBES) $(LDLIBS) -L. -lxenstore -o $@
54 $(CLIENTS_OBJS): xenstore_%.o: xenstore_client.c
55 $(COMPILE.c) -DCLIENT_$(*F) -o $@ $<
57 xenstore-control: xenstore_control.o libxenstore.so
58 $(LINK.o) $< $(LOADLIBES) $(LDLIBS) -L. -lxenstore -o $@
60 xenstore-ls: xsls.o libxenstore.so
61 $(LINK.o) $< $(LOADLIBES) $(LDLIBS) -L. -lxenstore -o $@
63 xenstored_test: xenstored_core_test.o xenstored_watch_test.o xenstored_domain_test.o xenstored_transaction_test.o xs_lib.o talloc_test.o fake_libxc.o utils.o tdb.o
64 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
66 xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o
67 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
69 xs_test xs_random xs_stress xs_crashme: LDFLAGS+=-lpthread
70 xs_test: xs_test.o xs_lib.o utils.o
71 xs_random: xs_random.o xs_test_lib.o xs_lib.o talloc.o utils.o
72 xs_stress: xs_stress.o xs_test_lib.o xs_lib.o talloc.o utils.o
73 xs_crashme: xs_crashme.o xs_lib.o talloc.o utils.o
75 speedtest: speedtest.o xs.o xs_lib.o utils.o talloc.o
77 .PHONY: check-speed
78 check-speed: speedtest xenstored_test $(TESTDIR)
79 $(TESTENV) time ./speedtest 100
81 xs_test.o xs_stress.o xenstored_core_test.o xenstored_watch_test.o xenstored_transaction_test.o xenstored_domain_test.o xs_random.o xs_test_lib.o talloc_test.o fake_libxc.o xs_crashme.o: CFLAGS=$(BASECFLAGS) $(TESTFLAGS)
83 xenstored_%_test.o: xenstored_%.c
84 $(COMPILE.c) -o $@ $<
86 xs_test_lib.o: xs.c
87 $(COMPILE.c) -o $@ $<
89 talloc_test.o: talloc.c
90 $(COMPILE.c) -o $@ $<
92 libxenstore.so: libxenstore.so.$(MAJOR)
93 ln -sf $< $@
94 libxenstore.so.$(MAJOR): libxenstore.so.$(MAJOR).$(MINOR)
95 ln -sf $< $@
97 libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic
98 $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenstore.so.$(MAJOR) -shared -o $@ $^ -lpthread
100 libxenstore.a: xs.o xs_lib.o
101 ar rcs libxenstore.a $^
103 .PHONY: clean
104 clean: testsuite-clean
105 rm -f *.a *.o *.opic *.so*
106 rm -f xenstored xs_random xs_stress xs_crashme
107 rm -f xs_test xenstored_test xs_tdb_dump xenstore-control xenstore-ls
108 rm -f $(CLIENTS)
109 $(RM) $(PROG_DEP)
111 .PHONY: print-dir
112 print-dir:
113 @echo -n tools/xenstore:
115 .PHONY: print-end
116 print-end:
117 @echo
119 .PHONY: check
120 check: print-dir testsuite-fast randomcheck-fast print-end
122 .PHONY: fullcheck
123 fullcheck: testsuite-run randomcheck stresstest
125 $(TESTDIR):
126 mkdir $@
128 .PHONY: testsuite-run
129 testsuite-run: xenstored_test xs_test $(TESTDIR)
130 $(TESTENV) testsuite/test.sh && echo
132 .PHONY: testsuite-fast
133 testsuite-fast: xenstored_test xs_test $(TESTDIR)
134 @$(TESTENV) testsuite/test.sh --fast
136 .PHONY: testsuite-clean
137 testsuite-clean:
138 rm -rf $(TESTDIR)
140 # Make this visible so they can see repeat tests without --fast if they
141 # fail.
142 RANDSEED=$(shell date +%s)
143 .PHONY: randomcheck
144 randomcheck: xs_random xenstored_test $(TESTDIR)
145 $(TESTENV) ./xs_random --simple --fast /tmp/xs_random 200000 $(RANDSEED) && echo
146 $(TESTENV) ./xs_random --fast /tmp/xs_random 100000 $(RANDSEED) && echo
147 # $(TESTENV) ./xs_random --fail /tmp/xs_random 10000 $(RANDSEED)
149 .PHONY: crashme
150 crashme: xs_crashme xenstored_test $(TESTDIR)
151 rm -rf $(TESTDIR)/store $(TESTDIR)/transactions /tmp/xs_crashme.vglog* /tmp/trace
152 export $(TESTENV); ./xs_crashme 5000 $(RANDSEED) 2>/dev/null
153 if [ -n "`cat /tmp/xs_crashme.vglog*`" ]; then echo Valgrind complained; cat /tmp/xs_crashme.vglog*; exit 1; fi
154 rm -rf $(TESTDIR)/store $(TESTDIR)/transactions /tmp/xs_crashme.vglog* /tmp/trace
156 .PHONY: randomcheck-fast
157 randomcheck-fast: xs_random xenstored_test $(TESTDIR)
158 @$(TESTENV) ./xs_random --fast /tmp/xs_random 2000 $(RANDSEED)
160 .PHONY: stresstest
161 stresstest: xs_stress xenstored_test $(TESTDIR)
162 rm -rf $(TESTDIR)/store $(TESTDIR)/transactions
163 export $(TESTENV); PID=`./xenstored_test --output-pid --trace-file=/tmp/trace`; ./xs_stress 5000; ret=$$?; kill $$PID; exit $$ret
165 .PHONY: TAGS
166 TAGS:
167 etags `find . -name '*.[ch]'`
169 .PHONY: tarball
170 tarball: clean
171 cd .. && tar -c -j -v -h -f xenstore.tar.bz2 xenstore/
173 .PHONY: install
174 install: all
175 $(INSTALL_DIR) -p $(DESTDIR)/var/run/xenstored
176 $(INSTALL_DIR) -p $(DESTDIR)/var/lib/xenstored
177 $(INSTALL_DIR) -p $(DESTDIR)/usr/bin
178 $(INSTALL_DIR) -p $(DESTDIR)/usr/sbin
179 $(INSTALL_DIR) -p $(DESTDIR)/usr/include
180 $(INSTALL_PROG) xenstored $(DESTDIR)/usr/sbin
181 $(INSTALL_PROG) $(CLIENTS) $(DESTDIR)/usr/bin
182 $(INSTALL_PROG) xenstore-control $(DESTDIR)/usr/bin
183 $(INSTALL_PROG) xenstore-ls $(DESTDIR)/usr/bin
184 $(INSTALL_DIR) -p $(DESTDIR)/usr/$(LIBDIR)
185 $(INSTALL_PROG) libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
186 ln -sf libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenstore.so.$(MAJOR)
187 ln -sf libxenstore.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenstore.so
188 $(INSTALL_DATA) libxenstore.a $(DESTDIR)/usr/$(LIBDIR)
189 $(INSTALL_DATA) xs.h $(DESTDIR)/usr/include
190 $(INSTALL_DATA) xs_lib.h $(DESTDIR)/usr/include
192 -include $(PROG_DEP)
194 # never delete any intermediate files.
195 .SECONDARY: