18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ciinclude ../../scripts/Makefile.include
38c2ecf20Sopenharmony_ciinclude ../../scripts/utilities.mak
48c2ecf20Sopenharmony_ciBINDIR=usr/bin
58c2ecf20Sopenharmony_ciMANDIR=usr/share/man
68c2ecf20Sopenharmony_ciMAN1DIR=$(MANDIR)/man1
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ciMAN1=kvm_stat.1
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciA2X=a2x
118c2ecf20Sopenharmony_cia2x_path := $(call get-executable,$(A2X))
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciall: man
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciifneq ($(findstring $(MAKEFLAGS),s),s)
168c2ecf20Sopenharmony_ci  ifneq ($(V),1)
178c2ecf20Sopenharmony_ci     QUIET_A2X = @echo '  A2X     '$@;
188c2ecf20Sopenharmony_ci  endif
198c2ecf20Sopenharmony_ciendif
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci%.1: %.txt
228c2ecf20Sopenharmony_ciifeq ($(a2x_path),)
238c2ecf20Sopenharmony_ci	$(error "You need to install asciidoc for man pages")
248c2ecf20Sopenharmony_cielse
258c2ecf20Sopenharmony_ci	$(QUIET_A2X)$(A2X) --doctype manpage --format manpage $<
268c2ecf20Sopenharmony_ciendif
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciclean:
298c2ecf20Sopenharmony_ci	rm -f $(MAN1)
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciman: $(MAN1)
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ciinstall-man: man
348c2ecf20Sopenharmony_ci	install -d -m 755 $(INSTALL_ROOT)/$(MAN1DIR)
358c2ecf20Sopenharmony_ci	install -m 644 kvm_stat.1 $(INSTALL_ROOT)/$(MAN1DIR)
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciinstall-tools:
388c2ecf20Sopenharmony_ci	install -d -m 755 $(INSTALL_ROOT)/$(BINDIR)
398c2ecf20Sopenharmony_ci	install -m 755 -p "kvm_stat" "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciinstall: install-tools install-man
428c2ecf20Sopenharmony_ci.PHONY: all clean man install-tools install-man install
43