meson html:alias vs. html:custom

Started by Peter Eisentrautabout 2 months ago5 messageshackers
Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

When I run

meson compile -C build html

I get this error message:

INFO: autodetecting backend as ninja

ERROR: Can't invoke target `html`: ambiguous name. Add target type
and/or path:
- ./doc/src/sgml/html:custom
- ./doc/src/sgml/html:alias

If I follow that advice and run meson compile -C build html:alias or
html:custom, then it works.

The setup in doc/src/sgml/meson.build is

html = custom_target('html', ...)

alias_target('html', html)

If I remove the alias_target, then my original command works. What is
the purpose of this alias?

(The equivalent problem exists for "man".)

#2Nazir Bilal Yavuz
byavuz81@gmail.com
In reply to: Peter Eisentraut (#1)
Re: meson html:alias vs. html:custom

Hi,

On Tue, 14 Apr 2026 at 11:08, Peter Eisentraut <peter@eisentraut.org> wrote:

If I remove the alias_target, then my original command works. What is
the purpose of this alias?

I think the main purpose was using these targets with the ninja
command like: 'ninja ${target}'. ninja command doesn't work when the
alias_target() is removed.

--
Regards,
Nazir Bilal Yavuz
Microsoft

#3Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Nazir Bilal Yavuz (#2)
Re: meson html:alias vs. html:custom

On 2026-04-14, Nazir Bilal Yavuz wrote:

On Tue, 14 Apr 2026 at 11:08, Peter Eisentraut <peter@eisentraut.org> wrote:

If I remove the alias_target, then my original command works. What is
the purpose of this alias?

I think the main purpose was using these targets with the ninja
command like: 'ninja ${target}'. ninja command doesn't work when the
alias_target() is removed.

I think this is kinda silly. I would rather rename the meson target (to, say, do_html) and make the alias reference that, so that both "meson compile html" and "ninja html" would use the alias.

--
Álvaro Herrera

#4Nazir Bilal Yavuz
byavuz81@gmail.com
In reply to: Alvaro Herrera (#3)
Re: meson html:alias vs. html:custom

Hi,

On Thu, 16 Apr 2026 at 09:26, Álvaro Herrera <alvherre@kurilemu.de> wrote:

On 2026-04-14, Nazir Bilal Yavuz wrote:

On Tue, 14 Apr 2026 at 11:08, Peter Eisentraut <peter@eisentraut.org> wrote:

If I remove the alias_target, then my original command works. What is
the purpose of this alias?

I think the main purpose was using these targets with the ninja
command like: 'ninja ${target}'. ninja command doesn't work when the
alias_target() is removed.

I think this is kinda silly. I would rather rename the meson target (to, say, do_html) and make the alias reference that, so that both "meson compile html" and "ninja html" would use the alias.

I agree with you. Here is a patch for fixing this problem with your
suggestion. I added the '-custom' suffix instead of the 'do_' prefix,
I think this makes it more concrete.

--
Regards,
Nazir Bilal Yavuz
Microsoft

Attachments:

v1-0001-meson-Differentiate-top-level-and-custom-targets.patchtext/x-patch; charset=UTF-8; name=v1-0001-meson-Differentiate-top-level-and-custom-targets.patchDownload+4-7
#5Peter Eisentraut
peter_e@gmx.net
In reply to: Nazir Bilal Yavuz (#4)
Re: meson html:alias vs. html:custom

On 16.04.26 09:46, Nazir Bilal Yavuz wrote:

Hi,

On Thu, 16 Apr 2026 at 09:26, Álvaro Herrera <alvherre@kurilemu.de> wrote:

On 2026-04-14, Nazir Bilal Yavuz wrote:

On Tue, 14 Apr 2026 at 11:08, Peter Eisentraut <peter@eisentraut.org> wrote:

If I remove the alias_target, then my original command works. What is
the purpose of this alias?

I think the main purpose was using these targets with the ninja
command like: 'ninja ${target}'. ninja command doesn't work when the
alias_target() is removed.

I think this is kinda silly. I would rather rename the meson target (to, say, do_html) and make the alias reference that, so that both "meson compile html" and "ninja html" would use the alias.

I agree with you. Here is a patch for fixing this problem with your
suggestion. I added the '-custom' suffix instead of the 'do_' prefix,
I think this makes it more concrete.

Committed, thanks.