Closed Bug 914482 Opened 9 years ago Closed 9 years ago

Allow overrides from the command line for variables defined in moz.build

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla26

People

(Reporter: glandium, Assigned: glandium)

Details

Attachments

(1 file)

There are many reasons why one may want to run make -C foo BAR=some_value, overriding what is defined in Makefiles. But ever since some variables were moved to moz.build, those variables can't be overriden this way, and it's inconvenient.
Comment on attachment 802043 [details] [diff] [review]
Allow overrides from the command line for variables defined in moz.build

Review of attachment 802043 [details] [diff] [review]:
-----------------------------------------------------------------

::: config/rules.mk
@@ +53,5 @@
>  # Using $(firstword) may not be perfect. But it should be good enough for most
>  # scenarios.
>  _current_makefile = $(CURDIR)/$(firstword $(MAKEFILE_LIST))
>  
> +$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES),$(if $(filter file override,$(subst $(NULL) ,_,$(origin $(var)))),\

Do we actually use override?

Why the $(subst $(NULL) bit? https://www.gnu.org/software/make/manual/make.html#Origin-Function says $(origin) will always return a value.
Attachment #802043 - Flags: review?(gps) → review+
(In reply to Gregory Szorc [:gps] from comment #2)
> Comment on attachment 802043 [details] [diff] [review]
> Allow overrides from the command line for variables defined in moz.build
> 
> Review of attachment 802043 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: config/rules.mk
> @@ +53,5 @@
> >  # Using $(firstword) may not be perfect. But it should be good enough for most
> >  # scenarios.
> >  _current_makefile = $(CURDIR)/$(firstword $(MAKEFILE_LIST))
> >  
> > +$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES),$(if $(filter file override,$(subst $(NULL) ,_,$(origin $(var)))),\
> 
> Do we actually use override?

We don't, but better safe than sorry. (and I think we should, for some variables)

> Why the $(subst $(NULL) bit?
> https://www.gnu.org/software/make/manual/make.html#Origin-Function says
> $(origin) will always return a value.

Because some values returned by origin contain a space.
Backed out for b2g bustage:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b9552f5d4476

And relanded with a fixup in dom/camera/test/Makefile.in:
https://hg.mozilla.org/integration/mozilla-inbound/rev/feea0997db36
https://hg.mozilla.org/mozilla-central/rev/feea0997db36
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.