blob: b57143d9459c1176fd31389caedcb4907ff29087 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
Bjarke Istrup Pedersen3eb20942014-02-09 11:41:52 +00002# Makefile for Hyper-V tools
Andy Shevchenko9b543412019-08-19 15:41:00 +03003include ../scripts/Makefile.include
Kamal Mostafa50fe6dd2016-01-27 22:29:33 -08004
Vitaly Kuznetsov39b759c2017-11-14 13:15:33 -07005sbindir ?= /usr/sbin
6libexecdir ?= /usr/libexec
7sharedstatedir ?= /var/lib
8
Andy Shevchenko9b543412019-08-19 15:41:00 +03009ifeq ($(srctree),)
10srctree := $(patsubst %/,%,$(dir $(CURDIR)))
11srctree := $(patsubst %/,%,$(dir $(srctree)))
12endif
13
14# Do not use make's built-in rules
15# (this improves performance and avoids hard-to-debug behaviour);
16MAKEFLAGS += -r
17
18override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
19
20ALL_TARGETS := hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon
21ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
Vitaly Kuznetsov39b759c2017-11-14 13:15:33 -070022
23ALL_SCRIPTS := hv_get_dhcp_info.sh hv_get_dns_info.sh hv_set_ifconfig.sh
24
25all: $(ALL_PROGRAMS)
26
Andy Shevchenko9b543412019-08-19 15:41:00 +030027export srctree OUTPUT CC LD CFLAGS
28include $(srctree)/tools/build/Makefile.include
29
30HV_KVP_DAEMON_IN := $(OUTPUT)hv_kvp_daemon-in.o
31$(HV_KVP_DAEMON_IN): FORCE
32 $(Q)$(MAKE) $(build)=hv_kvp_daemon
33$(OUTPUT)hv_kvp_daemon: $(HV_KVP_DAEMON_IN)
34 $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
35
36HV_VSS_DAEMON_IN := $(OUTPUT)hv_vss_daemon-in.o
37$(HV_VSS_DAEMON_IN): FORCE
38 $(Q)$(MAKE) $(build)=hv_vss_daemon
39$(OUTPUT)hv_vss_daemon: $(HV_VSS_DAEMON_IN)
40 $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
41
42HV_FCOPY_DAEMON_IN := $(OUTPUT)hv_fcopy_daemon-in.o
43$(HV_FCOPY_DAEMON_IN): FORCE
44 $(Q)$(MAKE) $(build)=hv_fcopy_daemon
45$(OUTPUT)hv_fcopy_daemon: $(HV_FCOPY_DAEMON_IN)
46 $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
Bjarke Istrup Pedersen3eb20942014-02-09 11:41:52 +000047
48clean:
Andy Shevchenko9b543412019-08-19 15:41:00 +030049 rm -f $(ALL_PROGRAMS)
50 find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete
Vitaly Kuznetsov39b759c2017-11-14 13:15:33 -070051
Andy Shevchenko9b543412019-08-19 15:41:00 +030052install: $(ALL_PROGRAMS)
Vitaly Kuznetsov39b759c2017-11-14 13:15:33 -070053 install -d -m 755 $(DESTDIR)$(sbindir); \
54 install -d -m 755 $(DESTDIR)$(libexecdir)/hypervkvpd; \
55 install -d -m 755 $(DESTDIR)$(sharedstatedir); \
56 for program in $(ALL_PROGRAMS); do \
57 install $$program -m 755 $(DESTDIR)$(sbindir); \
58 done; \
59 install -m 755 lsvmbus $(DESTDIR)$(sbindir); \
60 for script in $(ALL_SCRIPTS); do \
61 install $$script -m 755 $(DESTDIR)$(libexecdir)/hypervkvpd/$${script%.sh}; \
62 done
Andy Shevchenko9b543412019-08-19 15:41:00 +030063
64FORCE:
65
66.PHONY: all install clean FORCE prepare