bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* [PATCH 1/1] old-fashioned suffix rules cannot have any prerequisites
  2020-04-01 12:26 Petr Ovtchenkov
@ 2020-04-01 12:26 ` Petr Ovtchenkov
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Ovtchenkov @ 2020-04-01 12:26 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Petr Ovtchenkov

See:

https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html#Suffix-Rules

<snip>
  Suffix rules cannot have any prerequisites of their own. If they have
  any, they are treated as normal files with funny names, not as suffix
  rules. Thus, the rule:
  ...
</snip>
---
 build-aux/po/Makefile.in.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/build-aux/po/Makefile.in.in b/build-aux/po/Makefile.in.in
index e4169b338..320cef068 100644
--- a/build-aux/po/Makefile.in.in
+++ b/build-aux/po/Makefile.in.in
@@ -107,7 +107,7 @@ DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO))
 # the .pot file. This eliminates the need to update the .po files when the
 # .pot file has changed, which would be troublesome if the .po files are put
 # under version control.
-.po.gmo: $(srcdir)/$(DOMAIN).pot
+%.gmo:	%.po $(srcdir)/$(DOMAIN).pot
 	@lang=`echo $* | sed -e 's,.*/,,'`; \
 	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
 	echo "$${cdcmd}rm -f $${lang}.gmo && $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) -o $${lang}.1po $${lang}.po $(DOMAIN).pot && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.1po && rm -f $${lang}.1po"; \
@@ -118,7 +118,7 @@ DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO))
 	mv t-$${lang}.gmo $${lang}.gmo && \
 	rm -f $${lang}.1po
 
-.sin.sed:
+%.sed:	%.sin
 	sed -e '/^#/d' $< > t-$@
 	mv t-$@ $@
 
@@ -444,14 +444,14 @@ update-po: Makefile
 
 # General rule for creating PO files.
 
-.nop.po-create:
+%.po-create:	%.nop
 	@lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
 	echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
 	exit 1
 
 # General rule for updating PO files.
 
-.nop.po-update:
+%.po-update:	%.nop
 	@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
 	if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; fi; \
 	tmpdir=`pwd`; \
-- 
2.25.0.dirty



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 0/1] old-fashioned suffix rules cannot have any prerequisites
@ 2020-04-01 13:12 Petr Ovtchenkov
  2020-04-01 13:12 ` [PATCH 1/1] " Petr Ovtchenkov
  2020-04-02  0:01 ` [PATCH 0/1] " Bruno Haible
  0 siblings, 2 replies; 6+ messages in thread
From: Petr Ovtchenkov @ 2020-04-01 13:12 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Petr Ovtchenkov

Template po/Makefile.in.in use old-fashioned suffix rules
for generating .gmo. But this rules do not allow any prerequisites.

See:

https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html#Suffix-Rules

<snip>
  Suffix rules cannot have any prerequisites of their own. If they have
  any, they are treated as normal files with funny names, not as suffix
  rules. Thus, the rule:
  ...
</snip>

This lead to problem when used relatively new GNU Make:
<snip>
  make[3]: *** No rule to make target 'en.gmo', needed by ...
</snip>

In this patch I am avoid significant changes and gmake-specific
syntax. BTW, looks, that "%ts: %ds" notaion is preferable for BSD make too:

https://www.freebsd.org/cgi/man.cgi?query=make&apropos=0&sektion=0&manpath=SunOS+5.9&format=html
(Implicit Rules section).


Petr Ovtchenkov (1):
  old-fashioned suffix rules cannot have any prerequisites

 build-aux/po/Makefile.in.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.25.0.dirty



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/1] old-fashioned suffix rules cannot have any prerequisites
  2020-04-01 13:12 [PATCH 0/1] old-fashioned suffix rules cannot have any prerequisites Petr Ovtchenkov
@ 2020-04-01 13:12 ` Petr Ovtchenkov
  2020-04-02  0:01 ` [PATCH 0/1] " Bruno Haible
  1 sibling, 0 replies; 6+ messages in thread
From: Petr Ovtchenkov @ 2020-04-01 13:12 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Petr Ovtchenkov

See:

https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html#Suffix-Rules

<snip>
  Suffix rules cannot have any prerequisites of their own. If they have
  any, they are treated as normal files with funny names, not as suffix
  rules. Thus, the rule:
  ...
</snip>
---
 build-aux/po/Makefile.in.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/build-aux/po/Makefile.in.in b/build-aux/po/Makefile.in.in
index e4169b338..320cef068 100644
--- a/build-aux/po/Makefile.in.in
+++ b/build-aux/po/Makefile.in.in
@@ -107,7 +107,7 @@ DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO))
 # the .pot file. This eliminates the need to update the .po files when the
 # .pot file has changed, which would be troublesome if the .po files are put
 # under version control.
-.po.gmo: $(srcdir)/$(DOMAIN).pot
+%.gmo:	%.po $(srcdir)/$(DOMAIN).pot
 	@lang=`echo $* | sed -e 's,.*/,,'`; \
 	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
 	echo "$${cdcmd}rm -f $${lang}.gmo && $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) -o $${lang}.1po $${lang}.po $(DOMAIN).pot && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.1po && rm -f $${lang}.1po"; \
@@ -118,7 +118,7 @@ DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO))
 	mv t-$${lang}.gmo $${lang}.gmo && \
 	rm -f $${lang}.1po
 
-.sin.sed:
+%.sed:	%.sin
 	sed -e '/^#/d' $< > t-$@
 	mv t-$@ $@
 
@@ -444,14 +444,14 @@ update-po: Makefile
 
 # General rule for creating PO files.
 
-.nop.po-create:
+%.po-create:	%.nop
 	@lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
 	echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
 	exit 1
 
 # General rule for updating PO files.
 
-.nop.po-update:
+%.po-update:	%.nop
 	@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
 	if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; fi; \
 	tmpdir=`pwd`; \
-- 
2.25.0.dirty



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/1] old-fashioned suffix rules cannot have any prerequisites
  2020-04-01 13:12 [PATCH 0/1] old-fashioned suffix rules cannot have any prerequisites Petr Ovtchenkov
  2020-04-01 13:12 ` [PATCH 1/1] " Petr Ovtchenkov
