D
Dave Programmer
In a Makefile, I have something like the following:
# makefile start
X = "default_x"
Y = "default_y"
targA:
dosomething -x $(X) -y $(Y)
targB:
$(MAKE) targA X=newX
#makefile end
I'd like to be able to have the option to specify another value of Y
on the command line when making targB and have that passed correctly
to "dosomething"
make targB Y=new_Y
In fact, in my real makefile, I have several such variables I'd like
to be able to modify on the command line. The only way I've been able
to come up with to do this is to modify targB so
targB:
$(MAKE) targA X=newX Y=$(Y)
but this gets unwieldy for several variables. Is there a better way to
do this? Is there a Make macro in which command line variables/macros
are stored?
# makefile start
X = "default_x"
Y = "default_y"
targA:
dosomething -x $(X) -y $(Y)
targB:
$(MAKE) targA X=newX
#makefile end
I'd like to be able to have the option to specify another value of Y
on the command line when making targB and have that passed correctly
to "dosomething"
make targB Y=new_Y
In fact, in my real makefile, I have several such variables I'd like
to be able to modify on the command line. The only way I've been able
to come up with to do this is to modify targB so
targB:
$(MAKE) targA X=newX Y=$(Y)
but this gets unwieldy for several variables. Is there a better way to
do this? Is there a Make macro in which command line variables/macros
are stored?