I have a makefile and I pass a parameter to it through command line. Say I pass parameter for clock frequency such as this.
make run FREQ=500
In my makefile, I want to include the value of FREQ inside a string, for example, I want to expand it like this.
RUN_FLG = "--frequency = 500"
I know you can use $(FREQ) if you are using that parameter normally (not inside strings), but how do you expand it inside a string?
makedoesn’t know what a string is; you embed the macro reference into the string the same as outside a string:I’ve ‘corrected’ the spacing in the
--frequency; you would not normally have the=separate from the option text, and the value would also follow without spaces.I’ve provided a default value for FREQ inside the
makefileso that if it is invoked without anyFREQ=500override, you still have the default value as part of$(RUN_FLG).