bugmake - Bugs: bug #36881, Sample code for $(eval) is...


bug #36881: Sample code for $(eval) is incorrect and fails.

Submitted by:  John Joganic <jjoganic>
Submitted on:  Thu 19 Jul 2012 12:38:40 AM UTC  
Severity:  3 - Normal Item Group:  Documentation
Status:  Not A Bug Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  3.81 Operating System:  None
Fixed Release:  None Triage Status:  None

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Thu 19 Jul 2012 05:31:35 PM UTC, comment #5: 

Sure but if you use the distro-provided program you should always use the distro-provided documentation as well, not documentation you find on the web.  Distributions are by definition virtually always behind the upstream development.

All distros should ship the GNU make manual either as part of the base GNU make package, or as a separate doc package you can install, and that version of the manual should match the version of make on your system.

Paul D. Smith <psmith>
Project Administrator
Thu 19 Jul 2012 05:14:18 PM UTC, comment #4: 

Fair enough. I stand corrected.

I was more concerned over the inability to access the information online as the vast majority of people who use make get it through binary package managers.  The NEWS file is not something that is conveniently available, and all my systems, even ones that I recently provisioned, are running 3.81.

Thank you for the link.  I will bring myself up to date.

John Joganic <jjoganic>
Thu 19 Jul 2012 01:51:25 PM UTC, comment #3: 

3.82 is not a "point release".  The first release of GNU make in modern recorded history (post-RCS) was version 3.03 in 1988.  Every release since then has been 3.x where x goes up by one every release.

The manual is a reference for the current behavior of the program.  It would be unwieldy to continually update it with notes regarding when various features were added.  If you want to know what has changed since previous releases you should read the NEWS file, which is the GNU project's standard way to announce changes between releases.  Even for commercial products you don't see the change history in the manual: that's what release notes are for.  If you want to see the current latest version of NEWS from source code you can use http://cvs.savannah.gnu.org/viewvc/make/NEWS?root=make&view=markup

In any event this particular change is completely backward compatible (since no valid 3.81 makefile would have this syntax), so it is not a risky change.  But we may make plenty of "risky" changes between any 3.x and 3.x+1 release.

Paul D. Smith <psmith>
Project Administrator
Thu 19 Jul 2012 06:03:06 AM UTC, comment #2: 

Thank you for the information.

I must say that I'm rather concerned that fundamental syntax has changed with no mention in the manual.  Many documentation efforts are comprehensive, indicating after what version specific features were added.  Few projects would ever risk a change to the syntax for something as minor as a point release.  I certainly hope that whoever felt so strongly about that equal sign made absolutely certain that 3.82 is also backwards compatible with 3.81.


John Joganic <jjoganic>
Thu 19 Jul 2012 04:47:14 AM UTC, comment #1: 

This is actually one of the most common misunderstandings about GNU make. The online manual always describes the latest released version, which is currently 3.82. The syntax you use was introduced in 3.82, so was not available in 3.81, with the predictable result being that it fails as described. See the changes file for details.

If you need to use 3.81 you should dig a little deeper and get a 3.81 manual.

David Boyce <boyski>
Thu 19 Jul 2012 12:38:40 AM UTC, original submission:  

The sample code reads:

define PROGRAM_template =
  $(1): $$($(1)_OBJS) $$($(1)_LIBS:%=-l%)
  ALL_OBJS   += $$($(1)_OBJS)

 $(foreach prog,$(PROGRAMS),$(eval $(call PROGRAM_template,$(prog))))

However, the '=' following PROGRAM_template causes the definition to have no effect. 

In short, any one using this code as an example to create templates will find that no parameterized rules are actually generated.

John Joganic <jjoganic>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by boyski (Posted a comment)
  • -email is unavailable- added by jjoganic (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-07-19 psmith StatusNone => Not A Bug
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.5