1XEN_ROOT=$(CURDIR)/../..
2include $(XEN_ROOT)/tools/Rules.mk
3
4CFLAGS  += -Werror
5
6CFLAGS  += $(CFLAGS_libxenctrl)
7CFLAGS  += $(CFLAGS_libxenstore)
8LDLIBS += $(LDLIBS_libxenctrl)
9LDLIBS += $(LDLIBS_libxenstore)
10LDLIBS += $(SOCKET_LIBS)
11
12LDLIBS_xenconsoled += $(UTIL_LIBS)
13LDLIBS_xenconsoled += -lrt
14CONSOLE_CFLAGS-$(CONFIG_ARM) = -DCONFIG_ARM
15
16BIN      = xenconsoled xenconsole
17
18.PHONY: all
19all: $(BIN)
20
21.PHONY: clean
22clean:
23	$(RM) *.a *.so *.o *.rpm $(BIN) $(DEPS_RM)
24	$(RM) client/*.o daemon/*.o
25	$(RM) client/_paths.h
26	$(RM) daemon/_paths.h
27
28.PHONY: distclean
29distclean: clean
30
31daemon/main.o: daemon/_paths.h
32daemon/io.o: CFLAGS += $(CFLAGS_libxenevtchn) $(CFLAGS_libxengnttab) $(CONSOLE_CFLAGS-y)
33xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c))
34	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_libxenevtchn) $(LDLIBS_libxengnttab) $(LDLIBS_xenconsoled) $(APPEND_LDFLAGS)
35
36client/main.o: client/_paths.h
37xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c))
38	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_xenconsole) $(APPEND_LDFLAGS)
39
40genpath-target = $(call buildmakevars2header,client/_paths.h)
41$(eval $(genpath-target))
42
43genpath-target = $(call buildmakevars2header,daemon/_paths.h)
44$(eval $(genpath-target))
45
46.PHONY: install
47install: $(BIN)
48	$(INSTALL_DIR) $(DESTDIR)/$(sbindir)
49	$(INSTALL_PROG) xenconsoled $(DESTDIR)/$(sbindir)
50	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
51	$(INSTALL_PROG) xenconsole $(DESTDIR)$(LIBEXEC_BIN)
52
53.PHONY: uninstall
54uninstall:
55	rm -f $(DESTDIR)$(LIBEXEC_BIN)/xenconsole
56	rm -f $(DESTDIR)$(sbindir)/xenconsoled
57
58-include $(DEPS_INCLUDE)
59