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 when running a rule in a Makefile? I want to be able to run the run rule with arguments by typing make run foo bar.
I tried this, but it didn’t work:
run:
make compile
./scripts/runTrips $1 $2 $PLACES $OUT $VERS
The parameters I want supplied are the first and the second.
When passing parameters to a make command, reference them like you would other internal make variables.
If your makefile looks like:
You can call it with the following syntax:
and make should call the script like: