xref: /linux/Documentation/tools/rv/Makefile (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
1*afc70ccbSDaniel Bristot de Oliveira# SPDX-License-Identifier: GPL-2.0-only
2*afc70ccbSDaniel Bristot de Oliveira
3*afc70ccbSDaniel Bristot de OliveiraINSTALL		?= install
4*afc70ccbSDaniel Bristot de OliveiraRM		?= rm -f
5*afc70ccbSDaniel Bristot de OliveiraRMDIR		?= rmdir --ignore-fail-on-non-empty
6*afc70ccbSDaniel Bristot de Oliveira
7*afc70ccbSDaniel Bristot de OliveiraPREFIX		?= /usr/share
8*afc70ccbSDaniel Bristot de OliveiraMANDIR		?= $(PREFIX)/man
9*afc70ccbSDaniel Bristot de OliveiraMAN1DIR		= $(MANDIR)/man1
10*afc70ccbSDaniel Bristot de Oliveira
11*afc70ccbSDaniel Bristot de OliveiraMAN1_RST	= $(wildcard rv*.rst)
12*afc70ccbSDaniel Bristot de Oliveira
13*afc70ccbSDaniel Bristot de Oliveira_DOC_MAN1	= $(patsubst %.rst,%.1,$(MAN1_RST))
14*afc70ccbSDaniel Bristot de OliveiraDOC_MAN1	= $(addprefix $(OUTPUT),$(_DOC_MAN1))
15*afc70ccbSDaniel Bristot de Oliveira
16*afc70ccbSDaniel Bristot de OliveiraRST2MAN_DEP	:= $(shell command -v rst2man 2>/dev/null)
17*afc70ccbSDaniel Bristot de OliveiraRST2MAN_OPTS	+= --verbose
18*afc70ccbSDaniel Bristot de Oliveira
19*afc70ccbSDaniel Bristot de OliveiraTEST_RST2MAN = $(shell sh -c "rst2man --version > /dev/null 2>&1 || echo n")
20*afc70ccbSDaniel Bristot de Oliveira
21*afc70ccbSDaniel Bristot de Oliveira$(OUTPUT)%.1: %.rst
22*afc70ccbSDaniel Bristot de Oliveiraifndef RST2MAN_DEP
23*afc70ccbSDaniel Bristot de Oliveira	$(info ********************************************)
24*afc70ccbSDaniel Bristot de Oliveira	$(info ** NOTICE: rst2man not found)
25*afc70ccbSDaniel Bristot de Oliveira	$(info **)
26*afc70ccbSDaniel Bristot de Oliveira	$(info ** Consider installing the latest rst2man from your)
27*afc70ccbSDaniel Bristot de Oliveira	$(info ** distribution, e.g., 'dnf install python3-docutils' on Fedora,)
28*afc70ccbSDaniel Bristot de Oliveira	$(info ** or from source:)
29*afc70ccbSDaniel Bristot de Oliveira	$(info **)
30*afc70ccbSDaniel Bristot de Oliveira	$(info **  https://docutils.sourceforge.io/docs/dev/repository.html )
31*afc70ccbSDaniel Bristot de Oliveira	$(info **)
32*afc70ccbSDaniel Bristot de Oliveira	$(info ********************************************)
33*afc70ccbSDaniel Bristot de Oliveira	$(error NOTICE: rst2man required to generate man pages)
34*afc70ccbSDaniel Bristot de Oliveiraendif
35*afc70ccbSDaniel Bristot de Oliveira	rst2man $(RST2MAN_OPTS) $< > $@
36*afc70ccbSDaniel Bristot de Oliveira
37*afc70ccbSDaniel Bristot de Oliveiraman1: $(DOC_MAN1)
38*afc70ccbSDaniel Bristot de Oliveiraman: man1
39*afc70ccbSDaniel Bristot de Oliveira
40*afc70ccbSDaniel Bristot de Oliveiraclean:
41*afc70ccbSDaniel Bristot de Oliveira	$(RM) $(DOC_MAN1)
42*afc70ccbSDaniel Bristot de Oliveira
43*afc70ccbSDaniel Bristot de Oliveirainstall: man
44*afc70ccbSDaniel Bristot de Oliveira	$(INSTALL) -d -m 755 $(DESTDIR)$(MAN1DIR)
45*afc70ccbSDaniel Bristot de Oliveira	$(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(MAN1DIR)
46*afc70ccbSDaniel Bristot de Oliveira
47*afc70ccbSDaniel Bristot de Oliveirauninstall:
48*afc70ccbSDaniel Bristot de Oliveira	$(RM) $(addprefix $(DESTDIR)$(MAN1DIR)/,$(_DOC_MAN1))
49*afc70ccbSDaniel Bristot de Oliveira	$(RMDIR) $(DESTDIR)$(MAN1DIR)
50*afc70ccbSDaniel Bristot de Oliveira
51*afc70ccbSDaniel Bristot de Oliveira.PHONY: man man1 clean install uninstall
52*afc70ccbSDaniel Bristot de Oliveira.DEFAULT_GOAL := man
53