Back out
Bug 659311 for messing up Linux PGO builds.
--- a/Makefile.in
+++ b/Makefile.in
@@ -200,14 +200,29 @@ ifdef MOZ_CRASHREPORTER
endif
codesighs:
$(MAKE) -C $(MOZ_BUILD_APP)/installer codesighs
# defined in package-name.mk
export MOZ_SOURCE_STAMP
+#XXX: this is a hack, since we don't want to clobber for MSVC
+# PGO support, but we can't do this test in client.mk
+ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
+# No point in clobbering if PGO has been explicitly disabled.
+ifndef NO_PROFILE_GUIDED_OPTIMIZE
+maybe_clobber_profiledbuild: clean
+else
+maybe_clobber_profiledbuild:
+endif
+else
+maybe_clobber_profiledbuild:
+endif
+
+.PHONY: maybe_clobber_profiledbuild
+
# Look for R_386_PC32 relocations in shared libs, these
# break x86_64 builds and SELinux users.
ifeq ($(OS_TARGET)_$(TARGET_XPCOM_ABI),Linux_x86-gcc3)
scheck::
@relcount=`find $(DIST)/bin -name "*.so" | xargs objdump -R | grep R_386_PC32 | wc -l` && if test $$relcount -gt 0; then echo "FAILED: R_386_PC32 relocations detected in a shared library. Did you use a system header without adding it to config/system-headers?"; exit 1; else echo "PASSED"; fi
endif
--- a/client.mk
+++ b/client.mk
@@ -207,16 +207,17 @@ ifdef MOZ_OBJDIR
else
PGO_OBJDIR := $(TOPSRCDIR)
endif
profiledbuild::
$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_GENERATE=1
$(MAKE) -C $(PGO_OBJDIR) package
OBJDIR=${PGO_OBJDIR} JARLOG_DIR=${PGO_OBJDIR}/jarlog/en-US $(PROFILE_GEN_SCRIPT)
+ $(MAKE) -f $(TOPSRCDIR)/client.mk maybe_clobber_profiledbuild
$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_USE=1
#####################################################
# Build date unification
ifdef MOZ_UNIFY_BDATE
ifndef MOZ_BUILD_DATE
ifdef MOZ_BUILD_PROJECTS
@@ -248,17 +249,17 @@ else
done
endif
endif
# If we're building multiple projects, but haven't specified which project,
# loop through them.
ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_BUILD_PROJECTS),,1))
-configure depend realbuild install export libs clean realclean distclean alldep preflight postflight upload sdk::
+configure depend realbuild install export libs clean realclean distclean alldep preflight postflight maybe_clobber_profiledbuild upload sdk::
set -e; \
for app in $(MOZ_BUILD_PROJECTS); do \
$(MAKE) -f $(TOPSRCDIR)/client.mk $@ MOZ_CURRENT_PROJECT=$$app; \
done
else
# MOZ_CURRENT_PROJECT: either doing a single-project build, or building an
@@ -348,17 +349,17 @@ endif
realbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
@$(PYTHON) $(TOPSRCDIR)/js/src/config/check-sync-dirs.py $(TOPSRCDIR)/js/src/config $(TOPSRCDIR)/config
$(MOZ_MAKE)
####################################
# Other targets
# Pass these target onto the real build system
-install export libs clean realclean distclean alldep upload sdk:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
+install export libs clean realclean distclean alldep maybe_clobber_profiledbuild upload sdk:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
$(MOZ_MAKE) $@
####################################
# Postflight
realbuild alldep postflight::
ifdef MOZ_POSTFLIGHT
set -e; \
@@ -407,9 +408,9 @@ cleansrcdir:
echo-variable-%:
@echo $($*)
# This makefile doesn't support parallel execution. It does pass
# MOZ_MAKE_FLAGS to sub-make processes, so they will correctly execute
# in parallel.
.NOTPARALLEL:
-.PHONY: checkout real_checkout depend realbuild build profiledbuild export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all upload sdk
+.PHONY: checkout real_checkout depend realbuild build profiledbuild maybe_clobber_profiledbuild export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all upload sdk
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -810,19 +810,16 @@ ifdef PROGRAM
$(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
$(PROGRAM:$(BIN_SUFFIX)=) $(DIST)/$(MOZ_APP_NAME)
endif
ifdef SHARED_LIBRARY
$(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
$(SHARED_LIBRARY_NAME) $(DIST)/$(MOZ_APP_NAME)
endif
endif # SHARED_LIBRARY || PROGRAM
-else # ! WINNT_
-# Force rebuilding all objects on the second pass
-$(OBJS): FORCE
endif # WINNT_
endif # MOZ_PROFILE_USE
ifdef MOZ_PROFILE_GENERATE
# Clean up profiling data during PROFILE_GENERATE phase
export::
ifeq ($(OS_ARCH)_$(GNU_CC), WINNT_)
$(foreach pgd,$(wildcard *.pgd),pgomgr -clear $(pgd);)
else
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -810,19 +810,16 @@ ifdef PROGRAM
$(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
$(PROGRAM:$(BIN_SUFFIX)=) $(DIST)/$(MOZ_APP_NAME)
endif
ifdef SHARED_LIBRARY
$(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
$(SHARED_LIBRARY_NAME) $(DIST)/$(MOZ_APP_NAME)
endif
endif # SHARED_LIBRARY || PROGRAM
-else # ! WINNT_
-# Force rebuilding all objects on the second pass
-$(OBJS): FORCE
endif # WINNT_
endif # MOZ_PROFILE_USE
ifdef MOZ_PROFILE_GENERATE
# Clean up profiling data during PROFILE_GENERATE phase
export::
ifeq ($(OS_ARCH)_$(GNU_CC), WINNT_)
$(foreach pgd,$(wildcard *.pgd),pgomgr -clear $(pgd);)
else