bugmake - Bugs: bug #12124, Make does not allow $(eval) of new...


bug #12124: Make does not allow $(eval) of new targets inside command scripts

Submitted by:  None
Submitted on:  Thu 24 Feb 2005 12:38:48 AM UTC  
Votes:  1  
Severity: 3 - NormalItem Group: Enhancement
Status: LaterPrivacy: Public
Assigned to: Paul D. Smith <psmith>Open/Closed: Open
Component Version: 3.80Operating System: POSIX-Based
Fixed Release: NoneTriage Status: Major Effort

Add a New Comment(Rich Markup)

You are not logged in

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


 Spam posted by sevanath
Sun 27 Feb 2005 05:48:32 PM UTC, comment #1:

Hm. There is a serious problem with defining new prerequisites inside a target like this: make goes through a sanitization/canonicalization process on all targets and prerequisites after all makefiles are read in (file.c:snap_deps()), and the rest of the make algorithm expects this to have been done. Of course it is not done on the target/prerequisite definitions from eval inside a command script.

Changing this will be fairly challenging, and I don't have time to solve this problem before the next release, so I am deferring this bug although I'll leave it open. In the meantime I'm going to install a check to disallow target/prerequisite definitions inside evals in command script contexts, so at least you'll get an error and not a core dump.

As for your issue, I suggest you post to the -unavailable- list with a more detailed description of exactly what you want to do. I strongly suspect that your situation can be handled through auto-generated included makefiles.

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Thu 24 Feb 2005 12:38:48 AM UTC, original submission:

The following makefile will cause make to crash with nice little stack-dance when doing "make foo":

echo deps
$(eval foo: fie)

echo fie

foo: deps
echo foo

[redhog@ystra:~]$ make -d foo
GNU Make 3.80
Considering target file `foo'.
Considering target file `deps'.
File `deps' does not exist.
Finished prerequisites of target file `deps'.
Must remake target `deps'.
echo deps
Putting child 0x089fc8e0 (deps) PID 1806 on the chain.
Live child 0x089fc8e0 (deps) PID 1806
Got a SIGCHLD; 1 unreaped children.
Reaping winning child 0x089fc8e0 PID 1806
Removing child 0x089fc8e0 PID 1806 from chain.
Successfully remade target file `deps'.
Segmentation fault (core dumped)

I'm also interrested in getting help with accomplishing the same as the above code ought to accomplish, but in a way that actually works with the current make program (in reality, deps is an implicit rule, whose stem is used in a shell-command which computes the arguments to eval, and no the ordinary way for automatic prerequisites from the manual with a patsubst and a dirlisting won't cut it, since this must work even for intermediate files...). My e-mail-adress is -unavailable-



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

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by sevanath (Posted a comment)
  • -unavailable- added by psmith (Updated the item)

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

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 21 Sep 2009 12:35:45 AM UTCpsmithTriage StatusNone=>Major Effort
    Mon 26 Feb 2007 09:40:49 PM UTChashproductCarbon-Copy-=>Added hashproduct
    Fri 04 Mar 2005 02:46:33 PM UTCpsmithItem GroupBug=>Enhancement
    Sun 27 Feb 2005 06:15:24 PM UTCpsmithSummaryMake segfaults when using $(eval) in some ways=>Make does not allow $(eval) of new targets inside command scripts
    Sun 27 Feb 2005 05:48:32 PM UTCpsmithStatusNone=>Later
      Assigned toNone=>psmith
      Carbon-Copy-=>Added -unavailable-

    Back to the top

    Powered by Savane 3.1-cleanup1