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


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

Submitter:  None
Submitted:  Thu 24 Feb 2005 12:38:48 AM UTC
Votes: 1
Severity:  3 - Normal Item Group:  Enhancement
Status:  Later Privacy:  Public
Assigned to:  psmith Open/Closed:  Open
Component Version:  3.80 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  Major Effort
* Mandatory Fields

Add a New Comment Rich Markup

  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 -email is 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>
Group administrator
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 -email is unavailable-



(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 sevanath (Posted a comment)
  • -email is unavailable- added by psmith (Updated the item)

    There is 1 vote so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-09-21 psmith Triage StatusNone Major Effort
    2007-02-26 hashproduct Carbon-Copy- Added hashproduct
    2005-03-04 psmith Item GroupBug Enhancement
    2005-02-27 psmith SummaryMake segfaults when using $(eval) in some ways Make does not allow $(eval) of new targets inside command scripts
    2005-02-27 psmith StatusNone Later
        Assigned toNone psmith
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code