[m-rev.] for review: keep the invocation automatically up-to-date

Julien Fischer jfischer at opturion.com
Mon Jul 21 00:02:56 AEST 2025


On Sun, 20 Jul 2025 at 22:44, Julien Fischer <jfischer at opturion.com> wrote:
>
> On Sat, 19 Jul 2025 at 07:43, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> >
> > The main issue I am seeking feedback on is that after this diff,
> > making the user guide requires compiler/mercury_compile to be
> > up to date. The other rules of doc/Mmakefile already depend
> > on the contents of the compiler directory, but they do so only for
> > .m files, which do not need to be built.
>
> There is one case where this is a problem, namely building the source
> distribution.
> In that case mercury_compile will not exist when we build the doc directory.

The following diff, which is for review by Zoltan, fixes this issue:

diff --git a/Mmakefile b/Mmakefile
index b8f7e75aa..fa0ff9e25 100644
--- a/Mmakefile
+++ b/Mmakefile
@@ -523,7 +523,7 @@ tar:     $(GENERATED_DOCS)
     +cd mfilterjavac && $(SUBDIR_MMAKE) all_cs tags
     +cd grade_lib && $(SUBDIR_MMAKE) depend
     +cd grade_lib && $(SUBDIR_MMAKE) all_cs tags
-    +cd doc && $(SUBDIR_MMAKE) info html dvi mdb_doc
+    +cd doc && $(SUBDIR_MMAKE) info html dvi mdb_doc BUILD_SRCDIST=yes
     # the following commands might fail on Windows?
     -cd bindist && $(SUBDIR_MMAKE) bindist.Makefile
     -cd bindist && $(SUBDIR_MMAKE) bindist.INSTALL
diff --git a/doc/Mmakefile b/doc/Mmakefile
index 681ea89bd..3e266f31b 100644
--- a/doc/Mmakefile
+++ b/doc/Mmakefile
@@ -161,12 +161,25 @@ user_guide.texi_pp: ug_invocation.texi
 # deleted. This is not usually a problem though, first because making
 # such deletions accidentally is rare, and second because an "mmake clean"
 # fixes the issue by deleting the timestamp file as well.
+
 ug_invocation.texi: ug_invocation.texi_date
     @:

-ug_invocation.texi_date: ../compiler/mercury_compile$(EXT_FOR_EXE)
+# If we are building the source distribution, then we will not have
+# a mercury_compile executable to generate ug_invocation.texi from.
+# In that case, we just use the bootstrap compiler to generate it
+# since it will be the same version anyway.
+ifdef BUILD_SRCDIST
+UG_INVOCATION_DEP=
+UG_INVOCATION_MC=$(MC)
+else
+UG_INVOCATION_DEP=../compiler/mercury_compile$(EXT_FOR_EXE)
+UG_INVOCATION_MC=../compiler/mercury_compile
+endif
+
+ug_invocation.texi_date: $(UG_INVOCATION_DEP)
     @echo checking whether ug_invocation.texi is up to date
-    @../compiler/mercury_compile --help-texinfo \
+    @$(UG_INVOCATION_MC) --help-texinfo \
         --no-mercury-stdlib-dir \
         --config-file ../scripts/Mercury.config \
         > ug_invocation.texi_new


Julien.


More information about the reviews mailing list