I use Makefiles.
I have a target called run
which runs the build target. Simplified, it looks like the following:
prog: .... ... run: prog ./prog
Is there any way to pass arguments? So that
make run asdf --> ./prog asdf make run the dog kicked the cat --> ./prog the dog kicked the cat
Unless an argument is passed by value (BYVALUE), a reference to an argument, not its value, is generally passed to a subroutine or function. This is known as passing arguments by reference, or BYADDR.
The variable $@ represents the name of the target and $< represents the first prerequisite required to create the output file.
I don't know a way to do what you want exactly, but a workaround might be:
run: ./prog ./prog $(ARGS)
Then:
make ARGS="asdf" run # or make run ARGS="asdf"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With