Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Bjarke Istrup Pedersen | 3eb2094 | 2014-02-09 11:41:52 +0000 | [diff] [blame] | 2 | # Makefile for Hyper-V tools |
Andy Shevchenko | 9b54341 | 2019-08-19 15:41:00 +0300 | [diff] [blame] | 3 | include ../scripts/Makefile.include |
Kamal Mostafa | 50fe6dd | 2016-01-27 22:29:33 -0800 | [diff] [blame] | 4 | |
Vitaly Kuznetsov | 39b759c | 2017-11-14 13:15:33 -0700 | [diff] [blame] | 5 | sbindir ?= /usr/sbin |
| 6 | libexecdir ?= /usr/libexec |
| 7 | sharedstatedir ?= /var/lib |
| 8 | |
Andy Shevchenko | 9b54341 | 2019-08-19 15:41:00 +0300 | [diff] [blame] | 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)) |
Vitaly Kuznetsov | 39b759c | 2017-11-14 13:15:33 -0700 | [diff] [blame] | 22 | |
| 23 | ALL_SCRIPTS := hv_get_dhcp_info.sh hv_get_dns_info.sh hv_set_ifconfig.sh |
| 24 | |
| 25 | all: $(ALL_PROGRAMS) |
| 26 | |
Andy Shevchenko | 9b54341 | 2019-08-19 15:41:00 +0300 | [diff] [blame] | 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 $@ |
Bjarke Istrup Pedersen | 3eb2094 | 2014-02-09 11:41:52 +0000 | [diff] [blame] | 47 | |
| 48 | clean: |
Andy Shevchenko | 9b54341 | 2019-08-19 15:41:00 +0300 | [diff] [blame] | 49 | rm -f $(ALL_PROGRAMS) |
| 50 | find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete |
Vitaly Kuznetsov | 39b759c | 2017-11-14 13:15:33 -0700 | [diff] [blame] | 51 | |
Andy Shevchenko | 9b54341 | 2019-08-19 15:41:00 +0300 | [diff] [blame] | 52 | install: $(ALL_PROGRAMS) |
Vitaly Kuznetsov | 39b759c | 2017-11-14 13:15:33 -0700 | [diff] [blame] | 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 |
Andy Shevchenko | 9b54341 | 2019-08-19 15:41:00 +0300 | [diff] [blame] | 63 | |
| 64 | FORCE: |
| 65 | |
| 66 | .PHONY: all install clean FORCE prepare |