call macro twice in foreach call in Make










0















I have a macro that calls a target for each seed:



define MY_MACRO
$(foreach seed, $(shell $(SHELL_EXPORT) seq $(3) $(4)), $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME)))
endef


Is there a way I can call two different targets, one followed by the other? This one calls my FIRST_TARGET_NAME for every seed with the TEST_TARGET_MACRO.



Something like this...



define MY_MACRO
$(foreach seed, $(shell $(SHELL_EXPORT) seq $(3) $(4)), $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME), $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), SECOND_TARGET_NAME)))
endef


so that it will eval the first call and then the second call for each seed.



I couldn't seem to find a way to do this.... or find anything online










share|improve this question


























    0















    I have a macro that calls a target for each seed:



    define MY_MACRO
    $(foreach seed, $(shell $(SHELL_EXPORT) seq $(3) $(4)), $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME)))
    endef


    Is there a way I can call two different targets, one followed by the other? This one calls my FIRST_TARGET_NAME for every seed with the TEST_TARGET_MACRO.



    Something like this...



    define MY_MACRO
    $(foreach seed, $(shell $(SHELL_EXPORT) seq $(3) $(4)), $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME), $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), SECOND_TARGET_NAME)))
    endef


    so that it will eval the first call and then the second call for each seed.



    I couldn't seem to find a way to do this.... or find anything online










    share|improve this question
























      0












      0








      0








      I have a macro that calls a target for each seed:



      define MY_MACRO
      $(foreach seed, $(shell $(SHELL_EXPORT) seq $(3) $(4)), $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME)))
      endef


      Is there a way I can call two different targets, one followed by the other? This one calls my FIRST_TARGET_NAME for every seed with the TEST_TARGET_MACRO.



      Something like this...



      define MY_MACRO
      $(foreach seed, $(shell $(SHELL_EXPORT) seq $(3) $(4)), $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME), $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), SECOND_TARGET_NAME)))
      endef


      so that it will eval the first call and then the second call for each seed.



      I couldn't seem to find a way to do this.... or find anything online










      share|improve this question














      I have a macro that calls a target for each seed:



      define MY_MACRO
      $(foreach seed, $(shell $(SHELL_EXPORT) seq $(3) $(4)), $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME)))
      endef


      Is there a way I can call two different targets, one followed by the other? This one calls my FIRST_TARGET_NAME for every seed with the TEST_TARGET_MACRO.



      Something like this...



      define MY_MACRO
      $(foreach seed, $(shell $(SHELL_EXPORT) seq $(3) $(4)), $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME), $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), SECOND_TARGET_NAME)))
      endef


      so that it will eval the first call and then the second call for each seed.



      I couldn't seem to find a way to do this.... or find anything online







      foreach makefile macros






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 0:44









      jimmyhuang0904jimmyhuang0904

      123




      123






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I'm not really sure what you're trying to do, but why can't you just write the eval/call twice? Like this:



          define MY_MACRO
          $(foreach seed, $(shell $(SHELL_EXPORT) seq $(3) $(4)),
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME)
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), SECOND_TARGET_NAME))))
          endef


          Here's my simple, complete example:



          TEST_TARGET_MACRO = all:: ; $(info 1=$1 2=$2 3=$3 4=$4)

          define MY_MACRO
          $(foreach seed, $(shell seq $(3) $(4)),
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME)
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), SECOND_TARGET_NAME))))
          endef

          $(call MY_MACRO,foo,bar,2,5)


          and here's the output which is just what I'd expect:



          1= foo 2= bar 3= 2 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 2 4= SECOND_TARGET_NAME
          1= foo 2= bar 3= 3 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 3 4= SECOND_TARGET_NAME
          1= foo 2= bar 3= 4 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 4 4= SECOND_TARGET_NAME
          1= foo 2= bar 3= 5 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 5 4= SECOND_TARGET_NAME
          make: 'all' is up to date.





          share|improve this answer

























          • This is what I want to do, and I tried this, but it seems like only the FIRST_TARGET_NAME is being called and not the SECOND_TARGET_NAME.

            – jimmyhuang0904
            Nov 16 '18 at 18:52











          • Well, you'll have to provide a SSCCE sscce.org then because I created a sample makefile here with a simple definition for TEST_TARGET_MACRO and it worked just as I'd expect.

            – MadScientist
            Nov 16 '18 at 22:15










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291577%2fcall-macro-twice-in-foreach-call-in-make%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I'm not really sure what you're trying to do, but why can't you just write the eval/call twice? Like this:



          define MY_MACRO
          $(foreach seed, $(shell $(SHELL_EXPORT) seq $(3) $(4)),
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME)
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), SECOND_TARGET_NAME))))
          endef


          Here's my simple, complete example:



          TEST_TARGET_MACRO = all:: ; $(info 1=$1 2=$2 3=$3 4=$4)

          define MY_MACRO
          $(foreach seed, $(shell seq $(3) $(4)),
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME)
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), SECOND_TARGET_NAME))))
          endef

          $(call MY_MACRO,foo,bar,2,5)


          and here's the output which is just what I'd expect:



          1= foo 2= bar 3= 2 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 2 4= SECOND_TARGET_NAME
          1= foo 2= bar 3= 3 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 3 4= SECOND_TARGET_NAME
          1= foo 2= bar 3= 4 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 4 4= SECOND_TARGET_NAME
          1= foo 2= bar 3= 5 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 5 4= SECOND_TARGET_NAME
          make: 'all' is up to date.





          share|improve this answer

























          • This is what I want to do, and I tried this, but it seems like only the FIRST_TARGET_NAME is being called and not the SECOND_TARGET_NAME.

            – jimmyhuang0904
            Nov 16 '18 at 18:52











          • Well, you'll have to provide a SSCCE sscce.org then because I created a sample makefile here with a simple definition for TEST_TARGET_MACRO and it worked just as I'd expect.

            – MadScientist
            Nov 16 '18 at 22:15















          0














          I'm not really sure what you're trying to do, but why can't you just write the eval/call twice? Like this:



          define MY_MACRO
          $(foreach seed, $(shell $(SHELL_EXPORT) seq $(3) $(4)),
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME)
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), SECOND_TARGET_NAME))))
          endef


          Here's my simple, complete example:



          TEST_TARGET_MACRO = all:: ; $(info 1=$1 2=$2 3=$3 4=$4)

          define MY_MACRO
          $(foreach seed, $(shell seq $(3) $(4)),
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME)
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), SECOND_TARGET_NAME))))
          endef

          $(call MY_MACRO,foo,bar,2,5)


          and here's the output which is just what I'd expect:



          1= foo 2= bar 3= 2 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 2 4= SECOND_TARGET_NAME
          1= foo 2= bar 3= 3 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 3 4= SECOND_TARGET_NAME
          1= foo 2= bar 3= 4 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 4 4= SECOND_TARGET_NAME
          1= foo 2= bar 3= 5 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 5 4= SECOND_TARGET_NAME
          make: 'all' is up to date.





          share|improve this answer

























          • This is what I want to do, and I tried this, but it seems like only the FIRST_TARGET_NAME is being called and not the SECOND_TARGET_NAME.

            – jimmyhuang0904
            Nov 16 '18 at 18:52











          • Well, you'll have to provide a SSCCE sscce.org then because I created a sample makefile here with a simple definition for TEST_TARGET_MACRO and it worked just as I'd expect.

            – MadScientist
            Nov 16 '18 at 22:15













          0












          0








          0







          I'm not really sure what you're trying to do, but why can't you just write the eval/call twice? Like this:



          define MY_MACRO
          $(foreach seed, $(shell $(SHELL_EXPORT) seq $(3) $(4)),
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME)
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), SECOND_TARGET_NAME))))
          endef


          Here's my simple, complete example:



          TEST_TARGET_MACRO = all:: ; $(info 1=$1 2=$2 3=$3 4=$4)

          define MY_MACRO
          $(foreach seed, $(shell seq $(3) $(4)),
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME)
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), SECOND_TARGET_NAME))))
          endef

          $(call MY_MACRO,foo,bar,2,5)


          and here's the output which is just what I'd expect:



          1= foo 2= bar 3= 2 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 2 4= SECOND_TARGET_NAME
          1= foo 2= bar 3= 3 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 3 4= SECOND_TARGET_NAME
          1= foo 2= bar 3= 4 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 4 4= SECOND_TARGET_NAME
          1= foo 2= bar 3= 5 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 5 4= SECOND_TARGET_NAME
          make: 'all' is up to date.





          share|improve this answer















          I'm not really sure what you're trying to do, but why can't you just write the eval/call twice? Like this:



          define MY_MACRO
          $(foreach seed, $(shell $(SHELL_EXPORT) seq $(3) $(4)),
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME)
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), SECOND_TARGET_NAME))))
          endef


          Here's my simple, complete example:



          TEST_TARGET_MACRO = all:: ; $(info 1=$1 2=$2 3=$3 4=$4)

          define MY_MACRO
          $(foreach seed, $(shell seq $(3) $(4)),
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), FIRST_TARGET_NAME)
          $(eval $(call TEST_TARGET_MACRO, $(1), $(2), $(seed), SECOND_TARGET_NAME))))
          endef

          $(call MY_MACRO,foo,bar,2,5)


          and here's the output which is just what I'd expect:



          1= foo 2= bar 3= 2 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 2 4= SECOND_TARGET_NAME
          1= foo 2= bar 3= 3 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 3 4= SECOND_TARGET_NAME
          1= foo 2= bar 3= 4 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 4 4= SECOND_TARGET_NAME
          1= foo 2= bar 3= 5 4= FIRST_TARGET_NAME
          1= foo 2= bar 3= 5 4= SECOND_TARGET_NAME
          make: 'all' is up to date.






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 16 '18 at 22:17

























          answered Nov 14 '18 at 5:34









          MadScientistMadScientist

          47k55268




          47k55268












          • This is what I want to do, and I tried this, but it seems like only the FIRST_TARGET_NAME is being called and not the SECOND_TARGET_NAME.

            – jimmyhuang0904
            Nov 16 '18 at 18:52











          • Well, you'll have to provide a SSCCE sscce.org then because I created a sample makefile here with a simple definition for TEST_TARGET_MACRO and it worked just as I'd expect.

            – MadScientist
            Nov 16 '18 at 22:15

















          • This is what I want to do, and I tried this, but it seems like only the FIRST_TARGET_NAME is being called and not the SECOND_TARGET_NAME.

            – jimmyhuang0904
            Nov 16 '18 at 18:52











          • Well, you'll have to provide a SSCCE sscce.org then because I created a sample makefile here with a simple definition for TEST_TARGET_MACRO and it worked just as I'd expect.

            – MadScientist
            Nov 16 '18 at 22:15
















          This is what I want to do, and I tried this, but it seems like only the FIRST_TARGET_NAME is being called and not the SECOND_TARGET_NAME.

          – jimmyhuang0904
          Nov 16 '18 at 18:52





          This is what I want to do, and I tried this, but it seems like only the FIRST_TARGET_NAME is being called and not the SECOND_TARGET_NAME.

          – jimmyhuang0904
          Nov 16 '18 at 18:52













          Well, you'll have to provide a SSCCE sscce.org then because I created a sample makefile here with a simple definition for TEST_TARGET_MACRO and it worked just as I'd expect.

          – MadScientist
          Nov 16 '18 at 22:15





          Well, you'll have to provide a SSCCE sscce.org then because I created a sample makefile here with a simple definition for TEST_TARGET_MACRO and it worked just as I'd expect.

          – MadScientist
          Nov 16 '18 at 22:15



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291577%2fcall-macro-twice-in-foreach-call-in-make%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kleinkühnau

          Makov (Slowakei)

          Deutsches Schauspielhaus