diff mbox series

Makefile: correct default docs build target

Message ID 20250214215717.2854453-1-adam@dinwoodie.org (mailing list archive)
State New
Headers show
Series Makefile: correct default docs build target | expand

Commit Message

Adam Dinwoodie Feb. 14, 2025, 9:52 p.m. UTC
Put the "all" target definition near the top of Documentation/Makefile,
so that attempts to run make in the documentation directory actually
build the documentation.

This seems like the expected behaviour, and was the behaviour up until
a38edab7c8 (Makefile: generate doc versions via GIT-VERSION-GEN,
2024-12-06).  That commit added some config files as build targets, and
put the configuration in a sensible place, but unfortunately that
sensible place was above any other build target definitions, meaning the
default goal changed to being those configuration files only.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
---

Sending with my apologies to anyone who receives this twice; I made an
error with my sendmail configuration, meaning servers checking the DMARC
records would have rejected the previous patch.

 Documentation/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Junio C Hamano Feb. 14, 2025, 10:42 p.m. UTC | #1
Adam Dinwoodie <adam@dinwoodie.org> writes:

> Put the "all" target definition near the top of Documentation/Makefile,
> so that attempts to run make in the documentation directory actually
> build the documentation.

Good eyes.  To make the intent even more clear, please adopt the
trick (or "convention") used by t/Makefile and our main Makefile to
have an empty "all::" at the very beginning of the file, instead of
moving things around, to avoid this kind of mistake to ever enter
the repository again.

Thanks.


[Footnote]

* If existing "all" targets are single-colon rules by mistake, they
  need to be corrected.  There is no reason why these phony targets
  should be anything but double-colon rules).


>
> This seems like the expected behaviour, and was the behaviour up until
> a38edab7c8 (Makefile: generate doc versions via GIT-VERSION-GEN,
> 2024-12-06).  That commit added some config files as build targets, and
> put the configuration in a sensible place, but unfortunately that
> sensible place was above any other build target definitions, meaning the
> default goal changed to being those configuration files only.
>
> Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
> ---
>
> Sending with my apologies to anyone who receives this twice; I made an
> error with my sendmail configuration, meaning servers checking the DMARC
> records would have rejected the previous patch.
>
>  Documentation/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/Makefile b/Documentation/Makefile
> index aedfe99d1d..31f40b6f37 100644
> --- a/Documentation/Makefile
> +++ b/Documentation/Makefile
> @@ -3,6 +3,8 @@ include ../shared.mak
>  
>  .PHONY: FORCE
>  
> +all: html man
> +
>  # Guard against environment variables
>  MAN1_TXT =
>  MAN5_TXT =
> @@ -238,8 +240,6 @@ DEFAULT_EDITOR_SQ = $(subst ','\'',$(DEFAULT_EDITOR))
>  ASCIIDOC_EXTRA += -a 'git-default-editor=$(DEFAULT_EDITOR_SQ)'
>  endif
>  
> -all: html man
> -
>  html: $(DOC_HTML)
>  
>  man: man1 man5 man7
Junio C Hamano Feb. 14, 2025, 10:50 p.m. UTC | #2
Junio C Hamano <gitster@pobox.com> writes:

> Adam Dinwoodie <adam@dinwoodie.org> writes:
>
>> Put the "all" target definition near the top of Documentation/Makefile,
>> so that attempts to run make in the documentation directory actually
>> build the documentation.
>
> Good eyes.  To make the intent even more clear, please adopt the
> trick (or "convention") used by t/Makefile and our main Makefile to
> have an empty "all::" at the very beginning of the file, instead of
> moving things around, to avoid this kind of mistake to ever enter
> the repository again.
>
> Thanks.
>
>
> [Footnote]
>
> * If existing "all" targets are single-colon rules by mistake, they
>   need to be corrected.  There is no reason why these phony targets
>   should be anything but double-colon rules).

Yikes, it turns out this is needed, but because there is only one
place right now, fixing it is easy.  Something like this, perhaps.



diff --git c/Documentation/Makefile w/Documentation/Makefile
index aedfe99d1d..ddf3aa8fac 100644
--- c/Documentation/Makefile
+++ w/Documentation/Makefile
@@ -1,3 +1,6 @@
+# The default target of this Makefile is...
+all::
+
 # Import tree-wide shared Makefile behavior and libraries
 include ../shared.mak
 
@@ -238,7 +241,7 @@ DEFAULT_EDITOR_SQ = $(subst ','\'',$(DEFAULT_EDITOR))
 ASCIIDOC_EXTRA += -a 'git-default-editor=$(DEFAULT_EDITOR_SQ)'
 endif
 
-all: html man
+all:: html man
 
 html: $(DOC_HTML)
diff mbox series

Patch

diff --git a/Documentation/Makefile b/Documentation/Makefile
index aedfe99d1d..31f40b6f37 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -3,6 +3,8 @@  include ../shared.mak
 
 .PHONY: FORCE
 
+all: html man
+
 # Guard against environment variables
 MAN1_TXT =
 MAN5_TXT =
@@ -238,8 +240,6 @@  DEFAULT_EDITOR_SQ = $(subst ','\'',$(DEFAULT_EDITOR))
 ASCIIDOC_EXTRA += -a 'git-default-editor=$(DEFAULT_EDITOR_SQ)'
 endif
 
-all: html man
-
 html: $(DOC_HTML)
 
 man: man1 man5 man7