162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ciinclude ../../scripts/Makefile.include
362306a36Sopenharmony_ciinclude ../../scripts/utilities.mak
462306a36Sopenharmony_ciBINDIR=usr/bin
562306a36Sopenharmony_ciMANDIR=usr/share/man
662306a36Sopenharmony_ciMAN1DIR=$(MANDIR)/man1
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciMAN1=kvm_stat.1
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciA2X=a2x
1162306a36Sopenharmony_cia2x_path := $(call get-executable,$(A2X))
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciall: man
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciifneq ($(findstring $(MAKEFLAGS),s),s)
1662306a36Sopenharmony_ci  ifneq ($(V),1)
1762306a36Sopenharmony_ci     QUIET_A2X = @echo '  A2X     '$@;
1862306a36Sopenharmony_ci  endif
1962306a36Sopenharmony_ciendif
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci%.1: %.txt
2262306a36Sopenharmony_ciifeq ($(a2x_path),)
2362306a36Sopenharmony_ci	$(error "You need to install asciidoc for man pages")
2462306a36Sopenharmony_cielse
2562306a36Sopenharmony_ci	$(QUIET_A2X)$(A2X) --doctype manpage --format manpage $<
2662306a36Sopenharmony_ciendif
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciclean:
2962306a36Sopenharmony_ci	rm -f $(MAN1)
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciman: $(MAN1)
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciinstall-man: man
3462306a36Sopenharmony_ci	install -d -m 755 $(INSTALL_ROOT)/$(MAN1DIR)
3562306a36Sopenharmony_ci	install -m 644 kvm_stat.1 $(INSTALL_ROOT)/$(MAN1DIR)
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ciinstall-tools:
3862306a36Sopenharmony_ci	install -d -m 755 $(INSTALL_ROOT)/$(BINDIR)
3962306a36Sopenharmony_ci	install -m 755 -p "kvm_stat" "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ciinstall: install-tools install-man
4262306a36Sopenharmony_ci.PHONY: all clean man install-tools install-man install
43