1XEN_ROOT = $(CURDIR)/../../../..
2include $(XEN_ROOT)/tools/Rules.mk
3
4XEN_SYSTEMD_MODULES = xen.conf
5
6XEN_SYSTEMD_MOUNT =  proc-xen.mount
7XEN_SYSTEMD_MOUNT += var-lib-xenstored.mount
8
9XEN_SYSTEMD_SERVICE  = xenstored.service
10XEN_SYSTEMD_SERVICE += xenconsoled.service
11XEN_SYSTEMD_SERVICE += xen-qemu-dom0-disk-backend.service
12XEN_SYSTEMD_SERVICE += xendomains.service
13XEN_SYSTEMD_SERVICE += xen-watchdog.service
14XEN_SYSTEMD_SERVICE += xen-init-dom0.service
15XEN_SYSTEMD_SERVICE += xendriverdomain.service
16
17ALL_XEN_SYSTEMD =	$(XEN_SYSTEMD_MODULES)  \
18			$(XEN_SYSTEMD_MOUNT)	\
19			$(XEN_SYSTEMD_SERVICE)
20
21.PHONY: all
22all:	$(ALL_XEN_SYSTEMD)
23
24.PHONY: clean
25clean:
26	rm -f $(XEN_SYSTEMD_MODULES)
27
28.PHONY: distclean
29distclean: clean
30
31.PHONY: install
32install: $(ALL_XEN_SYSTEMD)
33	[ -d $(DESTDIR)$(XEN_SYSTEMD_DIR) ] || \
34		$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_DIR)
35	[ -d $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD) ] || \
36		$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
37	$(INSTALL_DATA) *.service $(DESTDIR)$(XEN_SYSTEMD_DIR)
38	$(INSTALL_DATA) *.mount $(DESTDIR)$(XEN_SYSTEMD_DIR)
39	$(INSTALL_DATA) *.conf $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
40
41.PHONY: uninstall
42uninstall:
43	rm -f $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)/*.conf
44	rm -f $(DESTDIR)$(XEN_SYSTEMD_DIR)/*.mount
45	rm -f $(DESTDIR)$(XEN_SYSTEMD_DIR)/*.service
46
47$(XEN_SYSTEMD_MODULES):
48	rm -f $@.tmp
49	for mod in $(LINUX_BACKEND_MODULES) ; do \
50		echo $$mod ; \
51		done > $@.tmp
52	$(call move-if-changed,$@.tmp,$@)
53