Overwrite variable from makefile

Razer

In my makefile I have a variable FOO:

FOO = /path/to/bar

Is it possible to overwrite this variable during the makefile call? Somthing like the following:

FOO=/path/to/foo make all
Etan Reisner

The ways that variables get assigned values is specified in the How Variables Get Their Values section of the GNU make Manual.

Variables can get values in several different ways:

So, as Colonel Thirty Two indicates, you can override variables set in the makefile on the command line.

You can also, if you expect this to be a variable that you want to set persistently, use the ?= assignment and then environment values for that variable will be used.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Target dependencies from variable in Makefile

From Dev

Generate Target in Makefile from a variable

From Dev

makefile variable from Maven version

From Dev

Pass a variable from bash script to a makefile

From Dev

Makefile unset variable from all further recipes

From Dev

How do I APPEND or OVERWRITE from a variable in BASH?

From Dev

Batch file variable overwrite

From Dev

Trying to overwrite a variable in a method

From Dev

Overwrite Referral Variable

From Dev

Prevent variable overwrite into submakefile

From Dev

Change a make variable, and call another rule, from a recipe in same Makefile?

From Dev

How to use a variable from a Makefile in #ifdef in C++ file

From Dev

makefile - how to exclude file extension suffix from a variable

From Dev

Removing multiple files from directory, as specified by variable in Makefile

From Dev

Get top-level directory from makefile variable

From Dev

Makefile: do operation on files with specific extension from a variable

From Dev

Cannot overwrite variable because it is readonly

From Dev

Cannot overwrite SASS !default variable?

From Dev

Overwrite input variable in R function

From Dev

Scrapy: overwrite DEPTH_LIMIT variable based on value read from custom config

From Dev

Makefile: Run other makefile from makefile

From Dev

makefile delay variable expansion

From Dev

Populate Makefile Variable with For Loop

From Dev

What is the variable $(MAKE) in a makefile?

From Dev

Makefile set variable in target

From Dev

Overriding a makefile variable

From Dev

variable in makefile, unexpected behaviour

From Dev

Makefile wildcard with variable inside

From Dev

Variable expansion in makefile for loop

Related Related

HotTag

Archive