• Anton Midyukov's avatar
    image.in/functions.mk: protect the code from spontaneous execution · ecbed4b2
    Anton Midyukov authored
    The new make-4.4 does not reset '$(1)', '$(2)', etc. when do recursively
    expanding. So the functions fire spontaneously. The reason for recursive
    expanding might be to use $(shell ...).
    
    To protect the code from spontaneous execution, we add a match check
    '$(0)' to the function name. The '$(0)' variable must always have the
    name of our function at the time of the call. If this is not the case,
    then we are out of the $(call ...) context.
    
    From make documentation:
    
    | The syntax of the 'call' function is:
    |
    |      $(call VARIABLE,PARAM,PARAM,...)
    |
    | When 'make' expands this function, it assigns each PARAM to temporary
    | variables '$(1)', '$(2)', etc.  The variable '$(0)' will contain
    | VARIABLE.
    
    Fix ALT bug 44561
    
    See also:
    https://github.com/osboot/make-initrd/commit/60afcd997affe150fe1153006ffcc1adac735710
    ecbed4b2
functions.mk 2.04 KB