Merge branch 'regulator-5.4' into regulator-linus
[platform/kernel/linux-rpi.git] / tools / hv / Makefile
1 # SPDX-License-Identifier: GPL-2.0
2 # Makefile for Hyper-V tools
3 include ../scripts/Makefile.include
4
5 sbindir ?= /usr/sbin
6 libexecdir ?= /usr/libexec
7 sharedstatedir ?= /var/lib
8
9 ifeq ($(srctree),)
10 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
11 srctree := $(patsubst %/,%,$(dir $(srctree)))
12 endif
13
14 # Do not use make's built-in rules
15 # (this improves performance and avoids hard-to-debug behaviour);
16 MAKEFLAGS += -r
17
18 override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
19
20 ALL_TARGETS := hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon
21 ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
22
23 ALL_SCRIPTS := hv_get_dhcp_info.sh hv_get_dns_info.sh hv_set_ifconfig.sh
24
25 all: $(ALL_PROGRAMS)
26
27 export srctree OUTPUT CC LD CFLAGS
28 include $(srctree)/tools/build/Makefile.include
29
30 HV_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
36 HV_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
42 HV_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 $@
47
48 clean:
49         rm -f $(ALL_PROGRAMS)
50         find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete
51
52 install: $(ALL_PROGRAMS)
53         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
63
64 FORCE:
65
66 .PHONY: all install clean FORCE prepare