tools/hv: add install target to Makefile
authorVitaly Kuznetsov <vkuznets@redhat.com>
Tue, 14 Nov 2017 20:15:33 +0000 (13:15 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2017 15:33:03 +0000 (16:33 +0100)
Makefiles usually come with 'install' target included so each distro
doesn't need to implement the procedure from scratch. Add it to tools/hv.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/hv/Makefile

index 31503819454d8debc3484792bf404c34924ee74e..1139d71fa0cf52aabf15cf2ff82bfe125529fb60 100644 (file)
@@ -7,9 +7,30 @@ CFLAGS = $(WARNINGS) -g $(shell getconf LFS_CFLAGS)
 
 CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include
 
-all: hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon
+sbindir ?= /usr/sbin
+libexecdir ?= /usr/libexec
+sharedstatedir ?= /var/lib
+
+ALL_PROGRAMS := hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon
+
+ALL_SCRIPTS := hv_get_dhcp_info.sh hv_get_dns_info.sh hv_set_ifconfig.sh
+
+all: $(ALL_PROGRAMS)
+
 %: %.c
        $(CC) $(CFLAGS) -o $@ $^
 
 clean:
        $(RM) hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon
+
+install: all
+       install -d -m 755 $(DESTDIR)$(sbindir); \
+       install -d -m 755 $(DESTDIR)$(libexecdir)/hypervkvpd; \
+       install -d -m 755 $(DESTDIR)$(sharedstatedir); \
+       for program in $(ALL_PROGRAMS); do \
+               install $$program -m 755 $(DESTDIR)$(sbindir);  \
+       done; \
+       install -m 755 lsvmbus $(DESTDIR)$(sbindir); \
+       for script in $(ALL_SCRIPTS); do \
+               install $$script -m 755 $(DESTDIR)$(libexecdir)/hypervkvpd/$${script%.sh}; \
+       done