Reputation: 4097
I have written a small c program and created a Makefile to compile and execute it. Basically, I do the following:
$ make
$ make run
But, my executable requires some arguments, so I would like to specify them this way:
$ make run arg1 arg2
Is it possible to achieve that?
Upvotes: 2
Views: 1897
Reputation: 17437
How about this?
Makefile
demo: demo1.c
cc -o demo1 demo1.c
run:
./demo1 $A $B
Passing argument as a variable A
and B
[spatel@mg0008 tmp]$ make run A=2 B=3
./demo1 2 3
2 + 3 = 5
Upvotes: 2