18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci# Makefile for Hyper-V tools 38c2ecf20Sopenharmony_ciinclude ../scripts/Makefile.include 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_cisbindir ?= /usr/sbin 68c2ecf20Sopenharmony_cilibexecdir ?= /usr/libexec 78c2ecf20Sopenharmony_cisharedstatedir ?= /var/lib 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ciifeq ($(srctree),) 108c2ecf20Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(CURDIR))) 118c2ecf20Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(srctree))) 128c2ecf20Sopenharmony_ciendif 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci# Do not use make's built-in rules 158c2ecf20Sopenharmony_ci# (this improves performance and avoids hard-to-debug behaviour); 168c2ecf20Sopenharmony_ciMAKEFLAGS += -r 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_cioverride CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ciALL_TARGETS := hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon 218c2ecf20Sopenharmony_ciALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS)) 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ciALL_SCRIPTS := hv_get_dhcp_info.sh hv_get_dns_info.sh hv_set_ifconfig.sh 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ciall: $(ALL_PROGRAMS) 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ciexport srctree OUTPUT CC LD CFLAGS 288c2ecf20Sopenharmony_ciinclude $(srctree)/tools/build/Makefile.include 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ciHV_KVP_DAEMON_IN := $(OUTPUT)hv_kvp_daemon-in.o 318c2ecf20Sopenharmony_ci$(HV_KVP_DAEMON_IN): FORCE 328c2ecf20Sopenharmony_ci $(Q)$(MAKE) $(build)=hv_kvp_daemon 338c2ecf20Sopenharmony_ci$(OUTPUT)hv_kvp_daemon: $(HV_KVP_DAEMON_IN) 348c2ecf20Sopenharmony_ci $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ciHV_VSS_DAEMON_IN := $(OUTPUT)hv_vss_daemon-in.o 378c2ecf20Sopenharmony_ci$(HV_VSS_DAEMON_IN): FORCE 388c2ecf20Sopenharmony_ci $(Q)$(MAKE) $(build)=hv_vss_daemon 398c2ecf20Sopenharmony_ci$(OUTPUT)hv_vss_daemon: $(HV_VSS_DAEMON_IN) 408c2ecf20Sopenharmony_ci $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciHV_FCOPY_DAEMON_IN := $(OUTPUT)hv_fcopy_daemon-in.o 438c2ecf20Sopenharmony_ci$(HV_FCOPY_DAEMON_IN): FORCE 448c2ecf20Sopenharmony_ci $(Q)$(MAKE) $(build)=hv_fcopy_daemon 458c2ecf20Sopenharmony_ci$(OUTPUT)hv_fcopy_daemon: $(HV_FCOPY_DAEMON_IN) 468c2ecf20Sopenharmony_ci $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ciclean: 498c2ecf20Sopenharmony_ci rm -f $(ALL_PROGRAMS) 508c2ecf20Sopenharmony_ci find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ciinstall: $(ALL_PROGRAMS) 538c2ecf20Sopenharmony_ci install -d -m 755 $(DESTDIR)$(sbindir); \ 548c2ecf20Sopenharmony_ci install -d -m 755 $(DESTDIR)$(libexecdir)/hypervkvpd; \ 558c2ecf20Sopenharmony_ci install -d -m 755 $(DESTDIR)$(sharedstatedir); \ 568c2ecf20Sopenharmony_ci for program in $(ALL_PROGRAMS); do \ 578c2ecf20Sopenharmony_ci install $$program -m 755 $(DESTDIR)$(sbindir); \ 588c2ecf20Sopenharmony_ci done; \ 598c2ecf20Sopenharmony_ci install -m 755 lsvmbus $(DESTDIR)$(sbindir); \ 608c2ecf20Sopenharmony_ci for script in $(ALL_SCRIPTS); do \ 618c2ecf20Sopenharmony_ci install $$script -m 755 $(DESTDIR)$(libexecdir)/hypervkvpd/$${script%.sh}; \ 628c2ecf20Sopenharmony_ci done 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ciFORCE: 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci.PHONY: all install clean FORCE prepare 67