tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bmake: variable assignments on command line non-overridable?



On Mon, May 06, 2019 at 08:02:45PM +0200, Edgar Fuß wrote:
> Is it on purpose (surely it's not documented) that, with (b)make, variable 
> assignments on the command line are not overridable in the Makefile?
> Inside the Makefile, assignments can be overrided, so what's the point?

Command line variables are done later, so you can do things like:

INSTDIR=/tmp	# safe default in case user forgot to pass one

in the makefile and then run

  "make install INSTDIR=/opt"

You could use two different variables and use the command line one as
initial value:

MYVAR=${CMDLINEVAR:Usome_default}

and later just override MYVAR if needed.

Martin


Home | Main Index | Thread Index | Old Index