ia64/xen-unstable

view tools/xenstore/Makefile @ 6689:7d0fb56b4a91

merge?
author cl349@firebug.cl.cam.ac.uk
date Wed Sep 07 19:01:31 2005 +0000 (2005-09-07)
parents 38c5199155fc 534671924039
children b2f4823b6ff0 282d5698ea40 4d899a738d59 e7c7196fa329
line source
1 XEN_ROOT=../..
2 include $(XEN_ROOT)/tools/Rules.mk
3 XEN_LIBXC = $(XEN_ROOT)/tools/libxc
5 INSTALL = install
6 INSTALL_DATA = $(INSTALL) -m0644
7 INSTALL_PROG = $(INSTALL) -m0755
8 INSTALL_DIR = $(INSTALL) -d -m0755
10 PROFILE=#-pg
11 BASECFLAGS=-Wall -W -g -Werror
12 # Make gcc generate dependencies.
13 BASECFLAGS += -Wp,-MD,.$(@F).d
14 PROG_DEP = .*.d
15 BASECFLAGS+= -O3 $(PROFILE)
16 #BASECFLAGS+= -I$(XEN_ROOT)/tools
17 BASECFLAGS+= -I$(XEN_ROOT)/tools/libxc
18 BASECFLAGS+= -I$(XEN_ROOT)/xen/include/public
19 BASECFLAGS+= -I.
20 BASECFLAGS+= -I$(XEN_ROOT)/linux-2.6-xen-sparse/include/asm-xen/linux-public
22 CFLAGS += $(BASECFLAGS)
23 LDFLAGS += $(PROFILE) -L$(XEN_LIBXC)
24 TESTDIR = `pwd`/testsuite/tmp
25 TESTFLAGS= -DTESTING
26 TESTENV = XENSTORED_ROOTDIR=$(TESTDIR) XENSTORED_RUNDIR=$(TESTDIR)
28 CLIENTS := xenstore-read xenstore-rm xenstore-write
29 CLIENTS_OBJS := $(patsubst xenstore-%,xenstore_%.o,$(CLIENTS))
31 all: libxenstore.so xenstored $(CLIENTS)
33 testcode: xs_test xenstored_test xs_random xs_dom0_test
35 xenstored: xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o
36 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -o $@
38 $(CLIENTS): libxenstore.so
39 $(CLIENTS): xenstore-%: xenstore_%.o
40 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -L. -lxenstore -o $@
42 $(CLIENTS_OBJS): xenstore_%.o: xenstore_client.c
43 $(COMPILE.c) -DCLIENT_$(*F) -o $@ $<
45 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
46 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
48 xs_test: xs_test.o xs_lib.o utils.o
49 xs_random: xs_random.o xs_test_lib.o xs_lib.o talloc.o utils.o
50 xs_stress: xs_stress.o xs_test_lib.o xs_lib.o talloc.o utils.o
51 xs_crashme: xs_crashme.o xs_lib.o talloc.o utils.o
53 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)
55 xenstored_%_test.o: xenstored_%.c
56 $(COMPILE.c) -o $@ $<
58 xs_test_lib.o: xs.c
59 $(COMPILE.c) -o $@ $<
61 talloc_test.o: talloc.c
62 $(COMPILE.c) -o $@ $<
64 libxenstore.so: xs.opic xs_lib.opic
65 $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenstore.so -shared -o $@ $^
67 clean: testsuite-clean
68 rm -f *.o *.opic *.so
69 rm -f xenstored xs_random xs_stress xs_crashme
70 rm -f xs_test xenstored_test xs_dom0_test
71 $(RM) $(PROG_DEP)
73 print-dir:
74 @echo -n tools/xenstore:
76 print-end:
77 @echo
79 check: print-dir testsuite-fast randomcheck-fast print-end
81 fullcheck: testsuite-run randomcheck stresstest
83 testsuite-run: xenstored_test xs_test
84 $(TESTENV) testsuite/test.sh && echo
86 testsuite-fast: xenstored_test xs_test
87 @$(TESTENV) testsuite/test.sh --fast
89 testsuite-clean:
90 rm -rf $(TESTDIR)
92 # Make this visible so they can see repeat tests without --fast if they
93 # fail.
94 RANDSEED=$(shell date +%s)
95 randomcheck: xs_random xenstored_test
96 $(TESTENV) ./xs_random --simple --fast /tmp/xs_random 200000 $(RANDSEED) && echo
97 $(TESTENV) ./xs_random --fast /tmp/xs_random 100000 $(RANDSEED) && echo
98 $(TESTENV) ./xs_random --fail /tmp/xs_random 10000 $(RANDSEED)
100 crashme: xs_crashme xenstored_test
101 rm -rf $(TESTDIR)/store $(TESTDIR)/transactions /tmp/xs_crashme.vglog* /tmp/trace
102 export $(TESTENV); ./xs_crashme 5000 $(RANDSEED) 2>/dev/null
103 if [ -n "`cat /tmp/xs_crashme.vglog*`" ]; then echo Valgrind complained; cat /tmp/xs_crashme.vglog*; exit 1; fi
104 rm -rf $(TESTDIR)/store $(TESTDIR)/transactions /tmp/xs_crashme.vglog* /tmp/trace
106 randomcheck-fast: xs_random xenstored_test
107 @$(TESTENV) ./xs_random --fast /tmp/xs_random 2000 $(RANDSEED)
109 stresstest: xs_stress xenstored_test
110 rm -rf $(TESTDIR)/store $(TESTDIR)/transactions
111 export $(TESTENV); PID=`./xenstored_test --output-pid --trace-file=/tmp/trace`; ./xs_stress 5000; ret=$$?; kill $$PID; exit $$ret
113 xs_dom0_test: xs_dom0_test.o utils.o
114 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -o $@
116 TAGS:
117 etags `find . -name '*.[ch]'`
119 tarball: clean
120 cd .. && tar -c -j -v -h -f xenstore.tar.bz2 xenstore/
122 install: libxenstore.so xenstored $(CLIENTS)
123 $(INSTALL_DIR) -p $(DESTDIR)/var/run/xenstored
124 $(INSTALL_DIR) -p $(DESTDIR)/var/lib/xenstored
125 $(INSTALL_DIR) -p $(DESTDIR)/usr/bin
126 $(INSTALL_DIR) -p $(DESTDIR)/usr/sbin
127 $(INSTALL_DIR) -p $(DESTDIR)/usr/include
128 $(INSTALL_PROG) xenstored $(DESTDIR)/usr/sbin
129 $(INSTALL_PROG) $(CLIENTS) $(DESTDIR)/usr/bin
130 $(INSTALL_DIR) -p $(DESTDIR)/usr/$(LIBDIR)
131 $(INSTALL_DATA) libxenstore.so $(DESTDIR)/usr/$(LIBDIR)
132 $(INSTALL_DATA) xs.h $(DESTDIR)/usr/include
133 $(INSTALL_DATA) xs_lib.h $(DESTDIR)/usr/include
135 -include $(PROG_DEP)
137 # never delete any intermediate files.
138 .SECONDARY: