Bug 1380547 - Add a variable other than DEFINES for defines that are set from Makefiles. draft
authorChris Manchester <cmanchester@mozilla.com>
Tue, 08 Aug 2017 15:43:04 -0700
changeset 642884 8f12ada0f6a801a116ac4a30fb707e97c7eb0cdf
parent 642173 fde1450a4368d04e97174e2eb00fb48901179857
child 725132 a75dd443f04fd245aef7ad466177e192e2cd9cca
push id72902
push userbmo:cmanchester@mozilla.com
push dateTue, 08 Aug 2017 22:43:11 +0000
bugs1380547
milestone57.0a1
Bug 1380547 - Add a variable other than DEFINES for defines that are set from Makefiles. As we move our compile command lines into mozbuild we want to stop using DEFINES directly. This patch adds a variable that can be set from Makefiles to contribute defines to a compile command line to help the transition. MozReview-Commit-ID: 5xLB06pzpJY
config/config.mk
toolkit/xre/Makefile.in
--- a/config/config.mk
+++ b/config/config.mk
@@ -323,18 +323,18 @@ endif # CLANG_CL
 
 # Use warnings-as-errors if ALLOW_COMPILER_WARNINGS is not set to 1 (which
 # includes the case where it's undefined).
 ifneq (1,$(ALLOW_COMPILER_WARNINGS))
 CXXFLAGS += $(WARNINGS_AS_ERRORS)
 CFLAGS   += $(WARNINGS_AS_ERRORS)
 endif # ALLOW_COMPILER_WARNINGS
 
-COMPILE_CFLAGS	= $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS) $(_DEPEND_CFLAGS) $(CFLAGS) $(MOZBUILD_CFLAGS)
-COMPILE_CXXFLAGS = $(if $(DISABLE_STL_WRAPPING),,$(STL_FLAGS)) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS) $(_DEPEND_CFLAGS) $(CXXFLAGS) $(MOZBUILD_CXXFLAGS)
+COMPILE_CFLAGS	= $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS) $(_DEPEND_CFLAGS) $(CFLAGS) $(MOZBUILD_CFLAGS) $(MK_COMPILE_DEFINES)
+COMPILE_CXXFLAGS = $(if $(DISABLE_STL_WRAPPING),,$(STL_FLAGS)) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS) $(_DEPEND_CFLAGS) $(CXXFLAGS) $(MOZBUILD_CXXFLAGS) $(MK_COMPILE_DEFINES)
 COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS) $(MOZBUILD_CMFLAGS)
 COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS) $(MOZBUILD_CMMFLAGS)
 ASFLAGS += $(MOZBUILD_ASFLAGS)
 
 ifndef CROSS_COMPILE
 HOST_CFLAGS += $(RTL_FLAGS)
 endif
 
--- a/toolkit/xre/Makefile.in
+++ b/toolkit/xre/Makefile.in
@@ -7,15 +7,15 @@
 
 milestone_txt = $(topsrcdir)/config/milestone.txt
 
 include $(topsrcdir)/config/rules.mk
 
 MOZ_BUILDID   := $(shell awk '{print $$3}' $(DEPTH)/buildid.h)
 $(call errorIfEmpty,GRE_MILESTONE MOZ_BUILDID)
 
+MK_COMPILE_DEFINES = -DMOZ_BUILDID=$(MOZ_BUILDID)
+
 # Note these dependencies are broken because the target is *not* the cpp file.
 # BUT, actually fixing it would make libxul rebuilt on every single incremental
 # build because of the automatic buildid change. This is why we can't actually
 # include buildid.h there, because it would add the dependency.
 $(srcdir)/nsAppRunner.cpp: $(DEPTH)/buildid.h $(milestone_txt)
-
-nsAppRunner.$(OBJ_SUFFIX): DEFINES += -DMOZ_BUILDID=$(MOZ_BUILDID)