diff mbox

[21/23,v5] docs/asciidoc: make it possible to use $(@D) in hooks

Message ID 2dc7586ac17c407aef3adc68f49cbdb663074ed1.1410692671.git.yann.morin.1998@free.fr
State Changes Requested
Headers show

Commit Message

Yann E. MORIN Sept. 14, 2014, 11:07 a.m. UTC
Currently, it is not possible to use $(@D) in documents' hooks, because
there is no actual target file for the copying rule.

So, use the same mechanism as for generic-package.

We do not touch the target file, so it is easy to regenerate the manual
without calling the -clean rule first.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 docs/manual/manual.mk   |  2 +-
 package/doc-asciidoc.mk | 10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

Comments

Samuel Martin Sept. 22, 2014, 8:48 p.m. UTC | #1
On Sun, Sep 14, 2014 at 1:07 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Currently, it is not possible to use $(@D) in documents' hooks, because
> there is no actual target file for the copying rule.
>
> So, use the same mechanism as for generic-package.
>
> We do not touch the target file, so it is easy to regenerate the manual
> without calling the -clean rule first.
>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Thomas De Schampheleire Sept. 24, 2014, 7:50 p.m. UTC | #2
On Sun, Sep 14, 2014 at 1:07 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Currently, it is not possible to use $(@D) in documents' hooks, because
> there is no actual target file for the copying rule.
>
> So, use the same mechanism as for generic-package.
>
> We do not touch the target file, so it is easy to regenerate the manual
> without calling the -clean rule first.

Shouldn't we add this note as a comment in doc/asciidoc.mk, to avoid
later 'correction' that adds a touch?

>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
>  docs/manual/manual.mk   |  2 +-
>  package/doc-asciidoc.mk | 10 ++++------
>  2 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/docs/manual/manual.mk b/docs/manual/manual.mk
> index b221664..9a86113 100644
> --- a/docs/manual/manual.mk
> +++ b/docs/manual/manual.mk
> @@ -8,7 +8,7 @@ MANUAL_RESSOURCES = $(TOPDIR)/docs/images
>  # Our manual needs to generate lists
>  define MANUAL_GEN_LISTS
>         $(Q)$(call MESSAGE,"Updating the manual lists...")
> -       $(Q)BR2_DEFCONFIG="" TOPDIR=$(TOPDIR) O=$(BUILD_DIR)/$(pkgname) \
> +       $(Q)BR2_DEFCONFIG="" TOPDIR=$(TOPDIR) O=$(@D) \
>                 BR2_EXTERNAL=$(TOPDIR)/support/dummy-external \
>                 python -B $(TOPDIR)/support/scripts/gen-manual-lists.py
>  endef
> diff --git a/package/doc-asciidoc.mk b/package/doc-asciidoc.mk
> index 38c9ced..13e4479 100644
> --- a/package/doc-asciidoc.mk
> +++ b/package/doc-asciidoc.mk
> @@ -118,16 +118,14 @@ define ASCIIDOC
>  $(pkgname)-check-dependencies: asciidoc-check-dependencies
>         $$(Q)$$(foreach hook,$$($(2)_CHECK_EXTRA_DEPENDENCIES_HOOKS),$$(call $$(hook))$$(sep))

This patch does not allow $(@D) in the CHECK_EXTRA_DEPENDENCIES_HOOKS.
Is that intentional?
Yann E. MORIN Sept. 25, 2014, 5:47 p.m. UTC | #3
Thomas, All,

On 2014-09-24 21:50 +0200, Thomas De Schampheleire spake thusly:
> On Sun, Sep 14, 2014 at 1:07 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > Currently, it is not possible to use $(@D) in documents' hooks, because
> > there is no actual target file for the copying rule.
> >
> > So, use the same mechanism as for generic-package.
> >
> > We do not touch the target file, so it is easy to regenerate the manual
> > without calling the -clean rule first.
> 
> Shouldn't we add this note as a comment in doc/asciidoc.mk, to avoid
> later 'correction' that adds a touch?

Right, I'll do.

> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > ---
> >  docs/manual/manual.mk   |  2 +-
> >  package/doc-asciidoc.mk | 10 ++++------
> >  2 files changed, 5 insertions(+), 7 deletions(-)
> >
> > diff --git a/docs/manual/manual.mk b/docs/manual/manual.mk
> > index b221664..9a86113 100644
> > --- a/docs/manual/manual.mk
> > +++ b/docs/manual/manual.mk
> > @@ -8,7 +8,7 @@ MANUAL_RESSOURCES = $(TOPDIR)/docs/images
> >  # Our manual needs to generate lists
> >  define MANUAL_GEN_LISTS
> >         $(Q)$(call MESSAGE,"Updating the manual lists...")
> > -       $(Q)BR2_DEFCONFIG="" TOPDIR=$(TOPDIR) O=$(BUILD_DIR)/$(pkgname) \
> > +       $(Q)BR2_DEFCONFIG="" TOPDIR=$(TOPDIR) O=$(@D) \
> >                 BR2_EXTERNAL=$(TOPDIR)/support/dummy-external \
> >                 python -B $(TOPDIR)/support/scripts/gen-manual-lists.py
> >  endef
> > diff --git a/package/doc-asciidoc.mk b/package/doc-asciidoc.mk
> > index 38c9ced..13e4479 100644
> > --- a/package/doc-asciidoc.mk
> > +++ b/package/doc-asciidoc.mk
> > @@ -118,16 +118,14 @@ define ASCIIDOC
> >  $(pkgname)-check-dependencies: asciidoc-check-dependencies
> >         $$(Q)$$(foreach hook,$$($(2)_CHECK_EXTRA_DEPENDENCIES_HOOKS),$$(call $$(hook))$$(sep))
> 
> This patch does not allow $(@D) in the CHECK_EXTRA_DEPENDENCIES_HOOKS.
> Is that intentional?

Partly.

I could not find a real use-case where a dependency would depend on the
content of the document.

Also, dependencies are checked even before the rsync takes place, so
$(@D) does not even exist yet.

So, I did not bother handing a valid $(@D) to CHECK_DEPS.

Regards,
Yann E. MORIN.
diff mbox

Patch

diff --git a/docs/manual/manual.mk b/docs/manual/manual.mk
index b221664..9a86113 100644
--- a/docs/manual/manual.mk
+++ b/docs/manual/manual.mk
@@ -8,7 +8,7 @@  MANUAL_RESSOURCES = $(TOPDIR)/docs/images
 # Our manual needs to generate lists
 define MANUAL_GEN_LISTS
 	$(Q)$(call MESSAGE,"Updating the manual lists...")
-	$(Q)BR2_DEFCONFIG="" TOPDIR=$(TOPDIR) O=$(BUILD_DIR)/$(pkgname) \
+	$(Q)BR2_DEFCONFIG="" TOPDIR=$(TOPDIR) O=$(@D) \
 		BR2_EXTERNAL=$(TOPDIR)/support/dummy-external \
 		python -B $(TOPDIR)/support/scripts/gen-manual-lists.py
 endef
diff --git a/package/doc-asciidoc.mk b/package/doc-asciidoc.mk
index 38c9ced..13e4479 100644
--- a/package/doc-asciidoc.mk
+++ b/package/doc-asciidoc.mk
@@ -118,16 +118,14 @@  define ASCIIDOC
 $(pkgname)-check-dependencies: asciidoc-check-dependencies
 	$$(Q)$$(foreach hook,$$($(2)_CHECK_EXTRA_DEPENDENCIES_HOOKS),$$(call $$(hook))$$(sep))
 
-$$(BUILD_DIR)/$(1):
-	$$(Q)mkdir -p $$@
-
 # Single line, because splitting a foreach is not easy...
-$(1)-rsync: $$(BUILD_DIR)/$(1)
+$$(BUILD_DIR)/$(1)/.stamp_doc_rsynced:
 	$$(Q)$$(call MESSAGE,"Preparing the $(1) sources...")
-	$$(Q)rsync -a $(3) $$^
+	$$(Q)mkdir -p $$(@D)
+	$$(Q)rsync -a $(3) $$(@D)
 	$$(Q)$$(foreach hook,$$($(2)_POST_EXTRACT_HOOKS),$$(call $$(hook))$$(sep))
 
-$(1)-prepare-sources: $(1)-rsync
+$(1)-prepare-sources: $$(BUILD_DIR)/$(1)/.stamp_doc_rsynced
 
 $(call ASCIIDOC_INNER,$(1),$(2),$(3),xhtml,html,html,HTML,\
 	--xsltproc-opts "--stringparam toc.section.depth 1")