Bug 1472840 [wpt PR 11759] - [css-logical] Implement flow-relative margin, padding...
[gecko.git] / Makefile.in
blobe6900e6a7d24d60920ed43ff70b39d47235af348
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 ifeq (,$(MAKE_VERSION))
7 $(error GNU Make is required)
8 endif
9 make_min_ver := 3.81
10 ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION))))
11 $(error GNU Make $(make_min_ver) or higher is required)
12 endif
14 export TOPLEVEL_BUILD := 1
16 default::
18 ifndef TEST_MOZBUILD
19 ifdef MOZ_BUILD_APP
20 include $(wildcard $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk)
21 endif
22 endif
24 include $(topsrcdir)/config/config.mk
26 GARBAGE_DIRS += _javagen _profile staticlib
27 DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
28 config/autoconf.mk \
29 mozilla-config.h \
30 netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
31 .mozconfig.mk
33 ifndef MOZ_PROFILE_USE
34 # Automation builds should always have a new buildid, but for the sake of not
35 # re-linking libxul on every incremental build we do not enforce this for
36 # developer builds. Tests always need a new buildid as well.
37 ifneq (,$(MOZ_AUTOMATION)$(MOZ_BUILD_DATE)$(TEST_MOZBUILD))
38 $(MDDEPDIR)/buildid.h.stub $(MDDEPDIR)/source-repo.h.stub: FORCE
39 endif
40 # Additionally, provide a dummy target during tests, because
41 # faster/rules.mk will expect these targets to exist.
42 ifdef TEST_MOZBUILD
43 source-repo.h: $(MDDEPDIR)/source-repo.h.stub
44 buildid.h: $(MDDEPDIR)/buildid.h.stub
45 endif
46 endif
48 ifdef JS_STANDALONE
49 configure_dir = $(topsrcdir)/js/src
50 else
51 configure_dir = $(topsrcdir)
52 endif
54 BUILD_BACKEND_FILES := $(addprefix backend.,$(addsuffix Backend,$(BUILD_BACKENDS)))
56 ifndef TEST_MOZBUILD
57 ifndef MOZ_PROFILE_USE
58 # We need to explicitly put BUILD_BACKEND_FILES here otherwise the rule in
59 # rules.mk doesn't run early enough.
60 $(TIERS) binaries:: CLOBBER $(configure_dir)/configure config.status $(BUILD_BACKEND_FILES)
61 ifdef MOZ_WIDGET_TOOLKIT
62 ifdef COMPILE_ENVIRONMENT
63 $(TIERS) binaries:: $(topsrcdir)/js/src/configure js/src/config.status
64 endif
65 endif
66 endif
67 endif
69 ifdef JS_STANDALONE
70 .PHONY: CLOBBER
71 CLOBBER:
72 else
73 CLOBBER: $(topsrcdir)/CLOBBER
74 @echo 'STOP! The CLOBBER file has changed.'
75 @echo 'Please run the build through "mach build".'
76 @exit 1
77 endif
79 config.status: $(configure_dir)/configure $(configure_dir)/old-configure
80 js/src/config.status: $(topsrcdir)/js/src/configure $(topsrcdir)/js/src/old-configure
81 config.status js/src/config.status:
82 @echo 'STOP! $? has changed and needs to be run again.'
83 @echo 'Please rerun it.'
84 @echo 'To ignore this message, touch "$(CURDIR)/$@",'
85 @echo 'but your build might not succeed.'
86 @exit 1
88 # Regenerate the build backend if it is out of date. We only have this rule in
89 # this main make file because having it in rules.mk and applied to partial tree
90 # builds resulted in a world of hurt. Gory details are in bug 877308.
92 # The mach build driver will ensure the backend is up to date for partial tree
93 # builds. This cleanly avoids most of the pain.
95 ifndef TEST_MOZBUILD
97 .PHONY: backend
98 backend: $(BUILD_BACKEND_FILES)
100 include $(topsrcdir)/build/rebuild-backend.mk
102 Makefile: $(BUILD_BACKEND_FILES)
103 @$(TOUCH) $@
105 default:: $(BUILD_BACKEND_FILES)
106 endif
108 install_manifests := \
109 $(addprefix dist/,branding include public private xpi-stage) \
110 _tests \
111 $(NULL)
112 # Skip the dist/bin install manifest when using the hybrid
113 # FasterMake/RecursiveMake backend. This is a hack until bug 1241744 moves
114 # xpidl handling to FasterMake in that case, mechanically making the dist/bin
115 # install manifest non-existent (non-existent manifests being skipped)
116 ifeq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
117 install_manifests += dist/bin
118 endif
119 install_manifest_depends = \
120 CLOBBER \
121 $(configure_dir)/configure \
122 config.status \
123 $(BUILD_BACKEND_FILES) \
124 $(NULL)
126 ifdef MOZ_WIDGET_TOOLKIT
127 ifdef COMPILE_ENVIRONMENT
128 install_manifest_depends += \
129 $(topsrcdir)/js/src/configure \
130 js/src/config.status \
131 $(NULL)
132 endif
133 endif
135 .PHONY: install-manifests
136 install-manifests: $(addprefix install-,$(install_manifests))
138 # If we're using the hybrid FasterMake/RecursiveMake backend, we want
139 # to recurse in the faster/ directory in parallel of install manifests.
140 ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
141 install-manifests: faster
142 .PHONY: faster
143 faster:
144 $(MAKE) -C faster FASTER_RECURSIVE_MAKE=1
145 endif
147 .PHONY: $(addprefix install-,$(install_manifests))
148 $(addprefix install-,$(install_manifests)): install-%: $(install_manifest_depends)
149 ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
150 @# If we're using the hybrid FasterMake/RecursiveMake backend, we want
151 @# to ensure the FasterMake end doesn't have install manifests for the
152 @# same directory, because that would blow up
153 $(if $(wildcard _build_manifests/install/$(subst /,_,$*)),$(if $(wildcard faster/install_$(subst /,_,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle $*)))
154 endif
155 $(addprefix $(call py_action,process_install_manifest,--track install_$(subst /,_,$*).track $*) ,$(wildcard _build_manifests/install/$(subst /,_,$*)))
157 # Dummy wrapper rule to allow the faster backend to piggy back
158 $(addprefix install-,$(subst /,_,$(filter dist/%,$(install_manifests)))): install-dist_%: install-dist/% ;
160 .PHONY: install-tests
161 install-tests: install-test-files
163 .PHONY: install-test-files
164 install-test-files:
165 $(call py_action,process_install_manifest,--track install__test_files.track _tests _build_manifests/install/_test_files)
167 include $(topsrcdir)/build/moz-automation.mk
169 # dist and _tests should be purged during cleaning. However, we don't want them
170 # purged during PGO builds because they contain some auto-generated files.
171 ifneq ($(filter-out maybe_clobber_profiledbuild,$(MAKECMDGOALS)),)
172 GARBAGE_DIRS += dist _tests
173 endif
175 # Dummy rule for the cases below where we don't depend on dist/include
176 recurse_pre-export::
178 # Windows PGO builds don't perform a clean before the 2nd pass. So, we want
179 # to preserve content for the 2nd pass on Windows. Everywhere else, we always
180 # process the install manifests as part of export.
181 # For the binaries rule, not all the install manifests matter, so force only
182 # the interesting ones to be done.
183 ifdef MOZ_PROFILE_USE
184 ifndef NO_PROFILE_GUIDED_OPTIMIZE
185 ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
186 recurse_pre-export:: install-manifests
187 binaries::
188 @$(MAKE) install-manifests install_manifests=dist/include
189 endif
190 endif
191 else # !MOZ_PROFILE_USE (normal build)
192 recurse_pre-export:: install-manifests
193 binaries::
194 @$(MAKE) install-manifests install_manifests=dist/include
195 endif
197 recurse_artifact:
198 $(topsrcdir)/mach --log-no-times artifact install
200 ifdef MOZ_WIDGET_TOOLKIT
201 ifdef ENABLE_TESTS
202 # Additional makefile targets to call automated test suites
203 include $(topsrcdir)/testing/testsuite-targets.mk
204 endif
205 endif
207 default all::
208 $(call BUILDSTATUS,TIERS $(TIERS) $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
210 # PGO build target.
211 profiledbuild::
212 $(call BUILDSTATUS,TIERS pgo_profile_generate pgo_package pgo_profile pgo_clobber pgo_profile_use)
213 $(call BUILDSTATUS,TIER_START pgo_profile_generate)
214 $(MAKE) default MOZ_PROFILE_GENERATE=1 MOZ_PGO_INSTRUMENTED=1
215 $(call BUILDSTATUS,TIER_FINISH pgo_profile_generate)
216 $(call BUILDSTATUS,TIER_START pgo_package)
217 $(MAKE) package MOZ_PGO_INSTRUMENTED=1 MOZ_INTERNAL_SIGNING_FORMAT= MOZ_EXTERNAL_SIGNING_FORMAT=
218 rm -f jarlog/en-US.log
219 $(call BUILDSTATUS,TIER_FINISH pgo_package)
220 $(call BUILDSTATUS,TIER_START pgo_profile)
221 MOZ_PGO_INSTRUMENTED=1 JARLOG_FILE=jarlog/en-US.log $(PYTHON) $(topsrcdir)/build/pgo/profileserver.py 10
222 $(call BUILDSTATUS,TIER_FINISH pgo_profile)
223 $(call BUILDSTATUS,TIER_START pgo_clobber)
224 $(MAKE) maybe_clobber_profiledbuild
225 $(call BUILDSTATUS,TIER_FINISH pgo_clobber)
226 $(call BUILDSTATUS,TIER_START pgo_profile_use)
227 $(MAKE) default MOZ_PROFILE_USE=1 $(if $(CLANG_CL),MOZ_PROFILE_ORDER_FILE=$(topobjdir)/cygprofile.txt)
228 $(call BUILDSTATUS,TIER_FINISH pgo_profile_use)
230 # Change default target to PGO build if PGO is enabled.
231 ifdef MOZ_PGO
232 OVERRIDE_DEFAULT_GOAL := profiledbuild
233 endif
235 include $(topsrcdir)/config/rules.mk
237 ifdef SCCACHE_VERBOSE_STATS
238 default::
239 -$(CCACHE) --show-stats --stats-format=json > sccache-stats.json
240 @echo "===SCCACHE STATS==="
241 -$(CCACHE) --show-stats
242 @echo "==================="
243 ifndef MOZ_PROFILE_GENERATE
244 # Ideally we'd do that in the same file as we set the sccache.log location for
245 # sccache, but it's too late in the build.
246 -gzip -9 $(DIST)/sccache.log
247 endif
248 endif
250 distclean::
251 $(RM) $(DIST_GARBAGE)
253 ifdef MOZ_CRASHREPORTER
254 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
256 endif
258 .PHONY: prepsymbolsarchive
259 prepsymbolsarchive:
260 echo packing symbols
261 $(NSINSTALL) -D $(DIST)/$(PKG_PATH)
263 ifndef MOZ_AUTOMATION
264 prepsymbolsarchive: recurse_syms
265 endif
267 .PHONY: symbolsfullarchive
268 symbolsfullarchive: prepsymbolsarchive
269 $(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
270 $(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' \
271 $(abspath $(DIST)/crashreporter-symbols) \
272 --exclude '*test*' \
273 --exclude '*Test*' \
274 --compress '**/*.sym')
276 .PHONY: symbolsarchive
277 symbolsarchive: prepsymbolsarchive
278 $(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
279 $(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \
280 $(abspath $(DIST)/crashreporter-symbols) \
281 --include '**/*.sym')
283 ifdef MOZ_CRASHREPORTER
284 buildsymbols: symbolsfullarchive symbolsarchive
285 else
286 buildsymbols:
287 endif
289 uploadsymbols:
290 ifdef MOZ_CRASHREPORTER
291 $(PYTHON) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
292 endif
294 .PHONY: update-packaging
295 update-packaging:
296 $(MAKE) -C tools/update-packaging
298 .PHONY: package-generated-sources
299 package-generated-sources:
300 $(call py_action,package_generated_sources,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)')
302 #XXX: this is a hack, since we don't want to clobber for MSVC
303 # PGO support, but we can't do this test in client.mk
304 ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
305 # No point in clobbering if PGO has been explicitly disabled.
306 ifndef NO_PROFILE_GUIDED_OPTIMIZE
307 maybe_clobber_profiledbuild: clean
308 else
309 maybe_clobber_profiledbuild:
310 endif
311 else
312 ifdef CLANG_CL
313 maybe_clobber_profiledbuild: clean
314 else
315 maybe_clobber_profiledbuild:
316 $(RM) $(DIST)/bin/*.pgc
317 find $(DIST)/$(MOZ_APP_NAME) -name '*.pgc' -exec mv {} $(DIST)/bin \;
318 endif # CLANG_CL
319 endif
321 .PHONY: maybe_clobber_profiledbuild
323 # Look for R_386_PC32 relocations in shared libs, these
324 # break x86_64 builds and SELinux users.
325 ifeq ($(OS_TARGET)_$(TARGET_XPCOM_ABI),Linux_x86-gcc3)
326 check::
327 @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
328 endif
330 ifdef JS_STANDALONE
331 # Delegate js-specific rules to js
332 check-%:
333 $(MAKE) -C js/src $@
335 source-package install:
336 $(MAKE) -C js/src $@
338 # Every export rule depends on config/export, but the rule for config/export
339 # doesn't exist when building js non-standalone.
340 .PHONY: config/export
341 config/export:
343 endif
345 # There used to be build interdependencies here. They are now in config/recurse.mk