From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas.monjalon@6wind.com>
Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com [74.125.82.47])
 by dpdk.org (Postfix) with ESMTP id 58F14234
 for <dev@dpdk.org>; Fri, 30 Jan 2015 21:52:35 +0100 (CET)
Received: by mail-wg0-f47.google.com with SMTP id n12so29021295wgh.6
 for <dev@dpdk.org>; Fri, 30 Jan 2015 12:52:35 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:organization
 :user-agent:in-reply-to:references:mime-version
 :content-transfer-encoding:content-type;
 bh=vqwNdhsHxPsUCjW5JRKX9V4kkvNqf5FqiauaZGAmiPo=;
 b=DlAwuDlxKtiAKOYqqF9ksEaqQC4AhUv63ktAXo6vYlXJF6xyZEfD8VKOVc/zZGFibc
 n6YWu6Js6dBim2X23wAjNKn2mcJR0cTVkSCgMyMkv4C5mkYogK4N3CoE8dN2YtmzAAvf
 qH2eQxD8ThV9bC+l2yQxdUzKdv2euH6H7PTbtwN70uMRuiZSN15rDwNe+mFJ+sAQEYsg
 DRdCKN9KB8AhlrEELTLG1ZgnTG0lte4+p1T7rCqlC06ypV6MvHEW296Lk8e1K5zJxYbd
 9K6+8mUhPQ1DxjD8SVLk6qFV7etAy/xBtyCDdHFrXVYXx2RtZOwbNwyCM0Stkpy7m6+R
 gW/A==
X-Gm-Message-State: ALoCoQk1PSOJC6njqoDgHT9KupiXuizcF5+rk2OE/WW9d2DEYC7ccrjkkZWxVp3RYYJsmwD58vNQ
X-Received: by 10.180.105.10 with SMTP id gi10mr1320247wib.24.1422651155205;
 Fri, 30 Jan 2015 12:52:35 -0800 (PST)
Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136])
 by mx.google.com with ESMTPSA id q10sm16469094wjr.41.2015.01.30.12.52.33
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 30 Jan 2015 12:52:34 -0800 (PST)
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: John McNamara <john.mcnamara@intel.com>
Date: Fri, 30 Jan 2015 21:52:07 +0100
Message-ID: <13813522.nhRjWB08pe@xps13>
Organization: 6WIND
User-Agent: KMail/4.14.4 (Linux/3.18.4-1-ARCH; KDE/4.14.4; x86_64; ; )
In-Reply-To: <1422641608-8514-2-git-send-email-john.mcnamara@intel.com>
References: <1421255657-19521-1-git-send-email-john.mcnamara@intel.com>
 <1422641608-8514-1-git-send-email-john.mcnamara@intel.com>
 <1422641608-8514-2-git-send-email-john.mcnamara@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2 1/4] mk: Add 'make doc-pdf' target to
	convert guide docs to pdf
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 30 Jan 2015 20:52:35 -0000

2015-01-30 18:13, John McNamara:
> Added make system support for building PDF versions of
> the guides. Requires Python Sphinx and TexLive Full.
> 
> Signed-off-by: John McNamara <john.mcnamara@intel.com>

>  ifndef V
>  RTE_SPHINX_VERBOSE := -q
> +RTE_PDFLATEX_VERBOSE := > /dev/null 2>&1

By redirecting everything in /dev/null, you won't see any error.
But pdflatex is an horrible software.
If I remember well, it's very difficult to filter only errors.
You could try "-interaction batchmode" for quiet mode and
"-interaction nonstopmode" for verbose mode.

> +DEFAULT_DPI ?= 300

It's better to prefix this global variable with RTE_ or DPDK_

> -clean: api-html-clean guides-html-clean
> +clean: api-html-clean guides-html-clean guides-latex-clean

Why not guides-pdf-clean?

> +pdf: pdf-rel_notes pdf-linux_gsg pdf-freebsd_gsg pdf-prog_guide \
> +	pdf-sample_app_ug pdf-testpmd_app_ug

In general, it's a bad idea to create virtual targets where it could
be a file. Example: the real file $(RTE_OUTPUT)/doc/.../rel_notes.pdf
would be a better target than pdf-rel_notes.
But maybe it's too difficult to have the full dependency chain to make
it able of recompiling only needed parts when needed.

> +pdf-%:
> +	@echo 'creating' $* 'pdf ...'
> +        # Generate the latex files.
> +	$(Q)$(RTE_SPHINX_BUILD) -b latex $(RTE_SPHINX_VERBOSE) \
> +		-c $(RTE_SDK)/doc/guides/$*  $(RTE_SDK)/doc/guides/$* \
> +		$(RTE_OUTPUT)/doc/latex/guides/$*
> +
> +        # Convert the svg files to png.
> +	$(eval svg_files=$(notdir $(wildcard $(RTE_SDK)/doc/guides/$*/img/*.svg)))
> +	$(eval svg_files=$(patsubst %.svg, %, $(svg_files)))
> +	@for svg in $(svg_files); do \

You could use $(svg_files:.svg=) instead of doing a patsubst above.

> +		inkscape -d $(DEFAULT_DPI) -D -b ffffff  \
> +			-f $(RTE_SDK)/doc/guides/$*/img/$$svg.svg \
> +			-e $(RTE_OUTPUT)/doc/latex/guides/$*/$$svg.png \
> +				$(RTE_PDFLATEX_VERBOSE); \
> +	done
> +
> +        # Change the svg image includes to png in the latex docs.
> +	$(Q)sed -i 's/\.svg/.png/g' $(RTE_OUTPUT)/doc/latex/guides/$*/*.tex

No, you could avoid that if every image references where x.* instead of x.svg or x.png.
The image extension should always be .* in rst to be format agnostic.
Then there is a (configurable) rule to choose the best format.

> +
> +        # Convert the latex to pdf.
> +	$(Q)$(MAKE) -C $(RTE_OUTPUT)/doc/latex/guides/$* \
> +		all-pdf $(RTE_PDFLATEX_VERBOSE)

Indentation is broken in this whole rule.

> --- a/mk/rte.sdkroot.mk
> +++ b/mk/rte.sdkroot.mk
> @@ -101,9 +101,10 @@ testall:
>  install uninstall:
>  	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkinstall.mk $@
>  
> -.PHONY: doc help
> +.PHONY: doc help pdf
>  doc: doc-all
>  help: doc-help
> +pdf: doc-pdf
>  doc-%:
>  	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkdoc.mk $*

Why having a pdf rule? It seems not consistent. doc-pdf is enough.

Thanks
-- 
Thomas