Kbuild idiom using colon (:) and percent (%) in variable expansion

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












What does the KBuild expression:




FOO := $(BAR:"%"=%)




do as part of a Linux kernel Makefile?




Never mind: I found the answer elsewhere.







share|improve this question





















  • I already answered your question here as well: Make idiom using colon (:) and percent (%) in variable expansion
    – steeldriver
    Jul 12 at 14:12






  • 1




    But the method you discovered is non-portable as it only works with gmake. The method from your question however works in all recent make implementations.
    – schily
    Jul 12 at 14:14














up vote
0
down vote

favorite












What does the KBuild expression:




FOO := $(BAR:"%"=%)




do as part of a Linux kernel Makefile?




Never mind: I found the answer elsewhere.







share|improve this question





















  • I already answered your question here as well: Make idiom using colon (:) and percent (%) in variable expansion
    – steeldriver
    Jul 12 at 14:12






  • 1




    But the method you discovered is non-portable as it only works with gmake. The method from your question however works in all recent make implementations.
    – schily
    Jul 12 at 14:14












up vote
0
down vote

favorite









up vote
0
down vote

favorite











What does the KBuild expression:




FOO := $(BAR:"%"=%)




do as part of a Linux kernel Makefile?




Never mind: I found the answer elsewhere.







share|improve this question













What does the KBuild expression:




FOO := $(BAR:"%"=%)




do as part of a Linux kernel Makefile?




Never mind: I found the answer elsewhere.









share|improve this question












share|improve this question




share|improve this question








edited Jul 12 at 14:02









Kusalananda

101k13199312




101k13199312









asked Jul 12 at 13:50









JohnRWicks

42




42











  • I already answered your question here as well: Make idiom using colon (:) and percent (%) in variable expansion
    – steeldriver
    Jul 12 at 14:12






  • 1




    But the method you discovered is non-portable as it only works with gmake. The method from your question however works in all recent make implementations.
    – schily
    Jul 12 at 14:14
















  • I already answered your question here as well: Make idiom using colon (:) and percent (%) in variable expansion
    – steeldriver
    Jul 12 at 14:12






  • 1




    But the method you discovered is non-portable as it only works with gmake. The method from your question however works in all recent make implementations.
    – schily
    Jul 12 at 14:14















I already answered your question here as well: Make idiom using colon (:) and percent (%) in variable expansion
– steeldriver
Jul 12 at 14:12




I already answered your question here as well: Make idiom using colon (:) and percent (%) in variable expansion
– steeldriver
Jul 12 at 14:12




1




1




But the method you discovered is non-portable as it only works with gmake. The method from your question however works in all recent make implementations.
– schily
Jul 12 at 14:14




But the method you discovered is non-portable as it only works with gmake. The method from your question however works in all recent make implementations.
– schily
Jul 12 at 14:14










2 Answers
2






active

oldest

votes

















up vote
0
down vote













It assigns the value of the Makefile variable BAR to FOO, but removes all double quotes around words.



Example:



BAR:= "hello" "world"
FOO:= $(BAR:"%"=%)

all:
@echo 'BAR = $(BAR)'
@echo 'FOO = $(FOO)'


Testing:



$ make
BAR = "hello" "world"
FOO = hello world





share|improve this answer




























    up vote
    -1
    down vote













    This is a so called pattern macro replacement.



    The feature was first introduced in 1986 in SunPro Make and is also part of gmake.



    The construct



    $(VAR:op%os=np%ns)


    uses % as a match all case and allows to replace the old prefix and suffix by a new prefix and suffix.



    In your case, it removes " around words, since old prefix and old suffix are both " and new prefix and new suffix are both empty.






    share|improve this answer





















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );








       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454902%2fkbuild-idiom-using-colon-and-percent-in-variable-expansion%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      0
      down vote













      It assigns the value of the Makefile variable BAR to FOO, but removes all double quotes around words.



      Example:



      BAR:= "hello" "world"
      FOO:= $(BAR:"%"=%)

      all:
      @echo 'BAR = $(BAR)'
      @echo 'FOO = $(FOO)'


      Testing:



      $ make
      BAR = "hello" "world"
      FOO = hello world





      share|improve this answer

























        up vote
        0
        down vote













        It assigns the value of the Makefile variable BAR to FOO, but removes all double quotes around words.



        Example:



        BAR:= "hello" "world"
        FOO:= $(BAR:"%"=%)

        all:
        @echo 'BAR = $(BAR)'
        @echo 'FOO = $(FOO)'


        Testing:



        $ make
        BAR = "hello" "world"
        FOO = hello world





        share|improve this answer























          up vote
          0
          down vote










          up vote
          0
          down vote









          It assigns the value of the Makefile variable BAR to FOO, but removes all double quotes around words.



          Example:



          BAR:= "hello" "world"
          FOO:= $(BAR:"%"=%)

          all:
          @echo 'BAR = $(BAR)'
          @echo 'FOO = $(FOO)'


          Testing:



          $ make
          BAR = "hello" "world"
          FOO = hello world





          share|improve this answer













          It assigns the value of the Makefile variable BAR to FOO, but removes all double quotes around words.



          Example:



          BAR:= "hello" "world"
          FOO:= $(BAR:"%"=%)

          all:
          @echo 'BAR = $(BAR)'
          @echo 'FOO = $(FOO)'


          Testing:



          $ make
          BAR = "hello" "world"
          FOO = hello world






          share|improve this answer













          share|improve this answer



          share|improve this answer











          answered Jul 12 at 14:01









          Kusalananda

          101k13199312




          101k13199312






















              up vote
              -1
              down vote













              This is a so called pattern macro replacement.



              The feature was first introduced in 1986 in SunPro Make and is also part of gmake.



              The construct



              $(VAR:op%os=np%ns)


              uses % as a match all case and allows to replace the old prefix and suffix by a new prefix and suffix.



              In your case, it removes " around words, since old prefix and old suffix are both " and new prefix and new suffix are both empty.






              share|improve this answer

























                up vote
                -1
                down vote













                This is a so called pattern macro replacement.



                The feature was first introduced in 1986 in SunPro Make and is also part of gmake.



                The construct



                $(VAR:op%os=np%ns)


                uses % as a match all case and allows to replace the old prefix and suffix by a new prefix and suffix.



                In your case, it removes " around words, since old prefix and old suffix are both " and new prefix and new suffix are both empty.






                share|improve this answer























                  up vote
                  -1
                  down vote










                  up vote
                  -1
                  down vote









                  This is a so called pattern macro replacement.



                  The feature was first introduced in 1986 in SunPro Make and is also part of gmake.



                  The construct



                  $(VAR:op%os=np%ns)


                  uses % as a match all case and allows to replace the old prefix and suffix by a new prefix and suffix.



                  In your case, it removes " around words, since old prefix and old suffix are both " and new prefix and new suffix are both empty.






                  share|improve this answer













                  This is a so called pattern macro replacement.



                  The feature was first introduced in 1986 in SunPro Make and is also part of gmake.



                  The construct



                  $(VAR:op%os=np%ns)


                  uses % as a match all case and allows to replace the old prefix and suffix by a new prefix and suffix.



                  In your case, it removes " around words, since old prefix and old suffix are both " and new prefix and new suffix are both empty.







                  share|improve this answer













                  share|improve this answer



                  share|improve this answer











                  answered Jul 12 at 13:59









                  schily

                  8,46521435




                  8,46521435






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454902%2fkbuild-idiom-using-colon-and-percent-in-variable-expansion%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Displaying single band from multi-band raster using QGIS

                      How many registers does an x86_64 CPU actually have?