🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #168

Re: Bug report for make

#168
From: Roland McGrath
Date: Mon, 20 Jul 1992 16:23
29 lines
1347 bytes
This is not a bug.  You have misunderstood how Make works.  Variables and
functions in rule targets and dependencies are expanded when the makefile
is read.

> Makefile used (contains 1 line):
> l.m : % : $(basename %).c
> 
> Result obtained in a directory containing only the Makefile file:
> make: *** No way to make target `l.m.c'.  Stop.
> 
> Result expected:
> make: *** No way to make target `l.c'.  Stop.
> 
> Comments:
> why is the basename function not executed?
> If the Makefile is: 
> l.m : % : $(addsuffix i,%).c
> the result is:
> make: *** No way to make target `l.mi.c'.  Stop.
> That shows that it is possible to use a function in a static pattern rule.
> Why does not it work with basename?

In your second makefile, the function is expanded at read time and results in:

l.m: %: %i.c

In the first, `$(basename %)' becomes `%', so the rule is:

l.m: %: %.c
Technical Details
Message-ID: <9207210023.AA12422@churchy.gnu.ai.mit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!gnu.ai.mit.edu!roland
References: <9207191604.AA07604@lune.imag.fr>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!gnu.ai.mit.edu!roland
From: roland@gnu.ai.mit.edu (Roland McGrath)
Subject: Re: Bug report for make
Message-ID: <9207210023.AA12422@churchy.gnu.ai.mit.edu>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
References: <9207191604.AA07604@lune.imag.fr>
Distribution: gnu
Date: Mon, 20 Jul 1992 16:23:36 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 30