Parameter for rule in Makefile

后端 未结 2 1882
傲寒
傲寒 2021-02-13 16:26

I need to make a Makefile, and it should have a run rule. However, the run requires some parameters.

Does anyone have any idea how I can pass arguments in w

2条回答
  •  走了就别回头了
    2021-02-13 16:59

    When passing parameters to a make command, reference them like you would other internal make variables.

    If your makefile looks like:

    run:
            script $(param1) $(param2)
    

    You can call it with the following syntax:

    $> make run param1=20 param2=30
    

    and make should call the script like:

    script 20 30
    

提交回复
热议问题