Menu

patsubst changes $* in a pattern rule

Help
Brian
2011-11-22
2013-03-15
  • Brian

    Brian - 2011-11-22

    Using makepp version 1.50-1009181-09137-0902101
    With this Makeppfile:

    all:  file.v
       
    %.v : %.vcp
            echo $* && echo $(patsubst bla_%,foo_%,bla_moo) $* && cp $< $@
    

    I get the following.

       echo file && echo foo_moo moo && cp file.vcp file.v
       file
       foo_moo moo
    

    It appears that $* is getting overwritten by the match from the patsubst function as a side-effect of the underlying Mpp::Text::pattern_substitution routine.

    Trying the same rule with GNU make (v3.82) results in the following:

       echo file && echo foo_moo file && cp file.vcp file.v
       file
       foo_moo file
    

    It looks like the same behavior exists in the latest version of makepp.  Has this been seen before and is it considered a bug or a feature?

     
  • Daniel Pfeiffer

    Daniel Pfeiffer - 2011-11-22

    Well spotted!  The problem is that the filesubst function is internally used for setting up the rule.  I'm still working on trying to separate the internal case from the advertised publicly usable case (which is common to patsubst).  No success so far, but I'll get there.

     
  • Daniel Pfeiffer

    Daniel Pfeiffer - 2011-11-25

    Fixed in cvs.

     
  • Brian

    Brian - 2011-11-29

    Thanks, will try it out.

     

Log in to post a comment.