@ 2020-04-02  0:01 ` Bruno Haible
  2020-04-02  1:00   ` Paul Smith
  1 sibling, 1 reply; 6+ messages in thread
From: Bruno Haible @ 2020-04-02  0:01 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Petr Ovtchenkov, bug-gettext

[CCing bug-gettext, because po/Makefile.in.in comes from GNU gettext.]

Petr Ovtchenkov wrote in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-04/msg00000.html>

> Template po/Makefile.in.in use old-fashioned suffix rules
> for generating .gmo. But this rules do not allow any prerequisites.
> 
> See:
> 
> https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html#Suffix-Rules
> 
> <snip>
>   Suffix rules cannot have any prerequisites of their own. If they have
>   any, they are treated as normal files with funny names, not as suffix
>   rules. Thus, the rule:
>   ...
> </snip>
> 
> This lead to problem when used relatively new GNU Make:
> <snip>
>   make[3]: *** No rule to make target 'en.gmo', needed by ...
> </snip>

Please, to make it easier for me to reproduce, could you tell which version
of GNU make you're using?

> In this patch I am avoid significant changes and gmake-specific
> syntax.

But % pattern rules are GNU make specific syntax, since this syntax is not
specified by POSIX [1]. I fear that I'll have to use a more complicated fix...

Bruno

[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/1] old-fashioned suffix rules cannot have any prerequisites
  2020-04-02  0:01 ` [PATCH 0/1] " Bruno Haible
@ 2020-04-02  1:00   ` Paul Smith
  2020-04-02  6:29     ` Petr Ovtchenkov
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Smith @ 2020-04-02  1:00 UTC (permalink / raw)
  To: Bruno Haible, bug-gnulib; +Cc: Petr Ovtchenkov, bug-gettext

Sorry, somehow the original email went by me.

On Thu, 2020-04-02 at 02:01 +0200, Bruno Haible wrote:
> Petr Ovtchenkov wrote in
> <https://lists.gnu.org/archive/html/bug-gnulib/2020-04/msg00000.html>
> 
> > Template po/Makefile.in.in use old-fashioned suffix rules
> > for generating .gmo. But this rules do not allow any prerequisites.
> > 
> > See:https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html#Suffix-Rules
> > 
> > <snip>
> >    Suffix rules cannot have any prerequisites of their own. If they have
> >    any, they are treated as normal files with funny names, not as suffix
> >    rules. Thus, the rule:
> >    ...
> > </snip>
> > 
> > This lead to problem when used relatively new GNU Make:
> > <snip>
> >    make[3]: *** No rule to make target 'en.gmo', needed by ...
> > </snip>
> 
> Please, to make it easier for me to reproduce, could you tell which
> version of GNU make you're using?

There should be no final version of GNU make that shows this as an
error.  In the final release 4.3, the following appears in the NEWS
file:

> * NOTE: Deprecated behavior.
>   Contrary to the documentation, suffix rules with prerequisites are being
>   treated BOTH as simple targets AND as pattern rules.  Further, the
>   prerequisites are ignored by the pattern rules.  POSIX specifies that in
>   order to be a suffix rule there can be no prerequisites defined.  In this
>   release if POSIX mode is enabled then rules with prerequisites cannot be
>   suffix rules.  If POSIX mode is not enabled then the previous behavior is
>   preserved (a pattern rule with no extra prerequisites is created) AND a
>   warning about this behavior is generated:
>     warning: ignoring prerequisites on suffix rule definition
>   The POSIX behavior will be adopted as the only behavior in a future release
>   of GNU make so please resolve any warnings.

So, you should be seeing a warning, not an error, in GNU make 4.3. 
There were some prereleases of GNU make 4.3 created where this was an
error.

> > In this patch I am avoid significant changes and gmake-specific
> > syntax.
> 
> But % pattern rules are GNU make specific syntax, since this syntax
> is not specified by POSIX [1]. I fear that I'll have to use a more
> complicated fix...

Correct, you cannot use pattern rules in portable makefiles.  The only
problematic rule is this one:

  .po.gmo: $(srcdir)/$(DOMAIN).pot

The other changes are not necessary.

I should point out that even in older versions of GNU make where the
syntax in question didn't generate any warnings or errors, it never
worked as desired: the extra prerequisite are completely ignored.

You can easily confirm this by running "make -p" with this makefile and
in the rule database; locate the pattern rule and you will see:

  %.gmo: %.po
  #  recipe to execute (from 'Makefile', line 111):
        @lang=`echo $* | sed -e 's,.*/,,'`; \
           ...

As you can see, there is no prerequisite for the .pot file here.

In short, in no version of GNU make did the suffix rule defined here
ever actually do what was desired and there will be no loss of
functionality by simply removing the extra prerequisite completely:

  .po.gmo:
          @lang=`echo $* | sed -e 's,.*/,,'`; \
            ...

If you really do want the .gmo files to list the .pot file as a
prerequisite you'll need to create a separate prerequisite statement
for that, for all versions of GNU make.

Cheers!



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/1] old-fashioned suffix rules cannot have any prerequisites
  2020-04-02  1:00   ` Paul Smith
@ 2020-04-02  6:29     ` Petr Ovtchenkov
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Ovtchenkov @ 2020-04-02  6:29 UTC (permalink / raw)
  To: Paul Smith, bug-gnulib; +Cc: Bruno Haible, bug-gettext

On Wed, 01 Apr 2020 21:00:15 -0400
Paul Smith <psmith@gnu.org> wrote:
>
> > 
> > But % pattern rules are GNU make specific syntax, since this syntax
> > is not specified by POSIX [1]. I fear that I'll have to use a more
> > complicated fix...  
> 
> Correct, you cannot use pattern rules in portable makefiles.

Well, BSD make prefer % notaion too. What is example of POSIX make,
that not understand % rules?

> The only problematic rule is this one:
> 
>   .po.gmo: $(srcdir)/$(DOMAIN).pot
> 
> The other changes are not necessary.

Agree. With note: both main make families (GNU and BSD) mention
.a.b notaion as 'old' [2], and prefer %b: %a [2,3], and ... what
is non-BSD, non-GNU POSIX make we keep in mind? That used by Sun
Microsytems, before preference for GNU Make? This was more then 20
years ago.

The .a.b notation instigate ill-formed ".a.b: d" construction,
so I would prefer to avoid it outside of "standard implicit rules".

> ...
>> 
> In short, in no version of GNU make did the suffix rule defined here
> ever actually do what was desired and there will be no loss of
> functionality by simply removing the extra prerequisite completely:
> 
>   .po.gmo:
>           @lang=`echo $* | sed -e 's,.*/,,'`; \
>             ...

Dependency from .pot file is a scope of gettext authors, I think.

WBR,

--

   - ptr

[2]
https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html#Suffix-Rules

[3]
https://www.freebsd.org/cgi/man.cgi?query=make&apropos=0&sektion=0&manpath=SunOS+5.9&format=html


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-02  6:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-01 13:12 [PATCH 0/1] old-fashioned suffix rules cannot have any prerequisites Petr Ovtchenkov
2020-04-01 13:12 ` [PATCH 1/1] " Petr Ovtchenkov
2020-04-02  0:01 ` [PATCH 0/1] " Bruno Haible
2020-04-02  1:00   ` Paul Smith
2020-04-02  6:29     ` Petr Ovtchenkov
  -- strict thread matches above, loose matches on Subject: below --
2020-04-01 12:26 Petr Ovtchenkov
2020-04-01 12:26 ` [PATCH 1/1] " Petr Ovtchenkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).