Makefile: Passing command line arguments to file inside Makefile

后端 未结 2 2023
滥情空心
滥情空心 2021-02-04 16:23

Inside my Makfile I have the following,

smktestrun: smktest
    @../projects/test.sh

And I call this using:

Make smktestrun
<         


        
相关标签:
2条回答
  • 2021-02-04 16:48

    Something like

    smktestrun: smktest
            @../projects/test.sh $(TESTARGS)
    

    Then call the Makefile with

    $ make smktestrun TESTARGS="-abc"
    
    0 讨论(0)
  • 2021-02-04 17:04

    You could define a variable in Makefile.

    smktestrun: smktest
        @../projects/test.sh ${ARG}
    

    Then the command line of make is:

    make smktestrun ARG="something"
    
    0 讨论(0)
提交回复
热议问题