2 # vim:set ts=8 sw=8 sts=8 noet:
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
6 # You can obtain one at http://mozilla.org/MPL/2.0/.
10 $(error topsrcdir was not set
))
13 # Define an include-at-most-once flag
14 ifdef INCLUDED_RULES_MK
15 $(error Do not
include rules.mk twice
!)
19 ifndef INCLUDED_CONFIG_MK
20 include $(topsrcdir
)/config
/config.mk
23 ifndef INCLUDED_VERSION_MK
24 include $(MOZILLA_DIR
)/config
/version.mk
27 USE_AUTOTARGETS_MK
= 1
28 include $(MOZILLA_DIR
)/config
/makefiles
/makeutils.mk
31 REPORT_BUILD
= $(info $(shell $(PYTHON
) $(MOZILLA_DIR
)/config
/rebuild_check.py
$@
$^
))
32 REPORT_BUILD_VERBOSE
= $(REPORT_BUILD
)
34 REPORT_BUILD
= $(info $(relativesrcdir
)/$(notdir $@
))
36 ifdef BUILD_VERBOSE_LOG
37 REPORT_BUILD_VERBOSE
= $(REPORT_BUILD
)
39 REPORT_BUILD_VERBOSE
= $(call BUILDSTATUS
,BUILD_VERBOSE
$(relativesrcdir
))
46 # ELOG prints out failed command when building silently (gmake -s). Pymake
47 # prints out failed commands anyway, so ELOG just makes things worse by
48 # forcing shell invocations.
49 ifneq (,$(findstring -s
, $(filter-out --%, $(MAKEFLAGS
))))
50 ELOG
:= $(EXEC
) sh
$(MOZILLA_DIR
)/build
/unix
/print-failed-commands.sh
55 _VPATH_SRCS
= $(abspath
$<)
57 ################################################################################
58 # Testing frameworks support
59 ################################################################################
61 testxpcobjdir
= $(DEPTH
)/_tests
/xpcshell
65 ifdef COMPILE_ENVIRONMENT
67 # Compile the tests to $(DIST)/bin. Make lots of niceties available by default
68 # through TestHarness.h, by modifying the list of includes and the libs against
70 SIMPLE_PROGRAMS
+= $(CPP_UNIT_TESTS
)
72 ifndef MOZ_PROFILE_GENERATE
73 CPP_UNIT_TESTS_FILES
= $(CPP_UNIT_TESTS
)
74 CPP_UNIT_TESTS_DEST
= $(DIST
)/cppunittests
75 CPP_UNIT_TESTS_TARGET
= target
76 INSTALL_TARGETS
+= CPP_UNIT_TESTS
80 @
$(PYTHON
) $(MOZILLA_DIR
)/testing
/runcppunittests.py
--xre-path
=$(DIST
)/bin
--symbols-path
=$(DIST
)/crashreporter-symbols
$(CPP_UNIT_TESTS
)
83 $(PYTHON
) -u
$(MOZILLA_DIR
)/testing
/remotecppunittests.py \
84 --xre-path
=$(DEPTH
)/dist/bin \
85 --localLib
=$(DEPTH
)/dist/$(MOZ_APP_NAME
) \
86 --deviceIP
=${TEST_DEVICE} \
87 $(CPP_UNIT_TESTS
) $(EXTRA_TEST_ARGS
); \
89 endif # COMPILE_ENVIRONMENT
90 endif # CPP_UNIT_TESTS
97 # If FORCE_STATIC_LIB is set, build a static library.
98 # Otherwise, build a shared library.
104 # Only build actual library if it is requested.
105 LIBRARY
:= $(REAL_LIBRARY
)
110 ifdef FORCE_SHARED_LIB
114 MKSHLIB
= $(MKCSHLIB
)
120 endif # FORCE_SHARED_LIB
122 ifeq ($(OS_ARCH
),WINNT
)
124 LINK_PDBFILE ?
= $(basename $(@F
)).pdb
128 ifdef SIMPLE_PROGRAMS
129 COMPILE_PDB_FLAG ?
= -Fd
$(basename $(@F
)).pdb
130 COMPILE_CFLAGS
+= $(COMPILE_PDB_FLAG
)
131 COMPILE_CXXFLAGS
+= $(COMPILE_PDB_FLAG
)
135 CODFILE
=$(basename $(@F
)).cod
141 ifeq (arm-Darwin
,$(CPU_ARCH
)-$(OS_TARGET
))
143 MOZ_PROGRAM_LDFLAGS
+= -Wl
,-rpath
-Wl
,@executable_path
/Frameworks
147 ifeq ($(OS_ARCH
),WINNT
)
148 ifeq ($(CC_TYPE
),clang
)
149 MOZ_PROGRAM_LDFLAGS
+= -Wl
,-pdb
,$(dir $@
)/$(LINK_PDBFILE
)
153 ifeq ($(HOST_OS_ARCH
),WINNT
)
154 HOST_PDBFILE
=$(basename $(@F
)).pdb
155 HOST_PDB_FLAG ?
= -Fd
$(HOST_PDBFILE
)
156 HOST_C_LDFLAGS
+= $(HOST_PDB_FLAG
)
157 HOST_CXX_LDFLAGS
+= $(HOST_PDB_FLAG
)
160 # Don't build SIMPLE_PROGRAMS during the MOZ_PROFILE_GENERATE pass, and do not
161 # attempt to install them
162 ifdef MOZ_PROFILE_GENERATE
163 $(foreach category
,$(INSTALL_TARGETS
),\
164 $(eval
$(category
)_FILES
:= $(foreach file
,$($(category
)_FILES
),$(if
$(filter $(SIMPLE_PROGRAMS
),$(notdir $(file
))),,$(file
)))))
168 ifdef COMPILE_ENVIRONMENT
170 TARGETS
= $(LIBRARY
) $(SHARED_LIBRARY
) $(PROGRAM
) $(SIMPLE_PROGRAMS
) $(HOST_PROGRAM
) $(HOST_SIMPLE_PROGRAMS
) $(HOST_SHARED_LIBRARY
)
173 ifdef MOZ_PROFILE_GENERATE
174 CPPSRCS
:= $(CPPSRCS
) $(PGO_GEN_ONLY_CPPSRCS
)
177 COBJS
= $(notdir $(CSRCS
:.c
=.
$(OBJ_SUFFIX
)))
178 SOBJS
= $(notdir $(SSRCS
:.S
=.
$(OBJ_SUFFIX
)))
179 # CPPSRCS can have different extensions (eg: .cpp, .cc)
180 CPPOBJS
= $(notdir $(addsuffix .
$(OBJ_SUFFIX
),$(basename $(CPPSRCS
))))
181 CMOBJS
= $(notdir $(CMSRCS
:.m
=.
$(OBJ_SUFFIX
)))
182 CMMOBJS
= $(notdir $(CMMSRCS
:.mm
=.
$(OBJ_SUFFIX
)))
183 # ASFILES can have different extensions (.s, .asm)
184 ASOBJS
= $(notdir $(addsuffix .
$(OBJ_SUFFIX
),$(basename $(ASFILES
))))
185 RS_STATICLIB_CRATE_OBJ
= $(addprefix lib
,$(notdir $(RS_STATICLIB_CRATE_SRC
:.rs
=.
$(LIB_SUFFIX
))))
187 _OBJS
= $(COBJS
) $(SOBJS
) $(CPPOBJS
) $(CMOBJS
) $(CMMOBJS
) $(ASOBJS
)
188 OBJS
= $(strip $(_OBJS
))
191 HOST_COBJS
= $(addprefix host_
,$(notdir $(HOST_CSRCS
:.c
=.
$(_OBJ_SUFFIX
))))
192 # HOST_CPPOBJS can have different extensions (eg: .cpp, .cc)
193 HOST_CPPOBJS
= $(addprefix host_
,$(notdir $(addsuffix .
$(_OBJ_SUFFIX
),$(basename $(HOST_CPPSRCS
)))))
194 HOST_CMOBJS
= $(addprefix host_
,$(notdir $(HOST_CMSRCS
:.m
=.
$(_OBJ_SUFFIX
))))
195 HOST_CMMOBJS
= $(addprefix host_
,$(notdir $(HOST_CMMSRCS
:.mm
=.
$(_OBJ_SUFFIX
))))
197 _HOST_OBJS
= $(HOST_COBJS
) $(HOST_CPPOBJS
) $(HOST_CMOBJS
) $(HOST_CMMOBJS
)
198 HOST_OBJS
= $(strip $(_HOST_OBJS
))
207 HOST_SHARED_LIBRARY
:=
209 HOST_SIMPLE_PROGRAMS
:=
213 $(GARBAGE
) $(TARGETS
) $(OBJS
) $(PROGOBJS
) LOGS TAGS a.out \
214 $(filter-out $(ASFILES
),$(OBJS
:.
$(OBJ_SUFFIX
)=.s
)) $(OBJS
:.
$(OBJ_SUFFIX
)=.ii
) \
215 $(OBJS
:.
$(OBJ_SUFFIX
)=.i
) $(OBJS
:.
$(OBJ_SUFFIX
)=.i_o
) \
216 $(HOST_PROGOBJS
) $(HOST_OBJS
) $(IMPORT_LIBRARY
) \
217 so_locations _gen _stubs
$(wildcard *.res
) $(wildcard *.RES
) \
218 $(wildcard *.pdb
) $(CODFILE
) $(IMPORT_LIBRARY
) \
219 $(SHARED_LIBRARY
:$(DLL_SUFFIX
)=.exp
) $(wildcard *.ilk
) \
220 $(PROGRAM
:$(BIN_SUFFIX
)=.exp
) $(SIMPLE_PROGRAMS
:$(BIN_SUFFIX
)=.exp
) \
221 $(PROGRAM
:$(BIN_SUFFIX
)=.lib
) $(SIMPLE_PROGRAMS
:$(BIN_SUFFIX
)=.lib
) \
222 $(SIMPLE_PROGRAMS
:$(BIN_SUFFIX
)=.
$(OBJ_SUFFIX
)) \
223 $(wildcard gts_tmp_
*) $(LIBRARY
:%.a
=.
%.timestamp
)
225 $(GARBAGE_DIRS
) /no-such-file
228 GARBAGE
+= $(MOCSRCS
)
231 ifdef SIMPLE_PROGRAMS
232 GARBAGE
+= $(SIMPLE_PROGRAMS
:%=%.
$(OBJ_SUFFIX
))
235 ifdef HOST_SIMPLE_PROGRAMS
236 GARBAGE
+= $(HOST_SIMPLE_PROGRAMS
:%=%.
$(_OBJ_SUFFIX
))
240 ifndef NO_BUILDSTATUS_MESSAGES
242 @echo
'BUILDSTATUS $1'
248 define SUBMAKE
# $(call SUBMAKE,target,directory,static)
249 +@
$(MAKE
) $(if
$(2),-C
$(2)) $(1)
251 endef # The extra line is important here! don't delete it
253 define TIER_DIR_SUBMAKE
254 $(call SUBMAKE
,$(4),$(3),$(5))
256 endef # Ths empty line is important.
258 ifneq (,$(strip $(DIRS
)))
260 $(foreach dir,$(DIRS
),$(call SUBMAKE
,$@
,$(dir)))
264 # Now we can differentiate between objects used to build a library, and
265 # objects used to build an executable in the same directory.
272 HOST_PROGOBJS
= $(HOST_OBJS
)
275 GARBAGE_DIRS
+= $(wildcard $(CURDIR
)/$(MDDEPDIR
))
278 # Tags: emacs (etags), vi (ctags)
279 # TAG_PROGRAM := ctags -L -
281 TAG_PROGRAM
= xargs etags
-a
284 # Turn on C++ linking if we have any .cpp or .mm files
285 # (moved this from config.mk so that config.mk can be included
286 # before the CPPSRCS are defined)
288 ifneq ($(HOST_CPPSRCS
)$(HOST_CMMSRCS
),)
289 HOST_CPP_PROG_LINK
= 1
293 # MacOS X specific stuff
296 ifeq ($(OS_ARCH
),Darwin
)
299 _LOADER_PATH
:= @rpath
301 _LOADER_PATH
:= @executable_path
303 EXTRA_DSO_LDOPTS
+= -dynamiclib
-install_name
$(_LOADER_PATH
)/$(SHARED_LIBRARY
) -compatibility_version
1 -current_version
1 -single_module
308 ifeq ($(OS_TARGET
),WINNT
)
310 EXTRA_DSO_LDOPTS
+= -DEF
:$(call normalizepath
,$(SYMBOLS_FILE
))
312 EXTRA_DSO_LDOPTS
+= $(call normalizepath
,$(SYMBOLS_FILE
))
316 EXTRA_DSO_LDOPTS
+= -Wl
,--version-script
,$(SYMBOLS_FILE
)
318 ifeq ($(OS_TARGET
),Darwin
)
319 EXTRA_DSO_LDOPTS
+= -Wl
,-exported_symbols_list
,$(SYMBOLS_FILE
)
323 EXTRA_DEPS
+= $(SYMBOLS_FILE
)
326 # GNU doesn't have path length limitation
329 ifeq ($(OS_ARCH
),GNU
)
330 OS_CPPFLAGS
+= -DPATH_MAX
=1024 -DMAXPATHLEN
=1024
336 ifeq ($(OS_ARCH
),WINNT
)
338 DSO_LDOPTS
+= -Wl
,--out-implib
-Wl
,$(IMPORT_LIBRARY
)
350 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
354 endif # WINNT && !GNU_CC
356 ifeq (,$(CROSS_COMPILE
))
357 HOST_OUTOPTION
= $(OUTOPTION
)
359 # Windows-to-Windows cross compiles should always use MSVC-style options for
361 ifeq (WINNT_WINNT
,$(HOST_OS_ARCH
)_
$(OS_ARCH
))
362 ifneq (,$(filter-out msvc clang-cl
,$(HOST_CC_TYPE
)))
363 $(error MSVC-style compilers should be used for host compilations
!)
365 HOST_OUTOPTION
= -Fo
# eol
367 HOST_OUTOPTION
= -o
# eol
370 ################################################################################
372 # Ensure the build config is up to date. This is done automatically when builds
373 # are performed through |mach build|. The check here is to catch people not
374 # using mach. If we ever enforce builds through mach, this code can be removed.
375 ifndef MOZBUILD_BACKEND_CHECKED
377 ifndef TOPLEVEL_BUILD
378 BUILD_BACKEND_FILES
:= $(addprefix $(DEPTH
)/backend.
,$(addsuffix Backend
,$(BUILD_BACKENDS
)))
379 $(DEPTH
)/backend.
%Backend
:
380 $(error Build configuration changed. Build with |mach build| or run |mach build-backend| to regenerate build config
)
382 define build_backend_rule
383 $(1): $$(shell cat
$(1).in
)
386 $(foreach file
,$(BUILD_BACKEND_FILES
),$(eval
$(call build_backend_rule
,$(file
))))
388 default
:: $(BUILD_BACKEND_FILES
)
390 export MOZBUILD_BACKEND_CHECKED
=1
395 # The root makefile doesn't want to do a plain export/libs, because
396 # of the tiers and because of libxul. Suppress the default rules in favor
397 # of something else. Makefiles which use this var *must* provide a sensible
398 # default rule before including rules.mk
400 $(foreach tier
,$(TIERS
),$(call SUBMAKE
,$(tier
)))
402 ifeq ($(findstring s
,$(filter-out --%, $(MAKEFLAGS
))),)
410 # Do everything from scratch
415 # Dependencies which, if modified, should cause everything to rebuild
416 GLOBAL_DEPS
+= Makefile
$(addprefix $(DEPTH
)/config
/,$(INCLUDED_AUTOCONF_MK
)) $(MOZILLA_DIR
)/config
/config.mk
418 ##############################################
419 ifdef COMPILE_ENVIRONMENT
420 OBJ_TARGETS
= $(OBJS
) $(PROGOBJS
) $(HOST_OBJS
) $(HOST_PROGOBJS
)
422 compile
:: host target
424 host
:: $(HOST_OBJS
) $(HOST_PROGRAM
) $(HOST_SIMPLE_PROGRAMS
) $(HOST_RUST_PROGRAMS
) $(HOST_RUST_LIBRARY_FILE
) $(HOST_SHARED_LIBRARY
)
426 target
:: $(filter-out $(MOZBUILD_NON_DEFAULT_TARGETS
),$(LIBRARY
) $(SHARED_LIBRARY
) $(PROGRAM
) $(SIMPLE_PROGRAMS
) $(RUST_LIBRARY_FILE
) $(RUST_PROGRAMS
))
436 include $(MOZILLA_DIR
)/config
/makefiles
/target_binaries.mk
439 ##############################################
440 ifneq (1,$(NO_PROFILE_GUIDED_OPTIMIZE
))
441 ifdef MOZ_PROFILE_USE
442 ifeq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
443 # When building with PGO, we have to make sure to re-link
444 # in the MOZ_PROFILE_USE phase if we linked in the
445 # MOZ_PROFILE_GENERATE phase. We'll touch this pgo.relink
446 # file in the link rule in the GENERATE phase to indicate
447 # that we need a relink.
449 $(SHARED_LIBRARY
): pgo.relink
452 $(PROGRAM
): pgo.relink
455 # In the second pass, we need to merge the pgc files into the pgd file.
456 # The compiler would do this for us automatically if they were in the right
457 # place, but they're in dist/bin.
458 ifneq (,$(SHARED_LIBRARY
)$(PROGRAM
))
461 $(PYTHON
) $(MOZILLA_DIR
)/build
/win32
/pgomerge.py \
462 $(PROGRAM
:$(BIN_SUFFIX
)=) $(DIST
)/bin
465 $(PYTHON
) $(MOZILLA_DIR
)/build
/win32
/pgomerge.py \
466 $(patsubst $(DLL_PREFIX
)%$(DLL_SUFFIX
),%,$(SHARED_LIBRARY
)) $(DIST
)/bin
468 endif # SHARED_LIBRARY || PROGRAM
470 endif # MOZ_PROFILE_USE
471 ifdef MOZ_PROFILE_GENERATE
472 # Clean up profiling data during PROFILE_GENERATE phase
474 ifeq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
475 $(foreach pgd
,$(wildcard *.pgd
),pgomgr
-clear
$(pgd
);)
483 ifneq (,$(MOZ_PROFILE_GENERATE
)$(MOZ_PROFILE_USE
))
484 ifneq (,$(filter target
,$(MAKECMDGOALS
)))
486 # Force rebuilding libraries and programs in both passes because each
487 # pass uses different object files.
488 $(PROGRAM
) $(SHARED_LIBRARY
) $(LIBRARY
): FORCE
493 endif # NO_PROFILE_GUIDED_OPTIMIZE
495 ##############################################
497 clean clobber realclean clobber_all
::
499 -$(RM
) -r
$(ALL_TRASH_DIRS
)
501 clean clobber realclean clobber_all
distclean::
502 $(foreach dir,$(DIRS
),-$(call SUBMAKE
,$@
,$(dir)))
505 -$(RM
) -r
$(ALL_TRASH_DIRS
)
506 -$(RM
) $(ALL_TRASH
) \
507 Makefile .HSancillary \
508 $(wildcard *.
$(OBJ_SUFFIX
)) $(wildcard *.ho
) $(wildcard host_
*.o
*) \
509 $(wildcard *.
$(LIB_SUFFIX
)) $(wildcard *$(DLL_SUFFIX
)) \
510 $(wildcard *.
$(IMPORT_LIB_SUFFIX
))
514 find
$(topsrcdir
) -name
dist -prune
-o \
( -name
'*.[hc]' -o
-name
'*.cp' -o
-name
'*.cpp' -o
-name
'*.idl' \
) -print |
$(TAG_PROGRAM
)
516 define EXPAND_CC_OR_CXX
517 $(if
$(PROG_IS_C_ONLY_
$(1)),$(CC
),$(CCC
))
520 # Workaround a bug of MSVC 2017 Update 8 (see bug 1485224)
521 ifeq ($(CC_TYPE
)_
$(HOST_OS_ARCH
)_
$(MOZ_PROFILE_GENERATE
),msvc_WINNT_1
)
522 LINKER_OUT
=$(subst /,\
,$1)
529 # creates OBJS, links with LIBS to create Foo
531 $(PROGRAM
): $(PROGOBJS
) $(STATIC_LIBS
) $(RUST_STATIC_LIB
) $(EXTRA_DEPS
) $(RESFILE
) $(GLOBAL_DEPS
) $(call mkdir_deps
,$(FINAL_TARGET
))
534 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
535 $(LINKER
) -NOLOGO
-OUT
:$(call LINKER_OUT
,$@
) -PDB
:$(LINK_PDBFILE
) -IMPLIB
:$(basename $(@F
)).lib
$(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(MOZ_PROGRAM_LDFLAGS
) $($(notdir $@
)_
$(OBJS_VAR_SUFFIX
)) $(RESFILE
) $(STATIC_LIBS
) $(RUST_STATIC_LIB
) $(SHARED_LIBS
) $(OS_LIBS
)
536 ifdef MSMANIFEST_TOOL
537 @if
test -f
$@.manifest
; then \
538 if
test -f
'$(srcdir)/$(notdir $@).manifest'; then \
539 echo
'Embedding manifest from $(srcdir_rel)/$(notdir $@).manifest and $@.manifest'; \
540 $(MT
) -NOLOGO
-MANIFEST
'$(srcdir_rel)/$(notdir $@).manifest' $@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
542 echo
'Embedding manifest from $@.manifest'; \
543 $(MT
) -NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
545 elif
test -f
'$(srcdir)/$(notdir $@).manifest'; then \
546 echo
'Embedding manifest from $(srcdir_rel)/$(notdir $@).manifest'; \
547 $(MT
) -NOLOGO
-MANIFEST
'$(srcdir_rel)/$(notdir $@).manifest' -OUTPUTRESOURCE
:$@\
;1; \
549 endif # MSVC with manifest tool
550 ifdef MOZ_PROFILE_GENERATE
551 # touch it a few seconds into the future to work around FAT's
552 # 2-second granularity
553 touch
-t
`date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
555 else # !WINNT || GNU_CC
556 $(call EXPAND_CC_OR_CXX
,$@
) -o
$@
$(COMPUTED_CXX_LDFLAGS
) $(PGO_CFLAGS
) $($(notdir $@
)_
$(OBJS_VAR_SUFFIX
)) $(RESFILE
) $(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(STATIC_LIBS
) $(RUST_STATIC_LIB
) $(MOZ_PROGRAM_LDFLAGS
) $(SHARED_LIBS
) $(OS_LIBS
)
557 $(call py_action
,check_binary
,--target
$@
)
558 endif # WINNT && !GNU_CC
561 $(STRIP
) $(STRIP_FLAGS
) $@
563 ifdef MOZ_POST_PROGRAM_COMMAND
564 $(MOZ_POST_PROGRAM_COMMAND
) $@
567 $(HOST_PROGRAM
): $(HOST_PROGOBJS
) $(HOST_LIBS
) $(HOST_EXTRA_DEPS
) $(GLOBAL_DEPS
) $(call mkdir_deps
,$(DEPTH
)/dist/host
/bin
)
569 ifeq (_WINNT
,$(GNU_CC
)_
$(HOST_OS_ARCH
))
570 $(HOST_LINKER
) -NOLOGO
-OUT
:$@
-PDB
:$(HOST_PDBFILE
) $($(notdir $@
)_OBJS
) $(WIN32_EXE_LDFLAGS
) $(HOST_LDFLAGS
) $(HOST_LINKER_LIBPATHS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
571 ifdef MSMANIFEST_TOOL
572 @if
test -f
$@.manifest
; then \
573 if
test -f
'$(srcdir)/$(notdir $@).manifest'; then \
574 echo
'Embedding manifest from $(srcdir_rel)/$(notdir $@).manifest and $@.manifest'; \
575 $(MT
) -NOLOGO
-MANIFEST
'$(srcdir_rel)/$(notdir $@).manifest' $@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
577 echo
'Embedding manifest from $@.manifest'; \
578 $(MT
) -NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
580 elif
test -f
'$(srcdir)/$(notdir $@).manifest'; then \
581 echo
'Embedding manifest from $(srcdir_rel)/$(notdir $@).manifest'; \
582 $(MT
) -NOLOGO
-MANIFEST
'$(srcdir_rel)/$(notdir $@).manifest' -OUTPUTRESOURCE
:$@\
;1; \
584 endif # MSVC with manifest tool
586 ifeq ($(HOST_CPP_PROG_LINK
),1)
587 $(HOST_CXX
) -o
$@
$(HOST_CXX_LDFLAGS
) $(HOST_LDFLAGS
) $($(notdir $@
)_OBJS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
589 $(HOST_CC
) -o
$@
$(HOST_C_LDFLAGS
) $(HOST_LDFLAGS
) $($(notdir $@
)_OBJS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
590 endif # HOST_CPP_PROG_LINK
593 $(call py_action
,check_binary
,--host
$@
)
597 # This is an attempt to support generation of multiple binaries
598 # in one directory, it assumes everything to compile Foo is in
599 # Foo.o (from either Foo.c or Foo.cpp).
601 # SIMPLE_PROGRAMS = Foo Bar
602 # creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
604 $(SIMPLE_PROGRAMS
): %$(BIN_SUFFIX
): %.
$(OBJ_SUFFIX
) $(STATIC_LIBS
) $(EXTRA_DEPS
) $(GLOBAL_DEPS
)
606 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
607 $(LINKER
) -nologo
-out
:$@
-pdb
:$(LINK_PDBFILE
) $($@_
$(OBJS_VAR_SUFFIX
)) $(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(MOZ_PROGRAM_LDFLAGS
) $(STATIC_LIBS
) $(SHARED_LIBS
) $(OS_LIBS
)
608 ifdef MSMANIFEST_TOOL
609 @if
test -f
$@.manifest
; then \
610 $(MT
) -NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
612 elif
test -f
'$(srcdir)/$(notdir $@).manifest'; then \
613 $(MT
) -NOLOGO
-MANIFEST
'$(srcdir_rel)/$(notdir $@).manifest' -OUTPUTRESOURCE
:$@\
;1; \
615 endif # MSVC with manifest tool
617 $(call EXPAND_CC_OR_CXX
,$@
) $(COMPUTED_CXX_LDFLAGS
) $(PGO_CFLAGS
) -o
$@
$($@_
$(OBJS_VAR_SUFFIX
)) $(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(STATIC_LIBS
) $(MOZ_PROGRAM_LDFLAGS
) $(SHARED_LIBS
) $(OS_LIBS
)
618 $(call py_action
,check_binary
,--target
$@
)
619 endif # WINNT && !GNU_CC
622 $(STRIP
) $(STRIP_FLAGS
) $@
624 ifdef MOZ_POST_PROGRAM_COMMAND
625 $(MOZ_POST_PROGRAM_COMMAND
) $@
628 $(HOST_SIMPLE_PROGRAMS
): host_
%$(HOST_BIN_SUFFIX
): $(HOST_LIBS
) $(HOST_EXTRA_DEPS
) $(GLOBAL_DEPS
)
630 ifeq (WINNT_
,$(HOST_OS_ARCH
)_
$(GNU_CC
))
631 $(HOST_LINKER
) -NOLOGO
-OUT
:$@
-PDB
:$(HOST_PDBFILE
) $($(notdir $@
)_OBJS
) $(WIN32_EXE_LDFLAGS
) $(HOST_LDFLAGS
) $(HOST_LINKER_LIBPATHS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
633 ifneq (,$(HOST_CPPSRCS
)$(USE_HOST_CXX
))
634 $(HOST_CXX
) $(HOST_OUTOPTION
)$@
$(HOST_CXX_LDFLAGS
) $($(notdir $@
)_OBJS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
636 $(HOST_CC
) $(HOST_OUTOPTION
)$@
$(HOST_C_LDFLAGS
) $($(notdir $@
)_OBJS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
640 $(call py_action
,check_binary
,--host
$@
)
643 $(LIBRARY
): $(OBJS
) $(STATIC_LIBS
) $(EXTRA_DEPS
) $(GLOBAL_DEPS
)
645 $(RM
) $(REAL_LIBRARY
)
646 $(AR
) $(AR_FLAGS
) $($@_
$(OBJS_VAR_SUFFIX
))
648 ifeq ($(OS_ARCH
),WINNT
)
649 # Import libraries are created by the rules creating shared libraries.
650 # The rules to copy them to $(DIST)/lib depend on $(IMPORT_LIBRARY),
651 # but make will happily consider the import library before it is refreshed
652 # when rebuilding the corresponding shared library. Defining an empty recipe
653 # for import libraries forces make to wait for the shared library recipe to
654 # have run before considering other targets that depend on the import library.
656 $(IMPORT_LIBRARY
): $(SHARED_LIBRARY
) ;
659 $(HOST_SHARED_LIBRARY
): Makefile
662 ifneq (,$(filter msvc clang-cl
,$(HOST_CC_TYPE
)))
663 $(HOST_LINKER
) -NOLOGO
-DLL
-OUT
:$@
$($(notdir $@
)_OBJS
) $(HOST_CXX_LDFLAGS
) $(HOST_LDFLAGS
) $(HOST_LINKER_LIBPATHS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
665 $(HOST_CXX
) $(HOST_OUTOPTION
)$@
$($(notdir $@
)_OBJS
) $(HOST_CXX_LDFLAGS
) $(HOST_LDFLAGS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
668 # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
669 # so instead of deleting .o files after repacking them into a dylib, we make
670 # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
671 # so no need to conditionalize on OS version or debugging format.
673 $(SHARED_LIBRARY
): $(OBJS
) $(RESFILE
) $(RUST_STATIC_LIB
) $(STATIC_LIBS
) $(EXTRA_DEPS
) $(GLOBAL_DEPS
)
675 ifndef INCREMENTAL_LINKER
678 $(MKSHLIB
) $($@_
$(OBJS_VAR_SUFFIX
)) $(RESFILE
) $(LDFLAGS
) $(STATIC_LIBS
) $(RUST_STATIC_LIB
) $(SHARED_LIBS
) $(EXTRA_DSO_LDOPTS
) $(MOZ_GLUE_LDFLAGS
) $(OS_LIBS
)
679 $(call py_action
,check_binary
,--target
$@
)
681 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
682 ifdef MSMANIFEST_TOOL
683 ifdef EMBED_MANIFEST_AT
684 @if
test -f
$@.manifest
; then \
685 if
test -f
'$(srcdir)/$@.manifest'; then \
686 echo
'Embedding manifest from $(srcdir_rel)/$@.manifest and $@.manifest'; \
687 $(MT
) -NOLOGO
-MANIFEST
'$(srcdir_rel)/$@.manifest' $@.manifest
-OUTPUTRESOURCE
:$@\
;$(EMBED_MANIFEST_AT
); \
689 echo
'Embedding manifest from $@.manifest'; \
690 $(MT
) -NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;$(EMBED_MANIFEST_AT
); \
692 elif
test -f
'$(srcdir)/$@.manifest'; then \
693 echo
'Embedding manifest from $(srcdir_rel)/$@.manifest'; \
694 $(MT
) -NOLOGO
-MANIFEST
'$(srcdir_rel)/$@.manifest' -OUTPUTRESOURCE
:$@\
;$(EMBED_MANIFEST_AT
); \
696 endif # EMBED_MANIFEST_AT
697 endif # MSVC with manifest tool
698 ifdef MOZ_PROFILE_GENERATE
699 touch
-t
`date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
701 endif # WINNT && !GCC
704 $(STRIP
) $(STRIP_FLAGS
) $@
707 # The object file is in the current directory, and the source file can be any
708 # relative path. This macro adds the dependency obj: src for each source file.
709 # This dependency must be first for the $< flag to work correctly, and the
710 # rules that have commands for these targets must not list any other
711 # prerequisites, or they will override the $< variable.
713 $(basename $3$(notdir $1)).
$2: $1 $$(call mkdir_deps
,$$(MDDEPDIR
))
715 $(foreach f
,$(CSRCS
) $(SSRCS
) $(CPPSRCS
) $(CMSRCS
) $(CMMSRCS
) $(ASFILES
),$(eval
$(call src_objdep
,$(f
),$(OBJ_SUFFIX
))))
716 $(foreach f
,$(HOST_CSRCS
) $(HOST_CPPSRCS
) $(HOST_CMSRCS
) $(HOST_CMMSRCS
),$(eval
$(call src_objdep
,$(f
),$(_OBJ_SUFFIX
),host_
)))
718 # The Rust compiler only outputs library objects, and so we need different
719 # mangling to generate dependency rules for it.
720 mk_libname
= $(basename lib
$(notdir $1)).rlib
721 src_libdep
= $(call mk_libname
,$1): $1 $$(call mkdir_deps
,$$(MDDEPDIR
))
722 mk_global_crate_libname
= $(basename lib
$(notdir $1)).
$(LIB_SUFFIX
)
723 crate_src_libdep
= $(call mk_global_crate_libname
,$1): $1 $$(call mkdir_deps
,$$(MDDEPDIR
))
724 $(foreach f
,$(RSSRCS
),$(eval
$(call src_libdep
,$(f
))))
725 $(foreach f
,$(RS_STATICLIB_CRATE_SRC
),$(eval
$(call crate_src_libdep
,$(f
))))
727 $(OBJS
) $(HOST_OBJS
) $(PROGOBJS
) $(HOST_PROGOBJS
): $(GLOBAL_DEPS
)
729 # Rules for building native targets must come first because of the host_ prefix
731 $(REPORT_BUILD_VERBOSE
)
732 $(ELOG
) $(HOST_CC
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CPPFLAGS
) $(HOST_CFLAGS
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
735 $(REPORT_BUILD_VERBOSE
)
736 $(call BUILDSTATUS
,OBJECT_FILE
$@
)
737 $(ELOG
) $(HOST_CXX
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CPPFLAGS
) $(HOST_CXXFLAGS
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
740 $(REPORT_BUILD_VERBOSE
)
741 $(ELOG
) $(HOST_CC
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CPPFLAGS
) $(HOST_CFLAGS
) $(HOST_CMFLAGS
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
744 $(REPORT_BUILD_VERBOSE
)
745 $(ELOG
) $(HOST_CXX
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CPPFLAGS
) $(HOST_CXXFLAGS
) $(HOST_CMMFLAGS
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
748 $(REPORT_BUILD_VERBOSE
)
749 $(ELOG
) $(CC
) $(OUTOPTION
)$@
-c
$(COMPILE_CFLAGS
) $($(notdir $<)_FLAGS
) $(_VPATH_SRCS
)
751 # DEFINES and ACDEFINES are needed here to enable conditional compilation of Q_OBJECTs:
752 # 'moc' only knows about #defines it gets on the command line (-D...), not in
753 # included headers like mozilla-config.h
754 $(filter moc_
%.
cpp,$(CPPSRCS
)): moc_
%.
cpp: %.h
755 $(REPORT_BUILD_VERBOSE
)
756 $(ELOG
) $(MOC
) $(DEFINES
) $(ACDEFINES
) $< $(OUTOPTION
)$@
758 $(filter moc_
%.
cc,$(CPPSRCS
)): moc_
%.
cc: %.
cc
759 $(REPORT_BUILD_VERBOSE
)
760 $(ELOG
) $(MOC
) $(DEFINES
) $(ACDEFINES
) $(_VPATH_SRCS
:.
cc=.h
) $(OUTOPTION
)$@
762 $(filter qrc_
%.
cpp,$(CPPSRCS
)): qrc_
%.
cpp: %.qrc
763 $(REPORT_BUILD_VERBOSE
)
764 $(ELOG
) $(RCC
) -name
$* $< $(OUTOPTION
)$@
767 # The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
770 $(REPORT_BUILD_VERBOSE
)
771 $(AS
) $(ASOUTOPTION
)$@
$(ASFLAGS
) $($(notdir $<)_FLAGS
) $(AS_DASH_C_FLAG
) $(_VPATH_SRCS
)
777 ifdef MOZ_CRASHREPORTER
778 $$(call py_action
,dumpsymbols
,$$(abspath
$$<) $$(abspath
$$@
) $$(DUMP_SYMBOLS_FLAGS
))
782 ifndef MOZ_PROFILE_GENERATE
783 ifneq (,$(filter $(DIST
)/bin
%,$(FINAL_TARGET
)))
784 DUMP_SYMS_TARGETS
:= $(SHARED_LIBRARY
) $(PROGRAM
) $(SIMPLE_PROGRAMS
)
789 ifeq (,$(filter 1,$(MOZ_AUTOMATION_BUILD_SYMBOLS
)))
795 PDB_FILES
= $(addsuffix .pdb
,$(basename $(DUMP_SYMS_TARGETS
)))
796 PDB_DEST ?
= $(FINAL_TARGET
)
798 INSTALL_TARGETS
+= PDB
799 else ifdef MOZ_CRASHREPORTER
800 $(foreach file
,$(DUMP_SYMS_TARGETS
),$(eval
$(call syms_template
,$(file
),$(notdir $(file
))_syms.track
)))
803 cargo_host_flag
:= --target
=$(RUST_HOST_TARGET
)
804 cargo_target_flag
:= --target
=$(RUST_TARGET
)
806 # Permit users to pass flags to cargo from their mozconfigs (e.g. --color=always).
807 cargo_build_flags
= $(CARGOFLAGS
)
808 ifndef MOZ_DEBUG_RUST
809 cargo_build_flags
+= --release
812 # The Spidermonkey library can be built from a package tarball outside the
813 # tree, so we want to let Cargo create lock files in this case. When built
814 # within a tree, the Rust dependencies have been vendored in so Cargo won't
815 # touch the lock file.
817 cargo_build_flags
+= --frozen
820 cargo_build_flags
+= --manifest-path
$(CARGO_FILE
)
821 ifdef BUILD_VERBOSE_LOG
822 cargo_build_flags
+= -vv
825 # Enable color output if original stdout was a TTY and color settings
826 # aren't already present. This essentially restores the default behavior
827 # of cargo when running via `mach`.
828 ifdef MACH_STDOUT_ISATTY
829 ifeq (,$(findstring --color
,$(cargo_build_flags
)))
830 cargo_build_flags
+= --color
=always
834 # These flags are passed via `cargo rustc` and only apply to the final rustc
835 # invocation (i.e., only the top-level crate, not its dependencies).
836 cargo_rustc_flags
= $(CARGO_RUSTCFLAGS
)
837 ifndef DEVELOPER_OPTIONS
838 ifndef MOZ_DEBUG_RUST
839 # Enable link-time optimization for release builds.
840 cargo_rustc_flags
+= -C lto
844 ifdef CARGO_INCREMENTAL
845 cargo_incremental
:= CARGO_INCREMENTAL
=$(CARGO_INCREMENTAL
)
849 ifeq (neon
,$(MOZ_FPU
))
850 rustflags_neon
+= -C target_feature
=+neon
853 rustflags_override
= $(MOZ_RUST_DEFAULT_FLAGS
) $(rustflags_neon
)
855 ifdef MOZ_USING_SCCACHE
856 sccache_wrap
:= RUSTC_WRAPPER
='$(CCACHE)'
859 ifdef MOZ_CODE_COVERAGE
860 ifeq (gcc
,$(CC_TYPE
))
868 ifneq (1,$(CODE_COVERAGE_GCC
))
869 ifndef FUZZING_INTERFACES
870 # Pass the compilers and flags in use to cargo for use in build scripts.
871 # * Don't do this for ASAN/TSAN builds because we don't pass our custom linker (see below)
872 # which will muck things up.
873 # * Don't do this for GCC code coverage builds because the way rustc invokes the linker doesn't
874 # work with GCC 6: https://bugzilla.mozilla.org/show_bug.cgi?id=1477305
876 # We don't pass HOST_{CC,CXX} down in any form because our host value might not match
877 # what cargo chooses and there's no way to control cargo's selection, so we just have to
878 # hope that if something needs to build a host C source file it can find a usable compiler!
880 # We're passing these for consumption by the `cc` crate, which doesn't use the same
881 # convention as cargo itself:
882 # https://github.com/alexcrichton/cc-rs/blob/baa71c0e298d9ad7ac30f0ad78f20b4b3b3a8fb2/src/lib.rs#L1715
883 rust_cc_env_name
:= $(subst -,_
,$(RUST_TARGET
))
885 ifeq (WINNT
,$(HOST_OS_ARCH
))
886 # Don't do most of this on Windows because msys path translation makes a mess of the paths, and
887 # we put MSVC in PATH there anyway. But we do suppress warnings, since all such warnings
888 # are in third-party code.
889 cargo_c_compiler_envs
:= \
890 CFLAGS_
$(rust_cc_env_name
)="-w" \
893 cargo_c_compiler_envs
:= \
894 CC_
$(rust_cc_env_name
)="$(CC)" \
895 CXX_
$(rust_cc_env_name
)="$(CXX)" \
896 CFLAGS_
$(rust_cc_env_name
)="$(COMPUTED_CFLAGS)" \
897 CXXFLAGS_
$(rust_cc_env_name
)="$(COMPUTED_CXXFLAGS)" \
898 AR_
$(rust_cc_env_name
)="$(AR)" \
901 endif # FUZZING_INTERFACES
902 endif # MOZ_CODE_COVERAGE
907 # We use the + prefix to pass down the jobserver fds to cargo, but we
908 # don't use the prefix when make -n is used, so that cargo doesn't run
911 $(if
$(findstring n
,$(filter-out --%, $(MAKEFLAGS
))),,+)env
$(sccache_wrap
) \
912 CARGO_TARGET_DIR
=$(CARGO_TARGET_DIR
) \
917 $(cargo_c_compiler_envs
) \
918 MOZ_SRC
=$(topsrcdir
) \
919 MOZ_DIST
=$(ABS_DIST
) \
920 LIBCLANG_PATH
="$(MOZ_LIBCLANG_PATH)" \
921 CLANG_PATH
="$(MOZ_CLANG_PATH)" \
922 PKG_CONFIG_ALLOW_CROSS
=1 \
923 RUST_BACKTRACE
=full \
924 MOZ_TOPOBJDIR
=$(topobjdir
) \
925 $(cargo_incremental
) \
927 $(CARGO
) $(1) $(cargo_build_flags
)
930 # This function is intended to be called by:
932 # $(call CARGO_BUILD,EXTRA_ENV_VAR1=X EXTRA_ENV_VAR2=Y ...)
934 # but, given the idiosyncracies of make, can also be called without arguments:
936 # $(call CARGO_BUILD)
937 define CARGO_BUILD_HOST
938 $(call RUN_CARGO
,rustc
,$(rustflags_override
),$(1))
941 define CARGO_CHECK_HOST
942 $(call RUN_CARGO
,check,$(rustflags_override
),$(1))
946 $(call RUN_CARGO
,rustc
,$(rustflags_override
) $(RUSTFLAGS
),$(1))
950 $(call RUN_CARGO
,check,$(rustflags_override
) $(RUSTFLAGS
),$(1))
953 cargo_linker_env_var
:= CARGO_TARGET_
$(RUST_TARGET_ENV_NAME
)_LINKER
955 # Don't define a custom linker on Windows, as it's difficult to have a
956 # non-binary file that will get executed correctly by Cargo. We don't
957 # have to worry about a cross-compiling (besides x86-64 -> x86, which
958 # already works with the current setup) setup on Windows, and we don't
959 # have to pass in any special linker options on Windows.
960 ifneq (WINNT
,$(OS_ARCH
))
962 # Defining all of this for ASan/TSan builds results in crashes while running
963 # some crates's build scripts (!), so disable it for now.
967 ifndef FUZZING_INTERFACES
968 # Cargo needs the same linker flags as the C/C++ compiler,
969 # but not the final libraries. Filter those out because they
970 # cause problems on macOS 10.7; see bug 1365993 for details.
971 # Also, we don't want to pass PGO flags until cargo supports them.
972 target_cargo_env_vars
:= \
973 MOZ_CARGO_WRAP_LDFLAGS
="$(filter-out -fsanitize=cfi% -framework Cocoa -lobjc AudioToolbox ExceptionHandling -fprofile-%,$(LDFLAGS))" \
974 MOZ_CARGO_WRAP_LD
="$(CC)" \
975 $(cargo_linker_env_var
)=$(topsrcdir
)/build
/cargo-linker
976 endif # FUZZING_INTERFACES
983 ifdef RUST_LIBRARY_FILE
985 ifdef RUST_LIBRARY_FEATURES
986 rust_features_flag
:= --features
"$(RUST_LIBRARY_FEATURES)"
989 # Assume any system libraries rustc links against are already in the target's LIBS.
991 # We need to run cargo unconditionally, because cargo is the only thing that
992 # has full visibility into how changes in Rust sources might affect the final
995 # When we are building in --enable-release mode; we add an additional check to confirm
996 # that we are not importing any networking-related functions in rust code. This reduces
997 # the chance of proxy bypasses originating from rust code.
998 force-cargo-library-build
:
1000 $(call CARGO_BUILD
,$(target_cargo_env_vars
)) --lib
$(cargo_target_flag
) $(rust_features_flag
) -- $(cargo_rustc_flags
)
1001 ifndef DEVELOPER_OPTIONS
1002 ifndef MOZ_DEBUG_RUST
1003 ifeq ($(OS_ARCH
), Linux
)
1004 $(call py_action
,check_binary
,--target
--networking
$(RUST_LIBRARY_FILE
))
1009 $(RUST_LIBRARY_FILE
): force-cargo-library-build
1011 force-cargo-library-check
:
1012 $(call CARGO_CHECK
,$(target_cargo_env_vars
)) --lib
$(cargo_target_flag
) $(rust_features_flag
)
1014 force-cargo-library-check
:
1016 endif # RUST_LIBRARY_FILE
1020 rust_test_options
:= $(foreach test,$(RUST_TESTS
),-p
$(test))
1022 ifdef RUST_TEST_FEATURES
1023 rust_features_flag
:= --features
"$(RUST_TEST_FEATURES)"
1026 # Don't stop at the first failure. We want to list all failures together.
1027 rust_test_flag
:= --no-fail-fast
1029 force-cargo-test-run
:
1030 $(call RUN_CARGO
,test $(cargo_target_flag
) $(rust_test_flag
) $(rust_test_options
) $(rust_features_flag
),$(rustflags_override
) $(RUSTFLAGS
),$(target_cargo_env_vars
))
1034 ifdef HOST_RUST_LIBRARY_FILE
1036 ifdef HOST_RUST_LIBRARY_FEATURES
1037 host_rust_features_flag
:= --features
"$(HOST_RUST_LIBRARY_FEATURES)"
1040 force-cargo-host-library-build
:
1042 $(call CARGO_BUILD_HOST
) --lib
$(cargo_host_flag
) $(host_rust_features_flag
)
1044 $(HOST_RUST_LIBRARY_FILE
): force-cargo-host-library-build
1046 force-cargo-host-library-check
:
1047 $(call CARGO_CHECK_HOST
) --lib
$(cargo_host_flag
) $(host_rust_features_flag
)
1049 force-cargo-host-library-check
:
1051 endif # HOST_RUST_LIBRARY_FILE
1054 force-cargo-program-build
:
1056 $(call CARGO_BUILD
,$(target_cargo_env_vars
)) $(addprefix --bin
,$(RUST_CARGO_PROGRAMS
)) $(cargo_target_flag
)
1058 $(RUST_PROGRAMS
): force-cargo-program-build
1060 force-cargo-program-check
:
1061 $(call CARGO_CHECK
,$(target_cargo_env_vars
)) $(addprefix --bin
,$(RUST_CARGO_PROGRAMS
)) $(cargo_target_flag
)
1063 force-cargo-program-check
:
1065 endif # RUST_PROGRAMS
1066 ifdef HOST_RUST_PROGRAMS
1067 force-cargo-host-program-build
:
1069 $(call CARGO_BUILD_HOST
) $(addprefix --bin
,$(HOST_RUST_CARGO_PROGRAMS
)) $(cargo_host_flag
)
1071 $(HOST_RUST_PROGRAMS
): force-cargo-host-program-build
1073 force-cargo-host-program-check
:
1075 $(call CARGO_CHECK_HOST
) $(addprefix --bin
,$(HOST_RUST_CARGO_PROGRAMS
)) $(cargo_host_flag
)
1077 force-cargo-host-program-check
:
1079 endif # HOST_RUST_PROGRAMS
1083 $(AS
) $(ASOUTOPTION
)$@
$(SFLAGS
) $($(notdir $<)_FLAGS
) -c
$<
1086 $(REPORT_BUILD_VERBOSE
)
1087 $(call BUILDSTATUS
,OBJECT_FILE
$@
)
1088 $(ELOG
) $(CCC
) $(OUTOPTION
)$@
-c
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(_VPATH_SRCS
)
1091 $(REPORT_BUILD_VERBOSE
)
1092 $(ELOG
) $(CCC
) -o
$@
-c
$(COMPILE_CXXFLAGS
) $(COMPILE_CMMFLAGS
) $($(notdir $<)_FLAGS
) $(_VPATH_SRCS
)
1095 $(REPORT_BUILD_VERBOSE
)
1096 $(ELOG
) $(CC
) -o
$@
-c
$(COMPILE_CFLAGS
) $(COMPILE_CMFLAGS
) $($(notdir $<)_FLAGS
) $(_VPATH_SRCS
)
1098 $(filter %.s
,$(CPPSRCS
:%.
cpp=%.s
)): %.s
: %.
cpp $(call mkdir_deps
,$(MDDEPDIR
))
1099 $(REPORT_BUILD_VERBOSE
)
1100 $(CCC
) -S
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(_VPATH_SRCS
)
1102 $(filter %.s
,$(CPPSRCS
:%.
cc=%.s
)): %.s
: %.
cc $(call mkdir_deps
,$(MDDEPDIR
))
1103 $(REPORT_BUILD_VERBOSE
)
1104 $(CCC
) -S
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(_VPATH_SRCS
)
1106 $(filter %.s
,$(CPPSRCS
:%.
cxx=%.s
)): %.s
: %.
cpp $(call mkdir_deps
,$(MDDEPDIR
))
1107 $(REPORT_BUILD_VERBOSE
)
1108 $(CCC
) -S
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(_VPATH_SRCS
)
1110 $(filter %.s
,$(CSRCS
:%.c
=%.s
)): %.s
: %.c
$(call mkdir_deps
,$(MDDEPDIR
))
1111 $(REPORT_BUILD_VERBOSE
)
1112 $(CC
) -S
$(COMPILE_CFLAGS
) $($(notdir $<)_FLAGS
) $(_VPATH_SRCS
)
1114 ifneq (,$(filter %.i
,$(MAKECMDGOALS
)))
1115 # Call as $(call _group_srcs,extension,$(SRCS)) - this will create a list
1116 # of the full sources, as well as the $(notdir) version. So:
1117 # foo.cpp sub/bar.cpp
1119 # foo.cpp sub/bar.cpp bar.cpp
1121 # This way we can match both 'make sub/bar.i' and 'make bar.i'
1122 _group_srcs
= $(sort $(patsubst %.
$1,%.i
,$(filter %.
$1,$2 $(notdir $2))))
1124 define PREPROCESS_RULES
1125 _PREPROCESSED_
$1_FILES := $$(call _group_srcs
,$1,$$($2))
1126 # Make preprocessed files PHONY so they are always executed, since they are
1127 # manual targets and we don't necessarily write to $@.
1128 .PHONY
: $$(_PREPROCESSED_
$1_FILES)
1130 # Hack up VPATH so we can reach the sources. Eg: 'make Parser.i' may need to
1131 # reach $(srcdir)/frontend/Parser.i
1132 vpath
%.
$1 $$(addprefix $$(srcdir)/,$$(sort $$(dir $$($2))))
1133 vpath
%.
$1 $$(addprefix $$(CURDIR
)/,$$(sort $$(dir $$($2))))
1135 $$(_PREPROCESSED_
$1_FILES): _DEPEND_CFLAGS
=
1136 $$(_PREPROCESSED_
$1_FILES): %.i
: %.
$1
1137 $$(REPORT_BUILD_VERBOSE
)
1138 $$(addprefix $$(MKDIR
) -p
,$$(filter-out .
,$$(@D
)))
1139 $$($3) -C
$$(PREPROCESS_OPTION
)$$@
$(foreach var
,$4,$$($(var
))) $$($$(notdir $$<)_FLAGS
) $$(_VPATH_SRCS
)
1143 $(eval
$(call PREPROCESS_RULES
,cpp,CPPSRCS
,CCC
,COMPILE_CXXFLAGS
))
1144 $(eval
$(call PREPROCESS_RULES
,cc,CPPSRCS
,CCC
,COMPILE_CXXFLAGS
))
1145 $(eval
$(call PREPROCESS_RULES
,cxx,CPPSRCS
,CCC
,COMPILE_CXXFLAGS
))
1146 $(eval
$(call PREPROCESS_RULES
,c
,CSRCS
,CC
,COMPILE_CFLAGS
))
1147 $(eval
$(call PREPROCESS_RULES
,mm
,CMMSRCS
,CCC
,COMPILE_CXXFLAGS COMPILE_CMMFLAGS
))
1149 # Default to pre-processing the actual unified file. This can be overridden
1150 # at the command-line to pre-process only the individual source file.
1153 # PP_REINVOKE gets set on the sub-make to prevent us from going in an
1154 # infinite loop if the filename doesn't exist in the unified source files.
1157 MATCH_cpp
= \
(cpp\|
cc|
cxx\
)
1162 # When building with PP_UNIFIED=0, we also have to look in the Unified files to
1163 # find a matching pathname.
1164 _get_all_sources
= $1 $(if
$(filter Unified
%,$1),$(shell sed
-n
's/\#include "\(.*\)"$$/\1/p' $(filter Unified
%,$1)))
1165 all_cpp_sources
:= $(call _get_all_sources
,$(CPPSRCS
))
1166 all_mm_sources
:= $(call _get_all_sources
,$(CMMSRCS
))
1167 all_c_sources
:= $(call _get_all_sources
,$(CSRCS
))
1168 all_sources
:= $(all_cpp_sources
) $(all_cmm_sources
) $(all_c_sources
)
1170 # The catch-all %.i rule runs when we pass in a .i filename that doesn't match
1171 # one of the *SRCS variables. The two code paths depend on whether or not
1172 # we are requesting a unified file (PP_UNIFIED=1, the default) or not:
1175 # - Look for it in any of the Unified files, and re-exec make with
1176 # Unified_foo0.i as the target. This gets us the full unified preprocessed
1180 # - If the .i filename is in *SRCS, or in a Unified filename, then we re-exec
1181 # make with that filename as the target. The *SRCS variables are modified
1182 # to have the Unified sources appended to them so that the static pattern
1185 ifeq ($(PP_UNIFIED
),1)
1186 @
$(MAKE
) PP_REINVOKE
=1 \
1187 $(or
$(addsuffix .i
, \
1188 $(foreach type
,c
cpp mm
, \
1189 $(if
$(filter Unified
%,$($(UPPER_
$(type
))SRCS
)), \
1190 $(shell grep
-l
'#include "\(.*/\)\?$(basename $@).$(or $(MATCH_$(type)),$(type))"' Unified
*.
$(type
) | sed
's/\.$(type)$$//') \
1191 ))),$(error
"File not found for preprocessing: $@"))
1193 @
$(MAKE
) PP_REINVOKE
=1 $@ \
1194 $(foreach type
,c
cpp mm
,$(UPPER_
$(type
))SRCS
="$(all_$(type)_sources)")
1201 $(RESFILE
): %.res
: %.rc
1203 @echo Creating Resource file
: $@
1205 $(RC
) $(RCFLAGS
) $(filter-out -U
%,$(DEFINES
)) $(INCLUDES
:-I
%=--include-dir
%) $(OUTOPTION
)$@
$(_VPATH_SRCS
)
1207 $(RC
) $(RCFLAGS
) -r
$(DEFINES
) $(INCLUDES
) $(OUTOPTION
)$@
$(_VPATH_SRCS
)
1210 # Cancel GNU make built-in implicit rules
1213 ifneq (,$(filter WINNT
,$(OS_ARCH
)))
1220 SPACE
:= $(EMPTY
) $(EMPTY
)
1222 # MSYS has its own special path form, but javac expects the source and class
1223 # paths to be in the DOS form (i.e. e:/builds/...). This function does the
1224 # appropriate conversion on Windows, but is a noop on other systems.
1225 ifeq ($(HOST_OS_ARCH
),WINNT
)
1226 # We use 'pwd -W' to get DOS form of the path. However, since the given path
1227 # could be a file or a non-existent path, we cannot call 'pwd -W' directly
1228 # on the path. Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
1229 # on it, then merge with the rest of the path.
1230 root-path
= $(shell echo
$(1) | sed
-e
's|\(/[^/]*\)/\?\(.*\)|\1|')
1231 non-root-path
= $(shell echo
$(1) | sed
-e
's|\(/[^/]*\)/\?\(.*\)|\2|')
1232 normalizepath
= $(foreach p
,$(1),$(if
$(filter /%,$(1)),$(patsubst %/,%,$(shell cd
$(call root-path
,$(1)) && pwd
-W
))/$(call non-root-path
,$(1)),$(1)))
1234 normalizepath
= $(1)
1237 ###############################################################################
1238 # Bunch of things that extend the 'export' rule (in order):
1239 ###############################################################################
1241 ifneq ($(XPI_NAME
),)
1245 export:: $(FINAL_TARGET
)
1248 ################################################################################
1249 # The default location for prefs is the gre prefs directory.
1250 # PREF_DIR is used for L10N_PREF_JS_EXPORTS in various locales/ directories.
1251 PREF_DIR
= defaults
/pref
1253 # If DIST_SUBDIR is defined it indicates that app and gre dirs are
1254 # different and that we are building app related resources. Hence,
1255 # PREF_DIR should point to the app prefs location.
1256 ifneq (,$(DIST_SUBDIR
)$(XPI_NAME
))
1257 PREF_DIR
= defaults
/preferences
1260 ################################################################################
1267 $(FINAL_TARGET
)/chrome
: $(call mkdir_deps
,$(FINAL_TARGET
)/chrome
)
1269 ifneq (,$(JAR_MANIFEST
))
1270 ifndef NO_DIST_INSTALL
1273 ifdef XPI_ROOT_APPID
1274 # For add-on packaging we may specify that an application
1275 # sub-dir should be added to the root chrome manifest with
1276 # a specific application id.
1277 MAKE_JARS_FLAGS
+= --root-manifest-entry-appid
='$(XPI_ROOT_APPID)'
1280 # if DIST_SUBDIR is defined but XPI_ROOT_APPID is not there's
1281 # no way langpacks will get packaged right, so error out.
1282 ifneq (,$(DIST_SUBDIR
))
1283 ifndef XPI_ROOT_APPID
1284 $(error XPI_ROOT_APPID is not defined
- langpacks will break.
)
1289 libs realchrome
:: $(FINAL_TARGET
)/chrome
1290 $(call py_action
,jar_maker
,\
1291 $(QUIET
) -d
$(FINAL_TARGET
) \
1292 $(MAKE_JARS_FLAGS
) $(DEFINES
) $(ACDEFINES
) \
1299 # When you move this out of the tools tier, please remove the corresponding
1300 # hacks in recursivemake.py that check if Makefile.in sets the variable.
1301 ifneq ($(XPI_PKGNAME
),)
1305 @echo
'Stripping $(XPI_PKGNAME) package directory...'
1306 @echo
$(FINAL_TARGET
)
1307 @cd
$(FINAL_TARGET
) && find .
! -type d \
1317 ! -name
'*.properties' \
1328 $(PLATFORM_EXCLUDE_LIST
) \
1329 -exec
$(STRIP
) $(STRIP_FLAGS
) {} >/dev
/null
2>&1 \
;
1332 @echo
'Packaging $(XPI_PKGNAME).xpi...'
1333 $(call py_action
,zip
,-C
$(FINAL_TARGET
) ..
/$(XPI_PKGNAME
).xpi
'*')
1336 # See comment above about moving this out of the tools tier.
1337 ifdef INSTALL_EXTENSION_ID
1339 $(error XPI_NAME must be set for INSTALL_EXTENSION_ID
)
1343 $(RM
) -r
'$(DIST)/bin/distribution$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)'
1344 $(NSINSTALL
) -D
'$(DIST)/bin/distribution$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)'
1345 $(call copy_dir
,$(FINAL_TARGET
),$(DIST
)/bin
/distribution
$(DIST_SUBDIR
:%=/%)/extensions
/$(INSTALL_EXTENSION_ID
))
1349 #############################################################################
1350 # MDDEPDIR is the subdirectory where all the dependency files are placed.
1351 # This uses a make rule (instead of a macro) to support parallel
1352 # builds (-jN). If this were done in the LOOP_OVER_DIRS macro, two
1353 # processes could simultaneously try to create the same directory.
1355 # We use $(CURDIR) in the rule's target to ensure that we don't find
1356 # a dependency directory in the source tree via VPATH (perhaps from
1357 # a previous build in the source tree) and thus neglect to create a
1358 # dependency directory in the object directory, where we really need
1361 ifneq (,$(filter-out all chrome default
export realchrome
clean clobber clobber_all
distclean realclean,$(MAKECMDGOALS
)))
1362 MDDEPEND_FILES
:= $(strip $(wildcard $(addprefix $(MDDEPDIR
)/,$(addsuffix .pp
,$(notdir $(sort $(OBJS
) $(PROGOBJS
) $(HOST_OBJS
) $(HOST_PROGOBJS
)))))))
1364 ifneq (,$(MDDEPEND_FILES
))
1365 -include $(MDDEPEND_FILES
)
1370 MDDEPEND_FILES
:= $(strip $(wildcard $(addprefix $(MDDEPDIR
)/,$(EXTRA_MDDEPEND_FILES
))))
1372 ifneq (,$(MDDEPEND_FILES
))
1373 -include $(MDDEPEND_FILES
)
1376 ################################################################################
1377 # Install/copy rules
1379 # The INSTALL_TARGETS variable contains a list of all install target
1380 # categories. Each category defines a list of files and executables, and an
1381 # install destination,
1383 # FOO_FILES := foo bar
1384 # FOO_EXECUTABLES := baz
1385 # FOO_DEST := target_path
1386 # INSTALL_TARGETS += FOO
1388 # Additionally, a FOO_TARGET variable may be added to indicate the target for
1389 # which the files and executables are installed. Default is "libs".
1391 # Finally, a FOO_KEEP_PATH variable may be set to 1 to indicate the paths given
1392 # in FOO_FILES/FOO_EXECUTABLES are to be kept at the destination. That is,
1393 # if FOO_FILES is bar/baz/qux.h, and FOO_DEST is $(DIST)/include, the installed
1394 # file would be $(DIST)/include/bar/baz/qux.h instead of $(DIST)/include/qux.h
1396 # If we're using binary nsinstall and it's not built yet, fallback to python nsinstall.
1397 ifneq (,$(filter $(DEPTH
)/config
/nsinstall
$(HOST_BIN_SUFFIX
),$(install_cmd
)))
1398 ifeq (,$(wildcard $(DEPTH
)/config
/nsinstall
$(HOST_BIN_SUFFIX
)))
1399 nsinstall_is_usable
= $(if
$(wildcard $(DEPTH
)/config
/nsinstall
$(HOST_BIN_SUFFIX
)),yes
)
1401 define install_cmd_override
1402 $(1): install_cmd
= $$(if
$$(nsinstall_is_usable
),$$(INSTALL
),$$(NSINSTALL_PY
) -t
) $$(1)
1407 install_target_tier
= $(or
$($(1)_TARGET
),libs
)
1408 INSTALL_TARGETS_TIERS
:= $(sort $(foreach category
,$(INSTALL_TARGETS
),$(call install_target_tier
,$(category
))))
1410 install_target_result
= $($(1)_DEST
:%/=%)/$(if
$($(1)_KEEP_PATH
),$(2),$(notdir $(2)))
1411 install_target_files
= $(foreach file
,$($(1)_FILES
),$(call install_target_result
,$(category
),$(file
)))
1412 install_target_executables
= $(foreach file
,$($(1)_EXECUTABLES
),$(call install_target_result
,$(category
),$(file
)))
1414 # Work around a GNU make 3.81 bug where it gives $< the wrong value.
1415 # See details in bug 934864.
1416 define create_dependency
1421 define install_target_template
1422 $(call install_cmd_override
,$(2))
1423 $(call create_dependency
,$(2),$(1))
1426 $(foreach category
,$(INSTALL_TARGETS
),\
1427 $(if
$($(category
)_DEST
),,$(error Missing
$(category
)_DEST
)) \
1428 $(foreach tier
,$(call install_target_tier
,$(category
)),\
1429 $(eval INSTALL_TARGETS_FILES_
$(tier
) += $(call install_target_files
,$(category
))) \
1430 $(eval INSTALL_TARGETS_EXECUTABLES_
$(tier
) += $(call install_target_executables
,$(category
))) \
1432 $(foreach file
,$($(category
)_FILES
) $($(category
)_EXECUTABLES
), \
1433 $(eval
$(call install_target_template
,$(file
),$(call install_target_result
,$(category
),$(file
)))) \
1437 $(foreach tier
,$(INSTALL_TARGETS_TIERS
), \
1438 $(eval
$(tier
):: $(INSTALL_TARGETS_FILES_
$(tier
)) $(INSTALL_TARGETS_EXECUTABLES_
$(tier
))) \
1441 install_targets_sanity
= $(if
$(filter-out $(notdir $@
),$(notdir $(<))),$(error Looks like
$@ has an unexpected dependency on
$< which breaks INSTALL_TARGETS
))
1443 $(sort $(foreach tier
,$(INSTALL_TARGETS_TIERS
),$(INSTALL_TARGETS_FILES_
$(tier
)))):
1444 $(install_targets_sanity
)
1445 $(call install_cmd
,$(IFLAGS1
) '$<' '$(@D)')
1447 $(sort $(foreach tier
,$(INSTALL_TARGETS_TIERS
),$(INSTALL_TARGETS_EXECUTABLES_
$(tier
)))):
1448 $(install_targets_sanity
)
1449 $(call install_cmd
,$(IFLAGS2
) '$<' '$(@D)')
1451 ################################################################################
1452 # Preprocessing rules
1454 # The PP_TARGETS variable contains a list of all preprocessing target
1455 # categories. Each category has associated variables listing input files, the
1456 # output directory, extra preprocessor flags, and so on. For example:
1459 # FOO_PATH := target-directory
1460 # FOO_FLAGS := -Dsome_flag
1463 # If PP_TARGETS lists a category name <C> (like FOO, above), then we consult the
1464 # following make variables to see what to do:
1466 # - <C> lists input files to be preprocessed with mozbuild.action.preprocessor.
1467 # We search VPATH for the names given here. If an input file name ends in
1468 # '.in', that suffix is omitted from the output file name.
1470 # - <C>_PATH names the directory in which to place the preprocessed output
1471 # files. We create this directory if it does not already exist. Setting
1472 # this variable is optional; if unset, we install the files in $(CURDIR).
1474 # - <C>_FLAGS lists flags to pass to mozbuild.action.preprocessor, in addition
1475 # to the usual bunch. Setting this variable is optional.
1477 # - <C>_TARGET names the 'make' target that should depend on creating the output
1478 # files. Setting this variable is optional; if unset, we preprocess the
1479 # files for the 'libs' target.
1481 # - <C>_KEEP_PATH may be set to 1 to indicate the paths given in <C> are to be
1482 # kept under <C>_PATH. That is, if <C> is bar/baz/qux.h.in and <C>_PATH is
1483 # $(DIST)/include, the preprocessed file would be $(DIST)/include/bar/baz/qux.h
1484 # instead of $(DIST)/include/qux.h.
1486 pp_target_tier
= $(or
$($(1)_TARGET
),libs
)
1487 PP_TARGETS_TIERS
:= $(sort $(foreach category
,$(PP_TARGETS
),$(call pp_target_tier
,$(category
))))
1489 pp_target_result
= $(or
$($(1)_PATH
:%/=%),$(CURDIR
))/$(if
$($(1)_KEEP_PATH
),$(2:.in
=),$(notdir $(2:.in
=)))
1490 pp_target_results
= $(foreach file
,$($(1)),$(call pp_target_result
,$(category
),$(file
)))
1492 $(foreach category
,$(PP_TARGETS
), \
1493 $(foreach tier
,$(call pp_target_tier
,$(category
)), \
1494 $(eval PP_TARGETS_RESULTS_
$(tier
) += $(call pp_target_results
,$(category
))) \
1496 $(foreach file
,$($(category
)), \
1497 $(eval
$(call create_dependency
,$(call pp_target_result
,$(category
),$(file
)), \
1498 $(file
) $(GLOBAL_DEPS
))) \
1500 $(eval
$(call pp_target_results
,$(category
)): PP_TARGET_FLAGS
=$($(category
)_FLAGS
)) \
1503 $(foreach tier
,$(PP_TARGETS_TIERS
), \
1504 $(eval
$(tier
):: $(PP_TARGETS_RESULTS_
$(tier
))) \
1507 PP_TARGETS_ALL_RESULTS
:= $(sort $(foreach tier
,$(PP_TARGETS_TIERS
),$(PP_TARGETS_RESULTS_
$(tier
))))
1508 $(PP_TARGETS_ALL_RESULTS
):
1509 $(if
$(filter-out $(notdir $@
),$(notdir $(<:.in
=))),$(error Looks like
$@ has an unexpected dependency on
$< which breaks PP_TARGETS
))
1511 $(call py_action
,preprocessor
,--depend
$(MDDEPDIR
)/$(@F
).pp
$(PP_TARGET_FLAGS
) $(DEFINES
) $(ACDEFINES
) '$<' -o
'$@')
1513 $(filter %.css
,$(PP_TARGETS_ALL_RESULTS
)): PP_TARGET_FLAGS
+=--marker
%
1515 # The depfile is based on the filename, and we don't want conflicts. So check
1516 # there's only one occurrence of any given filename in PP_TARGETS_ALL_RESULTS.
1517 PP_TARGETS_ALL_RESULT_NAMES
:= $(notdir $(PP_TARGETS_ALL_RESULTS
))
1518 $(foreach file
,$(sort $(PP_TARGETS_ALL_RESULT_NAMES
)), \
1519 $(if
$(filter-out 1,$(words $(filter $(file
),$(PP_TARGETS_ALL_RESULT_NAMES
)))), \
1520 $(error Multiple preprocessing rules are creating a
$(file
) file
) \
1524 ifneq (,$(filter $(PP_TARGETS_TIERS
) $(PP_TARGETS_ALL_RESULTS
),$(MAKECMDGOALS
)))
1525 # If the depfile for a preprocessed file doesn't exist, add a dep to force
1527 $(foreach file
,$(PP_TARGETS_ALL_RESULTS
), \
1528 $(if
$(wildcard $(MDDEPDIR
)/$(notdir $(file
)).pp
), \
1530 $(eval
$(file
): FORCE
) \
1534 MDDEPEND_FILES
:= $(strip $(wildcard $(addprefix $(MDDEPDIR
)/,$(addsuffix .pp
,$(notdir $(PP_TARGETS_ALL_RESULTS
))))))
1536 ifneq (,$(MDDEPEND_FILES
))
1537 -include $(MDDEPEND_FILES
)
1542 # Pull in non-recursive targets if this is a partial tree build.
1543 ifndef TOPLEVEL_BUILD
1544 include $(MOZILLA_DIR
)/config
/makefiles
/nonrecursive.mk
1547 ################################################################################
1548 # Special gmake rules.
1549 ################################################################################
1553 # Re-define the list of default suffixes, so gmake won't have to churn through
1554 # hundreds of built-in suffix rules for stuff we don't need.
1559 # Fake targets. Always run these rules, even if a file/directory with that
1560 # name already exists.
1562 .PHONY
: all alltags boot chrome realchrome
clean clobber clobber_all
export install libs makefiles
realclean run_apprunner tools
$(DIRS
) FORCE
1564 # Used as a dependency to force targets to rebuild
1567 # Delete target if error occurs when building target
1572 TAGS
: $(CSRCS
) $(CPPSRCS
) $(wildcard *.h
)
1573 -etags
$(CSRCS
) $(CPPSRCS
) $(wildcard *.h
)
1576 ifndef INCLUDED_DEBUGMAKE_MK
#{
1577 ## Only parse when an echo* or show* target is requested
1578 ifneq (,$(call isTargetStem
,echo
,show
))
1579 include $(MOZILLA_DIR
)/config
/makefiles
/debugmake.mk
1585 $(DOXYGEN
) $(DEPTH
)/config
/doxygen.cfg
1587 FREEZE_VARIABLES
= \
1596 $(foreach var
,$(FREEZE_VARIABLES
),$(eval
$(var
)_FROZEN
:= '$($(var))'))
1598 CHECK_FROZEN_VARIABLES
= $(foreach var
,$(FREEZE_VARIABLES
), \
1599 $(if
$(subst $($(var
)_FROZEN
),,'$($(var))'),$(error Makefile variable
'$(var)' changed value after including rules.mk. Was
$($(var
)_FROZEN
), now
$($(var
)).
)))
1602 $(CHECK_FROZEN_VARIABLES
)
1604 .DEFAULT_GOAL
:= $(or
$(OVERRIDE_DEFAULT_GOAL
),default
)
1606 #############################################################################
1607 # Derived targets and dependencies
1609 include $(MOZILLA_DIR
)/config
/makefiles
/autotargets.mk
1610 ifneq ($(NULL
),$(AUTO_DEPS
))
1611 default
all libs tools
export:: $(AUTO_DEPS
)