make: Override Directive
1
1 6.7 The 'override' Directive
1 ============================
1
11 If a variable has been set with a command argument (⇒Overriding
Variables Overriding.), then ordinary assignments in the makefile are
1 ignored. If you want to set the variable in the makefile even though it
1 was set with a command argument, you can use an 'override' directive,
1 which is a line that looks like this:
1
1 override VARIABLE = VALUE
1
1 or
1
1 override VARIABLE := VALUE
1
1 To append more text to a variable defined on the command line, use:
1
1 override VARIABLE += MORE TEXT
1
1 ⇒Appending More Text to Variables Appending.
1
1 Variable assignments marked with the 'override' flag have a higher
1 priority than all other assignments, except another 'override'.
1 Subsequent assignments or appends to this variable which are not marked
1 'override' will be ignored.
1
1 The 'override' directive was not invented for escalation in the war
1 between makefiles and command arguments. It was invented so you can
1 alter and add to values that the user specifies with command arguments.
1
1 For example, suppose you always want the '-g' switch when you run the
1 C compiler, but you would like to allow the user to specify the other
1 switches with a command argument just as usual. You could use this
1 'override' directive:
1
1 override CFLAGS += -g
1
1 You can also use 'override' directives with 'define' directives.
1 This is done as you might expect:
1
1 override define foo =
1 bar
1 endef
1
1 ⇒Defining Multi-Line Variables Multi-Line.
1