Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は小さなcプログラムを作成し、それをコンパイルして実行するためのMakefileを作成しました。基本的に、私は次のことを行います。
$ make $ make run
しかし、私の実行可能ファイルにはいくつかの引数が必要なので、次のように指定したいと思います。
$ make run arg1 arg2
それを達成することは可能ですか?
これはどう?
Makefile
demo: demo1.c cc -o demo1 demo1.c run: ./demo1 $A $B
引数を変数として渡しA、B
A
B
[spatel@mg0008 tmp]$ make run A=2 B=3 ./demo1 2 3 2 + 3 = 5