ia64/xen-unstable

view tools/examples/Makefile @ 7264:409cea2432fc

Add installation of the udev rules if appropriate. With a normal 'make
install', the udev rules will be installed if udev version is >= 059;
otherwise, the hotplug rules get installed.

When 'make dist' is done, we set a variable so that both hotplug and
udev rules are installed into the dist tarball. install.sh then takes
care of picking the proper rules.

Also changes the hotplug check to look for a proper udev version

Signed-off-by: Jeremy Katz <katzj@redhat.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Oct 07 14:47:45 2005 +0100 (2005-10-07)
parents 1b0dbfedc043
children 4e0c94871be2 0e7c48861e95
line source
1 XEN_ROOT = ../../
2 include $(XEN_ROOT)/tools/Rules.mk
4 INSTALL = install
5 INSTALL_DIR = $(INSTALL) -d -m0755
6 INSTALL_PROG = $(INSTALL) -m0755
7 INSTALL_DATA = $(INSTALL) -m0644
9 # Init scripts.
10 XEND_INITD = init.d/xend
11 XENDOMAINS_INITD = init.d/xendomains
13 # Xen configuration dir and configs to go there.
14 XEN_CONFIG_DIR = /etc/xen
15 XEN_CONFIGS = xend-config.sxp
16 XEN_CONFIGS += xmexample1
17 XEN_CONFIGS += xmexample2
18 XEN_CONFIGS += xmexample.vmx
20 # Xen script dir and scripts to go there.
21 XEN_SCRIPT_DIR = /etc/xen/scripts
22 XEN_SCRIPTS = network-bridge vif-bridge
23 XEN_SCRIPTS += network-route vif-route
24 XEN_SCRIPTS += network-nat vif-nat
25 XEN_SCRIPTS += block
26 XEN_SCRIPTS += block-enbd
28 XEN_HOTPLUG_DIR = /etc/hotplug
29 XEN_HOTPLUG_SCRIPTS = xen-backend.agent
31 UDEV_RULES_DIR = /etc/udev/rules.d
32 UDEV_RULES = xen-backend.rules
34 ifeq ($(findstring $(DISTDIR),$(DESTDIR)),$(DISTDIR))
35 HOTPLUGS=install-hotplug install-udev
36 else
37 ifeq ($(shell [ -x /sbin/udev ] && [ ! -z `udev -V` ] && [ `/sbin/udev -V` -ge 059 ] && echo 1),1)
38 HOTPLUGS=install-udev
39 else
40 HOTPLUGS=install-hotplug
41 endif
42 endif
44 all:
45 build:
47 install: all install-initd install-configs install-scripts $(HOTPLUGS)
49 install-initd:
50 [ -d $(DESTDIR)/etc/init.d ] || $(INSTALL_DIR) $(DESTDIR)/etc/init.d
51 $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)/etc/init.d
52 $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)/etc/init.d
54 install-configs: $(XEN_CONFIGS)
55 [ -d $(DESTDIR)$(XEN_CONFIG_DIR) ] || \
56 $(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR)
57 [ -d $(DESTDIR)$(XEN_CONFIG_DIR)/auto ] || \
58 $(INSTALL_DIR) $(DESTDIR)$(XEN_CONFIG_DIR)/auto
59 for i in $(XEN_CONFIGS); \
60 do [ -e $(DESTDIR)$(XEN_CONFIG_DIR)/$$i ] || \
61 $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_CONFIG_DIR); \
62 done
64 install-scripts:
65 [ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
66 $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
67 for i in $(XEN_SCRIPTS); \
68 do \
69 $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
70 done
72 install-hotplug:
73 [ -d $(DESTDIR)$(XEN_HOTPLUG_DIR) ] || \
74 $(INSTALL_DIR) $(DESTDIR)$(XEN_HOTPLUG_DIR)
75 for i in $(XEN_HOTPLUG_SCRIPTS); \
76 do \
77 $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_HOTPLUG_DIR); \
78 done
80 install-udev:
81 [ -d $(DESTDIR)$(UDEV_RULES_DIR) ] || \
82 $(INSTALL_DIR) $(DESTDIR)$(UDEV_RULES_DIR)
83 for i in $(UDEV_RULES); \
84 do \
85 $(INSTALL_PROG) $$i $(DESTDIR)$(UDEV_RULES_DIR); \
86 done
88 clean: