1XEN_ROOT = $(CURDIR)/../../..
2include $(XEN_ROOT)/tools/Rules.mk
3
4# Xen script dir and scripts to go there.
5XEN_SCRIPTS = vif-bridge
6XEN_SCRIPTS += vif-route
7XEN_SCRIPTS += vif-nat
8XEN_SCRIPTS += vif-openvswitch
9XEN_SCRIPTS += vif2
10XEN_SCRIPTS += vif-setup
11XEN_SCRIPTS-$(CONFIG_LIBNL) += remus-netbuf-setup
12XEN_SCRIPTS += block
13XEN_SCRIPTS += block-enbd block-nbd
14XEN_SCRIPTS += external-device-migrate
15XEN_SCRIPTS += vscsi
16XEN_SCRIPTS += block-iscsi
17XEN_SCRIPTS += block-tap
18XEN_SCRIPTS += block-drbd-probe
19XEN_SCRIPTS += block-dummy
20XEN_SCRIPTS += $(XEN_SCRIPTS-y)
21XEN_SCRIPTS += colo-proxy-setup
22XEN_SCRIPTS += launch-xenstore
23
24SUBDIRS-$(CONFIG_SYSTEMD) += systemd
25
26XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh
27XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh
28XEN_SCRIPT_DATA += block-common.sh
29
30.PHONY: all
31all: subdirs-all
32
33.PHONY: build
34build:
35
36.PHONY: install
37install: install-initd install-scripts subdirs-install
38
39.PHONY: uninstall
40uninstall: uninstall-initd uninstall-scripts subdirs-uninstall
41
42# See docs/misc/distro_mapping.txt for INITD_DIR location
43.PHONY: install-initd
44install-initd:
45	[ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
46	[ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR)
47	[ -d $(DESTDIR)$(LIBEXEC_BIN) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
48	$(INSTALL_DATA) init.d/sysconfig.xendomains $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
49	$(INSTALL_DATA) init.d/sysconfig.xencommons $(DESTDIR)$(SYSCONFIG_DIR)/xencommons
50	$(INSTALL_PROG) xendomains $(DESTDIR)$(LIBEXEC_BIN)
51	$(INSTALL_PROG) init.d/xendomains $(DESTDIR)$(INITD_DIR)
52	$(INSTALL_PROG) init.d/xencommons $(DESTDIR)$(INITD_DIR)
53	$(INSTALL_PROG) init.d/xendriverdomain $(DESTDIR)$(INITD_DIR)
54	$(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR)
55
56.PHONY: uninstall-initd
57uninstall-initd:
58	rm -f $(DESTDIR)$(INITD_DIR)/xen-watchdog
59	rm -f $(DESTDIR)$(INITD_DIR)/xendriverdomain
60	rm -f $(DESTDIR)$(INITD_DIR)/xencommons
61	rm -f $(DESTDIR)$(INITD_DIR)/xendomains
62	rm -f $(DESTDIR)$(LIBEXEC_BIN)/xendomains
63	rm -f $(DESTDIR)$(SYSCONFIG_DIR)/xencommons
64	rm -f $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
65
66.PHONY: install-scripts
67install-scripts:
68	[ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
69		$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
70	set -e; for i in $(XEN_SCRIPTS); \
71	    do \
72	    $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
73	done
74	set -e; for i in $(XEN_SCRIPT_DATA); \
75	    do \
76	    $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
77	done
78
79.PHONY: uninstall-scripts
80uninstall-scripts:
81	rm -f $(addprefix $(DESTDIR)$(XEN_SCRIPT_DIR)/, $(XEN_SCRIPTS))
82	rm -f $(addprefix $(DESTDIR)$(XEN_SCRIPT_DIR)/, $(XEN_SCRIPT_DATA))
83
84.PHONY: clean
85clean: subdirs-clean
86
87.PHONY: distclean
88distclean: clean
89