[m-rev.] for review: do not use .exe extension with ug_invocation dependencies

Julien Fischer jfischer at opturion.com
Mon Jul 21 21:31:12 AEST 2025


On Mon, 21 Jul 2025 at 19:13, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
>
> On Mon, 21 Jul 2025 16:46:32 +1000, Julien Fischer <jfischer at opturion.com> wrote:
> > +# We do not specify the executable extension (.exe) on Windows here because it
> > +# will not be present for the launcher scripts generated in the non-C grades.
> > +# This does not matter because the PATHEXT mechanism will cause the shell and
> > +# gmake to account for it in C grades (where the extension is present).
> > +UG_INVOCATION_DEP=../compiler/mercury_compile
>
> I would do an explicit case analysis here:
>
> We do not specify the executable extension $(EXT_FOR_EXE) here because
> we need a way to refer to the compiler that works regardless of the grade
> in which it is compiled, and on all platforms. The extension that $(EXT_FOR_EXE)
> stands for
>
> - will not be present on the launcher scripts generated in the non-C grades,
> - will not be present on the executable in C grades on Unix-like systems, and
> - while it will be present on the executables in C grades on Windows,
>   the Windows-specific PATHEXT mechanism will cause gmake and the shell
>   to add it for us (on UG_INVOCATION_DEP and UG_INVOCATION_MC
>   respectively).

I was wrong about the last part; the PATHEXT mechanism is *not* being used.
On Windows, gmake itself contains code that provides equivalent behaviour.
Here is a revised diff incorporating your suggestion together with that
correct:

diff --git a/doc/Mmakefile b/doc/Mmakefile
index f08268966..c3548d6cb 100644
--- a/doc/Mmakefile
+++ b/doc/Mmakefile
@@ -173,7 +173,18 @@ ifdef BUILD_SRCDIST
 UG_INVOCATION_DEP=
 UG_INVOCATION_MC=$(MC)
 else
-UG_INVOCATION_DEP=../compiler/mercury_compile$(EXT_FOR_EXE)
+# We do not specify the executable extension $(EXT_FOR_EXE) here because we
+# need a way to refer to the compiler that works regardless of the grade in
+# which it is compiled, and on all platforms. The extension that $(EXT_FOR_EXE)
+# stands for
+#
+# - will not be present on the launcher scripts generated in the non-C grades,
+# - will not be present on the executable in C grades on Unix-like systems, and
+# - while it will be present on the executables in C grades on Windows,
+#   gmake on Windows contains code to add it for us (on UG_INVOCATION_DEP and
+#   UG_INVOCATION_MC respectively).
+#
+UG_INVOCATION_DEP=../compiler/mercury_compile
 UG_INVOCATION_MC=../compiler/mercury_compile
 endif

> Note: I don't program on Windows, so the last part  is just a guess.

I wish I didn't have to program on Windows ... :-(

Julien.


More information about the reviews mailing list