[Bug 217613] FreeBSD make -- local variable $(.PREFIX) does not strip preceding directory components

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Mar 10 06:46:59 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=217613

--- Comment #7 from Simon J. Gerraty <sjg at FreeBSD.org> ---
Sorry I should have been more explicit, I was refering to the dependency.
If we tweak that makefile so it is consumable by both bmake and gmake

% cat tmf

.SUFFIXES: .ext .c

VPATH = /tmp

/tmp/target.ext: target.c
        @echo '@=$@ *=$* >=$> ^=$^'

all: target.ext
%

we cannot have $*.c as source - gmake doesn't like it,
bmake behaves as documented:

% bmake -r   -f tmf
@=/tmp/target.ext *=target >=/tmp/target.c ^=

gmake just trims suffix:

% make -r -f tmf 
@=/tmp/target.ext *=/tmp/target >= ^=target.c

which I think is expected, we can better see what bmake is doing if we put the
$*.c back as a dependency, but qualify it.
eg.

cat tmf

.SUFFIXES: .ext .c

VPATH = /tmp

/tmp/target.ext: ${.CURDIR}/$*.c
        @echo '@=$@ *=$* >=$> ^=$^'

all: target.ext
%
% bmake -r   -f tmf 
bmake: don't know how to make /tmp//tmp/target.c. Stop

but if we lose the ${.CURDIR}/ qualification it works:

% bmake -r   -f tmf 
@=/tmp/target.ext *=target >=/tmp/target.c ^=
%

on the rhs of the dependency only the suffix is trimed, once we are into the
target context the directory is also.

Bug? hard to say, it has behaved this way for 20+ years

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list