docs: avoid duplicate html and pdf targets

Automake warns when html and pdf targets are defined separately in both
branches of the HAVE_DOCBOOK conditional.

Define the public html and pdf targets once and dispatch to DocBook or
non-DocBook helper targets instead. This preserves the existing behavior
while avoiding duplicate target warnings with newer Automake.
This commit is contained in:
Daemonratte 2026-04-28 21:22:03 +02:00
commit b1fdc9cddd
2 changed files with 58 additions and 31 deletions

View file

@ -4,7 +4,20 @@ EXTRA_DIST += \
gtk-faq.sgml
if HAVE_DOCBOOK
html:
FAQ_HTML_TARGET = html-docbook
FAQ_PDF_TARGET = pdf-docbook
FAQ_DIST_TARGET = dist-hook-docbook
all-local: html
else
FAQ_HTML_TARGET = html-no-docbook
FAQ_PDF_TARGET = pdf-no-docbook
FAQ_DIST_TARGET = dist-hook-no-docbook
endif
html: $(FAQ_HTML_TARGET)
html-docbook:
if test -w $(srcdir); then \
(cd $(srcdir); \
db2html gtk-faq.sgml; \
@ -12,33 +25,34 @@ html:
mv gtk-faq html); \
fi
pdf:
html-no-docbook:
echo "***"
echo "*** Warning: FAQ not built"
echo "***"
pdf: $(FAQ_PDF_TARGET)
pdf-docbook:
if test -w $(srcdir); then \
(cd $(srcdir); db2pdf gtk-faq.sgml); \
fi
all-local: html
pdf-no-docbook:
echo "***"
echo "*** Warning: FAQ not built"
echo "***"
dist-hook: html
dist-hook: $(FAQ_DIST_TARGET)
dist-hook-docbook: html
cp -Rp $(srcdir)/html $(distdir)
else
html:
echo "***"
echo "*** Warning: FAQ not built"
echo "***"
pdf:
echo "***"
echo "*** Warning: FAQ not built"
echo "***"
dist-hook:
dist-hook-no-docbook:
echo "***"
echo "*** Warning: FAQ not built"
echo "*** DISTRIBUTION IS INCOMPLETE"
echo "***"
endif
.PHONY: html
.PHONY: html pdf html-docbook html-no-docbook pdf-docbook pdf-no-docbook dist-hook-docbook dist-hook-no-docbook
-include $(top_srcdir)/git.mk

View file

@ -1,6 +1,6 @@
include $(top_srcdir)/Makefile.decl
.PHONY: html pdf
.PHONY: html pdf html-docbook html-no-docbook pdf-docbook pdf-no-docbook dist-hook-docbook dist-hook-no-docbook
EXTRA_DIST += \
gtk-tut.sgml \
@ -37,7 +37,20 @@ EXTRA_DIST += \
images/tictactoe.png
if HAVE_DOCBOOK
html: gtk-tut.sgml
TUTORIAL_HTML_TARGET = html-docbook
TUTORIAL_PDF_TARGET = pdf-docbook
TUTORIAL_DIST_TARGET = dist-hook-docbook
all-local: html
else
TUTORIAL_HTML_TARGET = html-no-docbook
TUTORIAL_PDF_TARGET = pdf-no-docbook
TUTORIAL_DIST_TARGET = dist-hook-no-docbook
endif
html: $(TUTORIAL_HTML_TARGET)
html-docbook: gtk-tut.sgml
if test -w $(srcdir); then \
(cd $(srcdir); \
db2html gtk-tut.sgml; \
@ -47,32 +60,32 @@ html: gtk-tut.sgml
cp images/*.png html/images); \
fi
pdf: gtk-tut.sgml
html-no-docbook:
echo "***"
echo "*** Warning: Tutorial not built"
echo "***"
pdf: $(TUTORIAL_PDF_TARGET)
pdf-docbook: gtk-tut.sgml
if test -w $(srcdir); then \
(cd $(srcdir); db2pdf gtk-tut.sgml); \
fi
all-local: html
pdf-no-docbook:
echo "***"
echo "*** Warning: Tutorial not built"
echo "***"
dist-hook: html
dist-hook: $(TUTORIAL_DIST_TARGET)
dist-hook-docbook: html
cp -Rp $(srcdir)/html $(distdir)
else
html:
echo "***"
echo "*** Warning: Tutorial not built"
echo "***"
pdf:
echo "***"
echo "*** Warning: Tutorial not built"
echo "***"
dist-hook:
dist-hook-no-docbook:
echo "***"
echo "*** Warning: Tutorial not built"
echo "*** DISTRIBUTION IS INCOMPLETE"
echo "***"
endif
-include $(top_srcdir)/git.mk