Package: make
Version: 4.1-9.1
Severity: wishlist

Hello,

I have a Makefile that works with a set of files and can run various
checks over them. A simplified variant looks as follows:

        user@hostname:~/maketest$ cat Makefile 
        all: check-debian check-ubuntu

        check-%: list-%
                @echo test for $< succeeded

        .PHONY: all check-debian

With this Makefile (and the needed list files for debian and ubuntu:

        user@hostname:~/maketest$ ls
        list-debian  list-ubuntu  Makefile

) running make skips over check-debian's commands:

        user@hostname:~/maketest$ make -r
        test for list-ubuntu succeeded

When adding -d I get:

        ...
          Must remake target 'check-debian'.
          Successfully remade target file 'check-debian'.
        ...
          Must remake target 'check-ubuntu'.
        Putting child 0x559b3ec13e70 (check-ubuntu) PID 32112 on the chain.
        Live child 0x559b3ec13e70 (check-ubuntu) PID 32112 
        test for list-ubuntu succeeded
        Reaping winning child 0x559b3ec13e70 PID 32112 
        Removing child 0x559b3ec13e70 PID 32112 from chain.
          Successfully remade target file 'check-ubuntu'.
        ...

This matches the documentation, which has:

        The implicit rule search (see Implicit Rules) is skipped for
        .PHONY targets.

I discussed this on irc and someone found an older GNU Make Manual
stating:

        Since it knows that phony targets do not name actual files that
        could be remade from other files, make skips the implicit rule
        search for phony targets.

IMHO this reasoning is wrong as in my case implicit rules for phony
targets would be useful even though "check-debian" isn't the name of an
actual file.

My workaround for the Makefile is to not list the check-% targets in
.PHONY, but actually they are phony and I'd like to make use of the
advantages of declaring them as such.

Best regards
Uwe

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (700, 'testing'), (600, 'unstable'), (500, 'unstable-debug'), 
(500, 'stable'), (499, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.15.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages make depends on:
ii  libc6  2.27-3

make recommends no packages.

Versions of packages make suggests:
ii  make-doc  4.2.1-1

-- no debconf information

Reply via email to