1XEN_ROOT=$(CURDIR)/../..
2include $(XEN_ROOT)/tools/Rules.mk
3
4CFLAGS += -Werror
5
6CFLAGS += $(CFLAGS_libxenevtchn)
7CFLAGS += $(CFLAGS_libxenctrl)
8LDLIBS += $(LDLIBS_libxenevtchn)
9LDLIBS += $(LDLIBS_libxenctrl)
10LDLIBS += $(ARGP_LDFLAGS)
11
12BIN      = xenalyze
13SBIN     = xentrace xentrace_setsize
14LIBBIN   = xenctx
15SCRIPTS  = xentrace_format
16
17.PHONY: all
18all: build
19
20.PHONY: build
21build: $(BIN) $(SBIN) $(LIBBIN)
22
23.PHONY: install
24install: build
25	$(INSTALL_DIR) $(DESTDIR)$(bindir)
26	$(INSTALL_DIR) $(DESTDIR)$(sbindir)
27	[ -z "$(LIBBIN)" ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
28ifneq ($(BIN),)
29	$(INSTALL_PROG) $(BIN) $(DESTDIR)$(bindir)
30endif
31	$(INSTALL_PROG) $(SBIN) $(DESTDIR)$(sbindir)
32	$(INSTALL_PYTHON_PROG) $(SCRIPTS) $(DESTDIR)$(bindir)
33	[ -z "$(LIBBIN)" ] || $(INSTALL_PROG) $(LIBBIN) $(DESTDIR)$(LIBEXEC_BIN)
34
35.PHONY: uninstall
36uninstall:
37	rm -f $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/, $(LIBBIN))
38	rm -f $(addprefix $(DESTDIR)$(bindir)/, $(SCRIPTS))
39	rm -f $(addprefix $(DESTDIR)$(sbindir)/, $(SBIN))
40ifneq ($(BIN),)
41	rm -f $(addprefix $(DESTDIR)$(bindir)/, $(BIN))
42endif
43
44.PHONY: clean
45clean:
46	$(RM) *.a *.so *.o *.rpm $(BIN) $(SBIN) $(LIBBIN) $(DEPS_RM)
47
48.PHONY: distclean
49distclean: clean
50
51xentrace: xentrace.o
52	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS)
53
54xenctx: xenctx.o
55	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS)
56
57xentrace_setsize: setsize.o
58	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS)
59
60xenalyze: xenalyze.o mread.o
61	$(CC) $(LDFLAGS) -o $@ $^ $(ARGP_LDFLAGS) $(APPEND_LDFLAGS)
62
63-include $(DEPS_INCLUDE)
64
65