Linux

Monday, March 12, 2007

Makefile -overriding variables

To override the variables defined in the makefile from the command line,this will do
make CFLAGS='-g -O' .This will override the assignment of CFLAGS in the makefile. the simple assignment in the makefile will be ignored. Found this out from [1]

There is a way to override this assignment in the command line using the override directive
If a variable has been set with a command argument , then ordinary assignments in the makefile are ignored. If you want to set the variable in the makefile even though it was set with a command argument, you can use an override directive.
Syntax:
In makefile use
override variable = value


Further details in [2]

References:
[1] http://www.gnu.org/software/autoconf/manual/make/Overriding.html
[2]
http://www.gnu.org/software/autoconf/manual/make/Override-Directive.html#Override-Directive

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home