URL:
  <https://savannah.gnu.org/bugs/?68716>

                 Summary: POSIX make: any rule for a target disables any
single-suffix rule for it
                   Group: GNU roff
               Submitter: schwarze
               Submitted: Sat 26 Sep 2026 04:13:24 PM UTC
                Category: General
                Severity: 5 - Blocker
              Item Group: Build/Installation
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Unlocked
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Sat 26 Sep 2026 04:13:24 PM UTC By: Ingo Schwarze <schwarze>
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/make.html defines
the semantics of suffix rules in two paragraphs.

The first paragraph (starting with "When no target rule with commands ...")
defines the behaviour of double-suffix rules.

The second paragraph defines the behaviour of single-suffix rules and starts
as follows:  "If the target to be built does not contain a suffix and there is
no rule for the target, the single-suffix inference rules shall be checked.
[...]"

The condition "there is no rule for the target" makes no exception for rules
without commands.  That means, if there is _any_ rule for a target, even a
rule with no commands, the whole paragraph does not apply and no search for
single-suffix inference rules takes place.

This means that the line "$(GROFF_MAN_PAGES_ALL): soelim" in _doc/doc.am_
prevents all files listed in GROFF_MAN_PAGES_ALL from ever getting built
because this line overrides the suffix rule ".man:" in _Makefile.am_ with a
more specific target rule that never does anything but always succeds.

Later in the build, the following two targets crash because they try to read
from non-existent files that were not built because the rule supposed to build
them actually did nothing: _doc/groff-man-pages.pdf_ and
_doc/groff-man-pages.utf8.txt_ .

I see two ways to fix this.

Option 1:
Since _man/groff.7.man_ appears to be the only manual page file actually using
a _.so_ request (which is arguably a bad idea in the first place, but, oh
well), rename that file and generate _man/groff.7.man_ from the renamed file
using a dedicated target rule that runs nothing but soelim and depends on
soelim.  That allows deleting the troublesome dependency rule
"$(GROFF_MAN_PAGES_ALL): soelim".

Option 2:
Use double-suffix rules instead of a single-suffix rule, for example
".1man.1:" - of course, that causes some churn because it requires renaming
the input files, for example from "*.1.man*" to "*.1man*".

Minimal demonstrator of the problem:


 $ cat Makefile
all: main.tar

clean:
        rm -f main.tar dep.tar

main.tar: dep.tar

.SUFFIXES: .src

.src:
        cp $< $@
 $ make
cp dep.tar.src dep.tar


Note that above, main.tar.src is not copied.

Minimal demonstrator that what you intend to do is possible with double-suffix
rules:


 $ cat Makefile

all: main.tar

clean:
        rm -f main.tar dep.tar

main.tar: dep.tar

.SUFFIXES: .tar .src

.src.tar:
        cp $< $@
 $ make
cp dep.src dep.tar
cp main.src main.tar









    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68716>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to