Bug 28373

Summary: Re: make(1) does not correctly substitute in internal macros like $(@F:.o=.c)
Product: Base System Reporter: Giorgos Keramidas <keramida>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: FreeBSD-gnats-submit
Priority: Normal    
Version: 1.0-RELEASE   
Hardware: Any   
OS: Any   

Description Giorgos Keramidas 2001-06-23 20:50:03 UTC
 On Tue, Jan 16, 2001 at 02:44:12AM -0800, Jens.Schweikhardt@marconi.com wrote:
 
 > >Description:
 > 
 > It seems, make(1) doesn't understand substitutions in what the POSIX
 > standard calls internal variables ($@, $%, $?, $< and $*).
 > In the following example, the intent is to substitute any *.o in a *.c,
 > i.e. echo foo.c.
 > 
 > >How-To-Repeat:
 > $ cat Makefile                  
 > .POSIX:
 > foo.o:
 >         echo $(@F:.o=.c)
 > $ /usr/bin/make
 > echo foo.o.o=.c)
 > Syntax error: ")" unexpected
 > *** Error code 2
 > 
 > Stop in /usr/home/sje2bk.
 
 Jens, are you sure this problem still persists to bug you?
 
 Well, the syntax is slightly different in the make(1) program I have
 on my 5.0-CURRENT, and by looking at the CVS logs, it seems that its
 been like that for a while.  The way that BSD make does substitution
 in variables, special or not is described in the paper found at
 /usr/share/doc/psd/12.make/paper.* and an example of it is shown
 below:
 
 
 	% cat Makefile
 
 	SRCS=	main.c foo.c
 	
 	OBJS=	${SRCS:S/.c/.o/g}
 	
 	.c.o:
 		echo Building $@ from ${@:S/.o/.c/g}
 	
 	default: ${OBJS}
 		echo 'Done.'
 
 	% touch main.c foo.c
 
 	% make -s
 
 	Building main.o from main.c
 	Building foo.o from foo.c
 	Done.
 
 Am afraid that I don't know if POSIX specifies a different syntax than
 the ${VARIABLE:modifier} that BSD make uses.  On the other hand, the
 version of GNU make that I have says in its manuals that substitution
 in variables works a little differently than what you wrote.
 
 	% cat GNUmakefile 
 	
 	SRCS=   main.c foo.c
 	
 	OBJS=   $(SRCS:%.c=%.o)
 	
 	all:
 		echo $(OBJS)
 	
 	% gmake -f GNUmakefile 
 	
 	echo main.o foo.o
 	main.o foo.o
 
 I think we can close this PR, if thats ok with you Jens too.
 
 -giorgos
Comment 1 Mike Heffner freebsd_committer freebsd_triage 2001-06-26 01:34:39 UTC
Responsible Changed
From-To: gnats-admin->freebsd-bugs

Misfiled.
Comment 2 dd freebsd_committer freebsd_triage 2001-07-22 15:39:05 UTC
State Changed
From-To: open->closed

response to another pr