Hi,

I'd like to report a bug (or a feature...), I discovered recently:
If the private keyword is used to define a target-specific variable, make
suppresses inheritance, but also tries to build a target `private' as
prerequisite. Using other keywords like export or unexport, work as
documented. The attached makefile reproduces the mentioned effect.

Please also reply to my address as I'm not subscribed to the mailing list.
In case this bug is already known, please ignore this request.

Thanks and ciao,
    Mario Schwalbe

For reference:

$ LC_ALL=C make -f Makefile.private-bug
prereq:
make: *** No rule to make target `private', needed by `target'.  Stop.

$ LC_ALL=C make -v
GNU Make 3.81
[...]
This program built for x86_64-pc-linux-gnu

#!/bin/false

ifeq ($(findstring target-specific,$(.FEATURES)),)
    $(error missing feature: target-specific variable assignments)
endif

# works: no private keyword
P = 1
# works: only global private keyword
P = 2
# works for prereq, but also tries to build `private' for target
P =

ifeq ($(P),1)
                    GLOBAL = global
    target:         LOCAL  = local
else
  ifeq ($(P),2)
            private GLOBAL = global    # not visible within recipes
    target:         LOCAL  = local
  else
            private GLOBAL = global    # not visible within recipes
    target: private LOCAL  = local     # suppress inheritance
  endif
endif

target: prereq
        @echo $@: $(GLOBAL) $(LOCAL)

prereq:
        @echo $@: $(GLOBAL) $(LOCAL)

# ***** end of source *****


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to