Re: [PATCH] perf: Build install-man target when installing

From: Arnaldo Carvalho de Melo
Date: Wed Oct 24 2012 - 13:21:21 EST


Em Wed, Oct 24, 2012 at 10:03:16AM -0700, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Oct 23, 2012 at 06:39:51AM -0700, Arnaldo Carvalho de Melo escreveu:
> > > Ok, how's that: we check the presence of executables on the system and
> > > error out if not in the path. I found some helpful make functions in
> > > config/utilities.mak and decided to reuse them because I'm lazy :)
>
> > Better now:
>
> > Makefile:177: *** asciidoc not found, please install it on your distro.
> > Stop.
> > make[1]: Leaving directory `/home/git/linux/tools/perf/Documentation'
> > make: *** [install-man] Error 2
> > make: Leaving directory `/home/git/linux/tools/perf'
> > [acme@sandy linux]$
>
> > But it shouldn't stop the build, just warn the user that Documentation
> > is not going to be installed. It should error like that if 'make
> > install-man' is called.
>
> > Trying to do that now.

Namhyung, can I have your acked-by for this? I.e. changing the message
to 'man perf-list' and just warning the user that documentation won't be
installed if xmlto & asciidoc are not found?

I'm fine with it this way.

- Arnaldo

> [acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf try-install-man
> make: Entering directory `/home/git/linux/tools/perf'
> make -C Documentation try-install-man
> make[1]: Entering directory `/home/git/linux/tools/perf/Documentation'
> make[2]: Entering directory `/home/git/linux/tools/perf'
> make[2]: `/home/acme/git/build/perf/PERF-VERSION-FILE' is up to date.
> make[2]: Leaving directory `/home/git/linux/tools/perf'
> Makefile:202: Please install the asciidoc package to have the man pages installed
> Makefile:202: Please install the xmlto package to have the man pages installed
> make[1]: `try-install-man' is up to date.
> make[1]: Leaving directory `/home/git/linux/tools/perf/Documentation'
> make: Leaving directory `/home/git/linux/tools/perf'
> [acme@sandy linux]$
>
> The 'install-man' target will use your check-executable-or-error-out
> stuff, but the main 'install' target will call just 'try-install-man',
> that will not stop the build if there are missing tools to generate the
> man pages.
>
> Installing just xmlto makes it ask just for asciidoc, install both and it
> generates the man pages, please try to check if it works for you so that I can
> have your Tested-by.
>
> - Arnaldo

> diff --git a/tools/perf/Documentation/Makefile b/tools/perf/Documentation/Makefile
> index 9f2e44f..8cb65ea 100644
> --- a/tools/perf/Documentation/Makefile
> +++ b/tools/perf/Documentation/Makefile
> @@ -1,3 +1,5 @@
> +include ../config/utilities.mak
> +
> OUTPUT := ./
> ifeq ("$(origin O)", "command line")
> ifneq ($(O),)
> @@ -64,6 +66,7 @@ MAKEINFO=makeinfo
> INSTALL_INFO=install-info
> DOCBOOK2X_TEXI=docbook2x-texi
> DBLATEX=dblatex
> +XMLTO=xmlto
> ifndef PERL_PATH
> PERL_PATH = /usr/bin/perl
> endif
> @@ -71,6 +74,15 @@ endif
> -include ../config.mak.autogen
> -include ../config.mak
>
> +have_asciidoc := $(call get-executable,$(ASCIIDOC))
> +have_xmlto := $(call get-executable,$(XMLTO))
> +ifeq ($(have_asciidoc),)
> + missing_tools = true
> +endif
> +ifeq ($(have_xmlto),)
> + missing_tools = true
> +endif
> +
> #
> # For asciidoc ...
> # -7.1.2, no extra settings are needed.
> @@ -170,7 +182,11 @@ pdf: $(OUTPUT)user-manual.pdf
>
> install: install-man
>
> -install-man: man
> +check-man-tools:
> + $(call check-executable-or-error-out,$(ASCIIDOC))
> + $(call check-executable-or-error-out,$(XMLTO))
> +
> +do-install-man: man
> $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
> # $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
> # $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
> @@ -178,6 +194,20 @@ install-man: man
> # $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
> # $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
>
> +install-man: check-man-tools man
> +
> +try-install-man:
> +ifdef missing_tools
> +ifeq ($(have_asciidoc),)
> + $(warning Please install the asciidoc package to have the man pages installed)
> +endif
> +ifeq ($(have_xmlto),)
> + $(warning Please install the xmlto package to have the man pages installed)
> +endif
> +else
> + $(MAKE) do-install-man
> +endif
> +
> install-info: info
> $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
> $(INSTALL) -m 644 $(OUTPUT)perf.info $(OUTPUT)perfman.info $(DESTDIR)$(infodir)
> @@ -246,7 +276,7 @@ $(MAN_HTML): $(OUTPUT)%.html : %.txt
>
> $(OUTPUT)%.1 $(OUTPUT)%.5 $(OUTPUT)%.7 : $(OUTPUT)%.xml
> $(QUIET_XMLTO)$(RM) $@ && \
> - xmlto -o $(OUTPUT) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
> + $(XMLTO) -o $(OUTPUT) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
>
> $(OUTPUT)%.xml : %.txt
> $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index 404fdb4..b14eeb8 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -1041,7 +1041,7 @@ perfexec_instdir = $(prefix)/$(perfexecdir)
> endif
> perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
>
> -install: all install-man
> +install: all try-install-man
> $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
> $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'
> $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
> @@ -1067,6 +1067,9 @@ install-doc:
> install-man:
> $(MAKE) -C Documentation install-man
>
> +try-install-man:
> + $(MAKE) -C Documentation try-install-man
> +
> install-html:
> $(MAKE) -C Documentation install-html
>
> diff --git a/tools/perf/config/utilities.mak b/tools/perf/config/utilities.mak
> index ea853c2..42e264a 100644
> --- a/tools/perf/config/utilities.mak
> +++ b/tools/perf/config/utilities.mak
> @@ -168,6 +168,8 @@ _is-executable-sh = $(call shell-sq,test -f $(1) -a -x $(1) && echo y)
> get-executable = $(if $(1),$(if $(is-absolute),$(_ge-abspath),$(lookup)))
> _ge-abspath = $(if $(is-executable),$(1))
>
> +check-executable-or-error-out = $(if $(call get-executable,$(1)),,$(error $(1) not found, please install it on your distro))
> +
> # get-supplied-or-default-executable
> #
> # Usage: absolute-executable-path-or-empty = $(call get-executable-or-default,variable,default)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/