Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | # |
michael@0 | 2 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | |
michael@0 | 6 | ifndef .PYMAKE |
michael@0 | 7 | ifeq (,$(MAKE_VERSION)) |
michael@0 | 8 | $(error GNU Make is required) |
michael@0 | 9 | endif |
michael@0 | 10 | make_min_ver := 3.81 |
michael@0 | 11 | ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION)))) |
michael@0 | 12 | $(error GNU Make $(make_min_ver) or higher is required) |
michael@0 | 13 | endif |
michael@0 | 14 | endif |
michael@0 | 15 | |
michael@0 | 16 | export TOPLEVEL_BUILD := 1 |
michael@0 | 17 | |
michael@0 | 18 | default:: |
michael@0 | 19 | |
michael@0 | 20 | ifdef MOZ_BUILD_APP |
michael@0 | 21 | include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk |
michael@0 | 22 | endif |
michael@0 | 23 | |
michael@0 | 24 | include $(topsrcdir)/config/config.mk |
michael@0 | 25 | |
michael@0 | 26 | GARBAGE_DIRS += dist _javagen _profile staticlib |
michael@0 | 27 | DIST_GARBAGE = config.cache config.log config.status* config-defs.h \ |
michael@0 | 28 | config/autoconf.mk \ |
michael@0 | 29 | mozilla-config.h \ |
michael@0 | 30 | netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \ |
michael@0 | 31 | .mozconfig.mk |
michael@0 | 32 | |
michael@0 | 33 | ifdef JS_STANDALONE |
michael@0 | 34 | configure_dir = $(topsrcdir)/js/src |
michael@0 | 35 | else |
michael@0 | 36 | configure_dir = $(topsrcdir) |
michael@0 | 37 | endif |
michael@0 | 38 | |
michael@0 | 39 | ifndef MOZ_PROFILE_USE |
michael@0 | 40 | # We need to explicitly put backend.RecursiveMakeBackend here |
michael@0 | 41 | # otherwise the rule in rules.mk doesn't run early enough. |
michael@0 | 42 | libs binaries export tools:: CLOBBER $(configure_dir)/configure config.status backend.RecursiveMakeBackend |
michael@0 | 43 | ifndef JS_STANDALONE |
michael@0 | 44 | ifndef LIBXUL_SDK |
michael@0 | 45 | libs binaries export tools:: $(topsrcdir)/js/src/configure js/src/config.status |
michael@0 | 46 | endif |
michael@0 | 47 | endif |
michael@0 | 48 | endif |
michael@0 | 49 | |
michael@0 | 50 | ifdef JS_STANDALONE |
michael@0 | 51 | .PHONY: CLOBBER |
michael@0 | 52 | CLOBBER: |
michael@0 | 53 | else |
michael@0 | 54 | CLOBBER: $(topsrcdir)/CLOBBER |
michael@0 | 55 | @echo 'STOP! The CLOBBER file has changed.' |
michael@0 | 56 | @echo 'Please run the build through a sanctioned build wrapper, such as' |
michael@0 | 57 | @echo '"mach build" or client.mk.' |
michael@0 | 58 | @exit 1 |
michael@0 | 59 | endif |
michael@0 | 60 | |
michael@0 | 61 | $(topsrcdir)/configure: $(topsrcdir)/configure.in |
michael@0 | 62 | $(topsrcdir)/js/src/configure: $(topsrcdir)/js/src/configure.in |
michael@0 | 63 | $(topsrcdir)/configure $(topsrcdir)/js/src/configure: |
michael@0 | 64 | @echo 'STOP! $^ has changed, and your configure is out of date.' |
michael@0 | 65 | @echo 'Please rerun autoconf and re-configure your build directory.' |
michael@0 | 66 | @echo 'To ignore this message, touch "$@",' |
michael@0 | 67 | @echo 'but your build might not succeed.' |
michael@0 | 68 | @exit 1 |
michael@0 | 69 | |
michael@0 | 70 | config.status: $(configure_dir)/configure |
michael@0 | 71 | js/src/config.status: $(topsrcdir)/js/src/configure |
michael@0 | 72 | config.status js/src/config.status: |
michael@0 | 73 | @echo 'STOP! $^ has changed and needs to be run again.' |
michael@0 | 74 | @echo 'Please rerun it.' |
michael@0 | 75 | @echo 'To ignore this message, touch "$(CURDIR)/$@",' |
michael@0 | 76 | @echo 'but your build might not succeed.' |
michael@0 | 77 | @exit 1 |
michael@0 | 78 | |
michael@0 | 79 | # Regenerate the build backend if it is out of date. We only have this rule in |
michael@0 | 80 | # this main make file because having it in rules.mk and applied to partial tree |
michael@0 | 81 | # builds resulted in a world of hurt. Gory details are in bug 877308. |
michael@0 | 82 | # |
michael@0 | 83 | # The mach build driver will ensure the backend is up to date for partial tree |
michael@0 | 84 | # builds. This cleanly avoids most of the pain. |
michael@0 | 85 | |
michael@0 | 86 | backend.RecursiveMakeBackend: |
michael@0 | 87 | @echo 'Build configuration changed. Regenerating backend.' |
michael@0 | 88 | $(PYTHON) config.status |
michael@0 | 89 | |
michael@0 | 90 | Makefile: backend.RecursiveMakeBackend |
michael@0 | 91 | @$(TOUCH) $@ |
michael@0 | 92 | |
michael@0 | 93 | include backend.RecursiveMakeBackend.pp |
michael@0 | 94 | |
michael@0 | 95 | default:: backend.RecursiveMakeBackend |
michael@0 | 96 | |
michael@0 | 97 | install_manifests := bin idl include public private sdk |
michael@0 | 98 | install_manifest_depends = \ |
michael@0 | 99 | CLOBBER \ |
michael@0 | 100 | $(configure_dir)/configure \ |
michael@0 | 101 | config.status \ |
michael@0 | 102 | backend.RecursiveMakeBackend \ |
michael@0 | 103 | $(NULL) |
michael@0 | 104 | |
michael@0 | 105 | ifndef JS_STANDALONE |
michael@0 | 106 | ifndef LIBXUL_SDK |
michael@0 | 107 | install_manifest_depends += \ |
michael@0 | 108 | $(topsrcdir)/js/src/configure \ |
michael@0 | 109 | js/src/config.status \ |
michael@0 | 110 | $(NULL) |
michael@0 | 111 | endif |
michael@0 | 112 | endif |
michael@0 | 113 | |
michael@0 | 114 | .PHONY: install-manifests |
michael@0 | 115 | install-manifests: $(addprefix install-dist-,$(install_manifests)) |
michael@0 | 116 | |
michael@0 | 117 | # process_install_manifest needs to be invoked with --no-remove when building |
michael@0 | 118 | # js as standalone because automated builds are building nspr separately and |
michael@0 | 119 | # that would remove the resulting files. |
michael@0 | 120 | # Eventually, a standalone js build would just be able to build nspr itself, |
michael@0 | 121 | # removing the need for the former. |
michael@0 | 122 | ifdef JS_STANDALONE |
michael@0 | 123 | NO_REMOVE=1 |
michael@0 | 124 | endif |
michael@0 | 125 | |
michael@0 | 126 | .PHONY: $(addprefix install-dist-,$(install_manifests)) |
michael@0 | 127 | $(addprefix install-dist-,$(install_manifests)): install-dist-%: $(install_manifest_depends) |
michael@0 | 128 | $(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )$(DIST)/$* _build_manifests/install/dist_$*) |
michael@0 | 129 | |
michael@0 | 130 | .PHONY: install-tests |
michael@0 | 131 | install-manifests: install-tests |
michael@0 | 132 | install-tests: $(install_manifest_depends) |
michael@0 | 133 | $(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )_tests _build_manifests/install/tests) |
michael@0 | 134 | |
michael@0 | 135 | include $(topsrcdir)/build/moz-automation.mk |
michael@0 | 136 | |
michael@0 | 137 | # _tests should be purged during cleaning. However, we don't want it purged |
michael@0 | 138 | # during PGO builds because it contains some auto-generated files. |
michael@0 | 139 | ifneq ($(filter-out maybe_clobber_profiledbuild,$(MAKECMDGOALS)),) |
michael@0 | 140 | GARBAGE_DIRS += _tests |
michael@0 | 141 | endif |
michael@0 | 142 | |
michael@0 | 143 | # Windows PGO builds don't perform a clean before the 2nd pass. So, we want |
michael@0 | 144 | # to preserve content for the 2nd pass on Windows. Everywhere else, we always |
michael@0 | 145 | # process the install manifests as part of export. |
michael@0 | 146 | ifdef MOZ_PROFILE_USE |
michael@0 | 147 | ifndef NO_PROFILE_GUIDED_OPTIMIZE |
michael@0 | 148 | ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_) |
michael@0 | 149 | export:: install-manifests |
michael@0 | 150 | binaries:: |
michael@0 | 151 | @$(MAKE) install-manifests NO_REMOVE=1 |
michael@0 | 152 | endif |
michael@0 | 153 | endif |
michael@0 | 154 | else # !MOZ_PROFILE_USE (normal build) |
michael@0 | 155 | export:: install-manifests |
michael@0 | 156 | binaries:: |
michael@0 | 157 | @$(MAKE) install-manifests NO_REMOVE=1 |
michael@0 | 158 | endif |
michael@0 | 159 | |
michael@0 | 160 | # For historical reasons that are unknown, $(DIST)/sdk is always blown away |
michael@0 | 161 | # with no regard for PGO passes. This decision could probably be revisited. |
michael@0 | 162 | export:: install-dist-sdk |
michael@0 | 163 | |
michael@0 | 164 | ifndef JS_STANDALONE |
michael@0 | 165 | ifdef ENABLE_TESTS |
michael@0 | 166 | # Additional makefile targets to call automated test suites |
michael@0 | 167 | include $(topsrcdir)/testing/testsuite-targets.mk |
michael@0 | 168 | endif |
michael@0 | 169 | endif |
michael@0 | 170 | |
michael@0 | 171 | default all:: |
michael@0 | 172 | $(call BUILDSTATUS,TIERS export $(if $(COMPILE_ENVIRONMENT),$(if $(MOZ_PSEUDO_DERECURSE),compile ))libs tools $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS))) |
michael@0 | 173 | |
michael@0 | 174 | include $(topsrcdir)/config/rules.mk |
michael@0 | 175 | |
michael@0 | 176 | distclean:: |
michael@0 | 177 | $(RM) $(DIST_GARBAGE) |
michael@0 | 178 | |
michael@0 | 179 | ifeq ($(OS_ARCH),WINNT) |
michael@0 | 180 | # we want to copy PDB files on Windows |
michael@0 | 181 | MAKE_SYM_STORE_ARGS := -c --vcs-info |
michael@0 | 182 | ifdef PDBSTR_PATH |
michael@0 | 183 | MAKE_SYM_STORE_ARGS += -i |
michael@0 | 184 | endif |
michael@0 | 185 | DUMP_SYMS_BIN ?= $(topsrcdir)/toolkit/crashreporter/tools/win32/dump_syms_vc$(_MSC_VER).exe |
michael@0 | 186 | # PDB files don't get moved to dist, so we need to scan the whole objdir |
michael@0 | 187 | MAKE_SYM_STORE_PATH := . |
michael@0 | 188 | endif |
michael@0 | 189 | ifeq ($(OS_ARCH),Darwin) |
michael@0 | 190 | # need to pass arch flags for universal builds |
michael@0 | 191 | ifdef UNIVERSAL_BINARY |
michael@0 | 192 | MAKE_SYM_STORE_ARGS := -c -a 'i386 x86_64' --vcs-info |
michael@0 | 193 | MAKE_SYM_STORE_PATH := $(DIST)/universal |
michael@0 | 194 | else |
michael@0 | 195 | MAKE_SYM_STORE_ARGS := -c -a $(OS_TEST) --vcs-info |
michael@0 | 196 | MAKE_SYM_STORE_PATH := $(DIST)/bin |
michael@0 | 197 | endif |
michael@0 | 198 | DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms |
michael@0 | 199 | endif |
michael@0 | 200 | ifeq (,$(filter-out Linux SunOS,$(OS_ARCH))) |
michael@0 | 201 | MAKE_SYM_STORE_ARGS := -c --vcs-info |
michael@0 | 202 | DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms |
michael@0 | 203 | MAKE_SYM_STORE_PATH := $(DIST)/bin |
michael@0 | 204 | endif |
michael@0 | 205 | |
michael@0 | 206 | SYM_STORE_SOURCE_DIRS := $(topsrcdir) |
michael@0 | 207 | |
michael@0 | 208 | ifndef JS_STANDALONE |
michael@0 | 209 | include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk |
michael@0 | 210 | |
michael@0 | 211 | ifdef MOZ_SYMBOLS_EXTRA_BUILDID |
michael@0 | 212 | EXTRA_BUILDID := -$(MOZ_SYMBOLS_EXTRA_BUILDID) |
michael@0 | 213 | endif |
michael@0 | 214 | |
michael@0 | 215 | SYMBOL_INDEX_NAME = \ |
michael@0 | 216 | $(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)-$(CPU_ARCH)$(EXTRA_BUILDID)-symbols.txt |
michael@0 | 217 | |
michael@0 | 218 | buildsymbols: |
michael@0 | 219 | ifdef MOZ_CRASHREPORTER |
michael@0 | 220 | echo building symbol store |
michael@0 | 221 | $(RM) -r $(DIST)/crashreporter-symbols |
michael@0 | 222 | $(RM) '$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip' |
michael@0 | 223 | $(RM) '$(DIST)/$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' |
michael@0 | 224 | $(NSINSTALL) -D $(DIST)/crashreporter-symbols |
michael@0 | 225 | OBJCOPY='$(OBJCOPY)' \ |
michael@0 | 226 | $(PYTHON) $(topsrcdir)/toolkit/crashreporter/tools/symbolstore.py \ |
michael@0 | 227 | $(MAKE_SYM_STORE_ARGS) \ |
michael@0 | 228 | $(foreach dir,$(SYM_STORE_SOURCE_DIRS),-s $(dir)) \ |
michael@0 | 229 | $(DUMP_SYMS_BIN) \ |
michael@0 | 230 | $(DIST)/crashreporter-symbols \ |
michael@0 | 231 | $(MAKE_SYM_STORE_PATH) | grep -iv test > \ |
michael@0 | 232 | $(DIST)/crashreporter-symbols/$(SYMBOL_INDEX_NAME) |
michael@0 | 233 | echo packing symbols |
michael@0 | 234 | $(NSINSTALL) -D $(DIST)/$(PKG_PATH) |
michael@0 | 235 | cd $(DIST)/crashreporter-symbols && \ |
michael@0 | 236 | zip -r9D '../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' . -x '*test*' -x '*Test*' |
michael@0 | 237 | cd $(DIST)/crashreporter-symbols && \ |
michael@0 | 238 | grep 'sym' $(SYMBOL_INDEX_NAME) > $(SYMBOL_INDEX_NAME).tmp && \ |
michael@0 | 239 | mv $(SYMBOL_INDEX_NAME).tmp $(SYMBOL_INDEX_NAME) |
michael@0 | 240 | cd $(DIST)/crashreporter-symbols && \ |
michael@0 | 241 | zip -r9D '../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' . -i '*.sym' -i '*.txt' -x '*test*' -x '*Test*' |
michael@0 | 242 | endif # MOZ_CRASHREPORTER |
michael@0 | 243 | |
michael@0 | 244 | uploadsymbols: |
michael@0 | 245 | ifdef MOZ_CRASHREPORTER |
michael@0 | 246 | $(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(SYMBOL_INDEX_NAME) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' |
michael@0 | 247 | endif |
michael@0 | 248 | |
michael@0 | 249 | # MOZ_SOURCE_STAMP is defined in package-name.mk with a deferred assignment. |
michael@0 | 250 | # exporting it makes make run its $(shell) command for each invoked submake, |
michael@0 | 251 | # so transform it to an immediate assignment. |
michael@0 | 252 | MOZ_SOURCE_STAMP := $(MOZ_SOURCE_STAMP) |
michael@0 | 253 | export MOZ_SOURCE_STAMP |
michael@0 | 254 | endif |
michael@0 | 255 | |
michael@0 | 256 | .PHONY: update-packaging |
michael@0 | 257 | update-packaging: |
michael@0 | 258 | $(MAKE) -C tools/update-packaging |
michael@0 | 259 | |
michael@0 | 260 | .PHONY: pretty-package |
michael@0 | 261 | pretty-package: |
michael@0 | 262 | unset MOZ_SIGN_CMD && $(MAKE) package MOZ_PKG_PRETTYNAMES=1 |
michael@0 | 263 | |
michael@0 | 264 | .PHONY: pretty-package-tests |
michael@0 | 265 | pretty-package-tests: |
michael@0 | 266 | unset MOZ_SIGN_CMD && $(MAKE) package-tests MOZ_PKG_PRETTYNAMES=1 |
michael@0 | 267 | |
michael@0 | 268 | .PHONY: pretty-l10n-check |
michael@0 | 269 | pretty-l10n-check: |
michael@0 | 270 | unset MOZ_SIGN_CMD && $(MAKE) l10n-check MOZ_PKG_PRETTYNAMES=1 |
michael@0 | 271 | |
michael@0 | 272 | .PHONY: pretty-update-packaging |
michael@0 | 273 | pretty-update-packaging: |
michael@0 | 274 | unset MOZ_SIGN_CMD && $(MAKE) -C tools/update-packaging MOZ_PKG_PRETTYNAMES=1 |
michael@0 | 275 | |
michael@0 | 276 | .PHONY: pretty-installer |
michael@0 | 277 | pretty-installer: |
michael@0 | 278 | unset MOZ_SIGN_CMD && $(MAKE) installer MOZ_PKG_PRETTYNAMES=1 |
michael@0 | 279 | |
michael@0 | 280 | #XXX: this is a hack, since we don't want to clobber for MSVC |
michael@0 | 281 | # PGO support, but we can't do this test in client.mk |
michael@0 | 282 | ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_) |
michael@0 | 283 | # No point in clobbering if PGO has been explicitly disabled. |
michael@0 | 284 | ifndef NO_PROFILE_GUIDED_OPTIMIZE |
michael@0 | 285 | maybe_clobber_profiledbuild: clean |
michael@0 | 286 | else |
michael@0 | 287 | maybe_clobber_profiledbuild: |
michael@0 | 288 | endif |
michael@0 | 289 | else |
michael@0 | 290 | maybe_clobber_profiledbuild: |
michael@0 | 291 | $(RM) $(DIST)/bin/*.pgc |
michael@0 | 292 | find $(DIST)/$(MOZ_APP_NAME) -name '*.pgc' -exec mv {} $(DIST)/bin \; |
michael@0 | 293 | endif |
michael@0 | 294 | |
michael@0 | 295 | .PHONY: maybe_clobber_profiledbuild |
michael@0 | 296 | |
michael@0 | 297 | # Look for R_386_PC32 relocations in shared libs, these |
michael@0 | 298 | # break x86_64 builds and SELinux users. |
michael@0 | 299 | ifeq ($(OS_TARGET)_$(TARGET_XPCOM_ABI),Linux_x86-gcc3) |
michael@0 | 300 | check:: |
michael@0 | 301 | @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 |
michael@0 | 302 | endif |
michael@0 | 303 | |
michael@0 | 304 | ifdef JS_STANDALONE |
michael@0 | 305 | # Delegate js-specific rules to js |
michael@0 | 306 | check-%: |
michael@0 | 307 | $(MAKE) -C js/src $@ |
michael@0 | 308 | |
michael@0 | 309 | source-package install: |
michael@0 | 310 | $(MAKE) -C js/src $@ |
michael@0 | 311 | |
michael@0 | 312 | # Every export rule depends on config/export, but the rule for config/export |
michael@0 | 313 | # doesn't exist when building js non-standalone. |
michael@0 | 314 | .PHONY: config/export |
michael@0 | 315 | config/export: |
michael@0 | 316 | |
michael@0 | 317 | endif |
michael@0 | 318 | |
michael@0 | 319 | ifdef MOZ_PSEUDO_DERECURSE |
michael@0 | 320 | # Interdependencies for parallel export. |
michael@0 | 321 | js/xpconnect/src/export: dom/bindings/export xpcom/xpidl/export |
michael@0 | 322 | accessible/src/xpcom/export: xpcom/xpidl/export |
michael@0 | 323 | js/src/export: mfbt/export |
michael@0 | 324 | ifdef ENABLE_CLANG_PLUGIN |
michael@0 | 325 | js/src/export config/export: build/clang-plugin/export |
michael@0 | 326 | endif |
michael@0 | 327 | endif |