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 # Make sure that anything that needs to be defined in moz.build wasn't
20 # overwritten after including config.mk.
21 _eval_for_side_effects
:= $(CHECK_MOZBUILD_VARIABLES
)
24 MOZILLA_DIR
= $(topsrcdir
)
27 ifndef INCLUDED_CONFIG_MK
28 include $(topsrcdir
)/config
/config.mk
31 ifndef INCLUDED_VERSION_MK
32 include $(topsrcdir
)/config
/version.mk
35 USE_AUTOTARGETS_MK
= 1
36 include $(topsrcdir
)/config
/makefiles
/makeutils.mk
39 REPORT_BUILD
= $(info $(shell $(PYTHON
) $(MOZILLA_DIR
)/config
/rebuild_check.py
$@
$^
))
41 REPORT_BUILD
= $(info $(notdir $@
))
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
$(BUILD_TOOLS
)/print-failed-commands.sh
55 _VPATH_SRCS
= $(abspath
$<)
57 ################################################################################
58 # Testing frameworks support
59 ################################################################################
61 testxpcobjdir
= $(DEPTH
)/_tests
/xpcshell
65 # Add test directories to the regular directories list. TEST_DIRS should
66 # arguably have the same status as other *_DIRS variables. It is coded this way
67 # until Makefiles stop using the "ifdef ENABLE_TESTS; DIRS +=" convention.
69 # The current developer workflow expects tests to be updated when processing
70 # the default target. If we ever change this implementation, the behavior
71 # should be preserved or the change should be widely communicated. A
72 # consequence of not processing test dir targets during the default target is
73 # that changes to tests may not be updated and code could assume to pass
74 # locally against non-current test code.
78 ifdef COMPILE_ENVIRONMENT
80 # Compile the tests to $(DIST)/bin. Make lots of niceties available by default
81 # through TestHarness.h, by modifying the list of includes and the libs against
83 SIMPLE_PROGRAMS
+= $(CPP_UNIT_TESTS
)
84 INCLUDES
+= -I
$(DIST
)/include/testing
86 ifndef MOZ_PROFILE_GENERATE
87 CPP_UNIT_TESTS_FILES
= $(CPP_UNIT_TESTS
)
88 CPP_UNIT_TESTS_DEST
= $(DIST
)/cppunittests
89 CPP_UNIT_TESTS_TARGET
= target
90 INSTALL_TARGETS
+= CPP_UNIT_TESTS
94 @
$(PYTHON
) $(topsrcdir
)/testing
/runcppunittests.py
--xre-path
=$(DIST
)/bin
--symbols-path
=$(DIST
)/crashreporter-symbols
$(CPP_UNIT_TESTS
)
96 cppunittests-remote
: DM_TRANS?
=adb
98 @if
[ '${TEST_DEVICE}' != '' -o
'$(DM_TRANS)' = 'adb' ]; then \
99 $(PYTHON
) -u
$(topsrcdir
)/testing
/remotecppunittests.py \
100 --xre-path
=$(DEPTH
)/dist/bin \
101 --localLib
=$(DEPTH
)/dist/$(MOZ_APP_NAME
) \
102 --dm_trans
=$(DM_TRANS
) \
103 --deviceIP
=${TEST_DEVICE} \
104 $(CPP_UNIT_TESTS
) $(EXTRA_TEST_ARGS
); \
106 echo
'please prepare your host with environment variables for TEST_DEVICE'; \
109 endif # COMPILE_ENVIRONMENT
110 endif # CPP_UNIT_TESTS
114 ifdef PYTHON_UNIT_TESTS
116 RUN_PYTHON_UNIT_TESTS
:= $(addsuffix -run
,$(PYTHON_UNIT_TESTS
))
118 .PHONY
: $(RUN_PYTHON_UNIT_TESTS
)
120 check:: $(RUN_PYTHON_UNIT_TESTS
)
122 $(RUN_PYTHON_UNIT_TESTS
): %-run
: %
123 @PYTHONDONTWRITEBYTECODE
=1 $(PYTHON
) $<
125 endif # PYTHON_UNIT_TESTS
133 # If FORCE_STATIC_LIB is set, build a static library.
134 # Otherwise, build a shared library.
139 # Don't build actual static library if a shared library is also built
140 ifdef FORCE_SHARED_LIB
141 # ... except when we really want one
143 LIBRARY
:= $(REAL_LIBRARY
) $(REAL_LIBRARY
).
$(LIBS_DESC_SUFFIX
)
145 LIBRARY
:= $(REAL_LIBRARY
).
$(LIBS_DESC_SUFFIX
)
148 # Only build actual library if it is installed in DIST/lib or SDK
149 ifeq (,$(SDK_LIBRARY
)$(DIST_INSTALL
)$(NO_EXPAND_LIBS
))
150 LIBRARY
:= $(REAL_LIBRARY
).
$(LIBS_DESC_SUFFIX
)
152 LIBRARY
:= $(REAL_LIBRARY
) $(REAL_LIBRARY
).
$(LIBS_DESC_SUFFIX
)
159 ifdef HOST_LIBRARY_NAME
160 HOST_LIBRARY
:= $(LIB_PREFIX
)$(HOST_LIBRARY_NAME
).
$(LIB_SUFFIX
)
165 ifdef FORCE_SHARED_LIB
169 MKSHLIB
= $(MKCSHLIB
)
175 endif # FORCE_SHARED_LIB
178 ifeq ($(OS_ARCH
),WINNT
)
182 # Unless we're building SIMPLE_PROGRAMS, all C++ files share a PDB file per
183 # directory. For parallel builds, this PDB file is shared and locked by
184 # MSPDBSRV.EXE, starting with MSVC8 SP1. If you're using MSVC 7.1 or MSVC8
185 # without SP1, don't do parallel builds.
187 # The final PDB for libraries and programs is created by the linker and uses
188 # a different name from the single PDB file created by the compiler. See
192 ifdef SIMPLE_PROGRAMS
193 COMPILE_PDB_FLAG ?
= -Fd
$(basename $(@F
)).pdb
195 COMPILE_PDB_FLAG ?
= -Fdgenerated.pdb
197 COMPILE_CFLAGS
+= $(COMPILE_PDB_FLAG
)
198 COMPILE_CXXFLAGS
+= $(COMPILE_PDB_FLAG
)
200 LINK_PDBFILE ?
= $(basename $(@F
)).pdb
202 CODFILE
=$(basename $(@F
)).cod
206 OS_LDFLAGS
+= -DEF
:$(call normalizepath
,$(DEFFILE
))
207 EXTRA_DEPS
+= $(DEFFILE
)
213 OS_LDFLAGS
+= $(call normalizepath
,$(DEFFILE
))
214 EXTRA_DEPS
+= $(DEFFILE
)
221 ifeq ($(SOLARIS_SUNPRO_CXX
),1)
222 ifeq (86,$(findstring 86,$(OS_TEST
)))
223 OS_LDFLAGS
+= -M
$(topsrcdir
)/config
/solaris_ia32.map
225 endif # Solaris Sun Studio C++
227 ifeq ($(HOST_OS_ARCH
),WINNT
)
228 HOST_PDBFILE
=$(basename $(@F
)).pdb
229 HOST_PDB_FLAG ?
= -Fd
$(HOST_PDBFILE
)
230 HOST_CFLAGS
+= $(HOST_PDB_FLAG
)
231 HOST_CXXFLAGS
+= $(HOST_PDB_FLAG
)
234 # Don't build SIMPLE_PROGRAMS during the MOZ_PROFILE_GENERATE pass
235 ifdef MOZ_PROFILE_GENERATE
239 ifdef COMPILE_ENVIRONMENT
241 TARGETS
= $(LIBRARY
) $(SHARED_LIBRARY
) $(PROGRAM
) $(SIMPLE_PROGRAMS
) $(HOST_LIBRARY
) $(HOST_PROGRAM
) $(HOST_SIMPLE_PROGRAMS
)
244 COBJS
= $(notdir $(CSRCS
:.c
=.
$(OBJ_SUFFIX
)))
245 SOBJS
= $(notdir $(SSRCS
:.S
=.
$(OBJ_SUFFIX
)))
246 # CPPSRCS can have different extensions (eg: .cpp, .cc)
247 CPPOBJS
= $(notdir $(addsuffix .
$(OBJ_SUFFIX
),$(basename $(CPPSRCS
))))
248 CMOBJS
= $(notdir $(CMSRCS
:.m
=.
$(OBJ_SUFFIX
)))
249 CMMOBJS
= $(notdir $(CMMSRCS
:.mm
=.
$(OBJ_SUFFIX
)))
250 ASOBJS
= $(notdir $(ASFILES
:.
$(ASM_SUFFIX
)=.
$(OBJ_SUFFIX
)))
252 _OBJS
= $(COBJS
) $(SOBJS
) $(CPPOBJS
) $(CMOBJS
) $(CMMOBJS
) $(ASOBJS
)
253 OBJS
= $(strip $(_OBJS
))
256 HOST_COBJS
= $(addprefix host_
,$(notdir $(HOST_CSRCS
:.c
=.
$(OBJ_SUFFIX
))))
257 # HOST_CPPOBJS can have different extensions (eg: .cpp, .cc)
258 HOST_CPPOBJS
= $(addprefix host_
,$(notdir $(addsuffix .
$(OBJ_SUFFIX
),$(basename $(HOST_CPPSRCS
)))))
259 HOST_CMOBJS
= $(addprefix host_
,$(notdir $(HOST_CMSRCS
:.m
=.
$(OBJ_SUFFIX
))))
260 HOST_CMMOBJS
= $(addprefix host_
,$(notdir $(HOST_CMMSRCS
:.mm
=.
$(OBJ_SUFFIX
))))
262 _HOST_OBJS
= $(HOST_COBJS
) $(HOST_CPPOBJS
) $(HOST_CMOBJS
) $(HOST_CMMOBJS
)
263 HOST_OBJS
= $(strip $(_HOST_OBJS
))
274 HOST_SIMPLE_PROGRAMS
:=
275 SDK_BINARY
:= $(filter %.py
,$(SDK_BINARY
))
280 $(GARBAGE
) $(TARGETS
) $(OBJS
) $(PROGOBJS
) LOGS TAGS a.out \
281 $(filter-out $(ASFILES
),$(OBJS
:.
$(OBJ_SUFFIX
)=.s
)) $(OBJS
:.
$(OBJ_SUFFIX
)=.ii
) \
282 $(OBJS
:.
$(OBJ_SUFFIX
)=.i
) $(OBJS
:.
$(OBJ_SUFFIX
)=.i_o
) \
283 $(HOST_PROGOBJS
) $(HOST_OBJS
) $(IMPORT_LIBRARY
) \
284 $(EXE_DEF_FILE
) so_locations _gen _stubs
$(wildcard *.res
) $(wildcard *.RES
) \
285 $(wildcard *.pdb
) $(CODFILE
) $(IMPORT_LIBRARY
) \
286 $(SHARED_LIBRARY
:$(DLL_SUFFIX
)=.exp
) $(wildcard *.ilk
) \
287 $(PROGRAM
:$(BIN_SUFFIX
)=.exp
) $(SIMPLE_PROGRAMS
:$(BIN_SUFFIX
)=.exp
) \
288 $(PROGRAM
:$(BIN_SUFFIX
)=.lib
) $(SIMPLE_PROGRAMS
:$(BIN_SUFFIX
)=.lib
) \
289 $(SIMPLE_PROGRAMS
:$(BIN_SUFFIX
)=.
$(OBJ_SUFFIX
)) \
290 $(wildcard gts_tmp_
*) $(LIBRARY
:%.a
=.
%.timestamp
)
292 $(GARBAGE_DIRS
) /no-such-file
295 GARBAGE
+= $(MOCSRCS
)
298 ifdef SIMPLE_PROGRAMS
299 GARBAGE
+= $(SIMPLE_PROGRAMS
:%=%.
$(OBJ_SUFFIX
))
302 ifdef HOST_SIMPLE_PROGRAMS
303 GARBAGE
+= $(HOST_SIMPLE_PROGRAMS
:%=%.
$(OBJ_SUFFIX
))
307 # the Solaris WorkShop template repository cache. it occasionally can get
308 # out of sync, so targets like clobber should kill it.
310 ifeq ($(SOLARIS_SUNPRO_CXX
),1)
311 GARBAGE_DIRS
+= SunWS_cache
314 ifdef MOZ_UPDATE_XTERM
315 # Its good not to have a newline at the end of the titlebar string because it
316 # makes the make -s output easier to read. Echo -n does not work on all
317 # platforms, but we can trick printf into doing it.
318 ifeq (.
,$(relativesrcdir
))
319 UPDATE_TITLE
= printf
'\033]0;%s in %s\007' $(1) $(2) ;
321 UPDATE_TITLE
= printf
'\033]0;%s in %s\007' $(1) $(relativesrcdir
)/$(2) ;
326 ifndef NO_BUILDSTATUS_MESSAGES
328 @echo
'BUILDSTATUS $1'
334 define SUBMAKE
# $(call SUBMAKE,target,directory,static)
336 +@
$(MAKE
) $(if
$(2),-C
$(2)) $(1)
338 endef # The extra line is important here! don't delete it
340 define TIER_DIR_SUBMAKE
341 $(call SUBMAKE
,$(4),$(3),$(5))
343 endef # Ths empty line is important.
345 ifneq (,$(strip $(DIRS
)))
347 $(foreach dir,$(DIRS
),$(call SUBMAKE
,$@
,$(dir)))
351 # Now we can differentiate between objects used to build a library, and
352 # objects used to build an executable in the same directory.
359 HOST_PROGOBJS
= $(HOST_OBJS
)
362 GARBAGE_DIRS
+= $(wildcard $(CURDIR
)/$(MDDEPDIR
))
365 # Tags: emacs (etags), vi (ctags)
366 # TAG_PROGRAM := ctags -L -
368 TAG_PROGRAM
= xargs etags
-a
371 # Turn on C++ linking if we have any .cpp or .mm files
372 # (moved this from config.mk so that config.mk can be included
373 # before the CPPSRCS are defined)
375 ifneq ($(HOST_CPPSRCS
)$(HOST_CMMSRCS
),)
376 HOST_CPP_PROG_LINK
= 1
380 # This will strip out symbols that the component should not be
381 # exporting from the .dynsym section.
384 EXTRA_DSO_LDOPTS
+= $(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
)
388 # MacOS X specific stuff
391 ifeq ($(OS_ARCH
),Darwin
)
394 EXTRA_DSO_LDOPTS
+= -bundle
396 EXTRA_DSO_LDOPTS
+= -dynamiclib
-install_name @executable_path
/$(SHARED_LIBRARY
) -compatibility_version
1 -current_version
1 -single_module
402 # On NetBSD a.out systems, use -Bsymbolic. This fixes what would otherwise be
403 # fatal symbol name clashes between components.
405 ifeq ($(OS_ARCH
),NetBSD
)
406 ifeq ($(DLL_SUFFIX
),.so
.1.0)
408 EXTRA_DSO_LDOPTS
+= -Wl
,-Bsymbolic
413 ifeq ($(OS_ARCH
),FreeBSD
)
415 EXTRA_DSO_LDOPTS
+= -Wl
,-Bsymbolic
419 ifeq ($(OS_ARCH
),NetBSD
)
420 ifneq (,$(filter arc cobalt hpcmips mipsco newsmips pmax sgimips
,$(OS_TEST
)))
421 ifneq (,$(filter layout
/%,$(relativesrcdir
)))
422 OS_CFLAGS
+= -Wa
,-xgot
423 OS_CXXFLAGS
+= -Wa
,-xgot
429 # HP-UXBeOS specific section: for COMPONENTS only, add -Bsymbolic flag
430 # which uses internal symbols first
432 ifeq ($(OS_ARCH
),HP-UX
)
434 ifeq ($(GNU_CC
)$(GNU_CXX
),)
435 EXTRA_DSO_LDOPTS
+= -Wl
,-Bsymbolic
436 ifneq ($(HAS_EXTRAEXPORTS
),1)
437 MKSHLIB
+= -Wl
,+eNSGetModule
-Wl
,+eerrno
438 MKCSHLIB
+= +eNSGetModule
+eerrno
439 ifneq ($(OS_TEST
),ia64
)
440 MKSHLIB
+= -Wl
,+e_shlInit
441 MKCSHLIB
+= +e_shlInit
443 endif # !HAS_EXTRAEXPORTS
444 endif # non-gnu compilers
448 ifeq ($(OS_ARCH
),AIX
)
450 ifneq ($(HAS_EXTRAEXPORTS
),1)
451 MKSHLIB
+= -bE
:$(MOZILLA_DIR
)/build
/unix
/aix.exp
-bnoexpall
452 MKCSHLIB
+= -bE
:$(MOZILLA_DIR
)/build
/unix
/aix.exp
-bnoexpall
453 endif # HAS_EXTRAEXPORTS
458 # Linux: add -Bsymbolic flag for components
460 ifeq ($(OS_ARCH
),Linux
)
462 EXTRA_DSO_LDOPTS
+= -Wl
,-Bsymbolic
464 ifdef LD_VERSION_SCRIPT
465 EXTRA_DSO_LDOPTS
+= -Wl
,--version-script
,$(LD_VERSION_SCRIPT
)
466 EXTRA_DEPS
+= $(LD_VERSION_SCRIPT
)
471 # GNU doesn't have path length limitation
474 ifeq ($(OS_ARCH
),GNU
)
475 OS_CPPFLAGS
+= -DPATH_MAX
=1024 -DMAXPATHLEN
=1024
478 ifeq ($(OS_ARCH
),WINNT
)
480 OS_LIBS
+= $(call EXPAND_LIBNAME
,delayimp
)
487 ifeq ($(OS_ARCH
),WINNT
)
490 DSO_LDOPTS
+= -Wl
,--out-implib
-Wl
,$(IMPORT_LIBRARY
)
503 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
505 PREPROCESS_OPTION
= -P
-Fi
# eol
508 PREPROCESS_OPTION
= -E
-o
#eol
509 endif # WINNT && !GNU_CC
511 ifneq (,$(filter ml
%,$(AS
)))
512 ASOUTOPTION
= -Fo
# eol
514 ASOUTOPTION
= -o
# eol
517 ifeq (,$(CROSS_COMPILE
))
518 HOST_OUTOPTION
= $(OUTOPTION
)
520 HOST_OUTOPTION
= -o
# eol
522 ################################################################################
524 # Ensure the build config is up to date. This is done automatically when builds
525 # are performed through |mach build|. The check here is to catch people not
526 # using mach. If we ever enforce builds through mach, this code can be removed.
527 ifndef MOZBUILD_BACKEND_CHECKED
529 ifndef TOPLEVEL_BUILD
530 $(DEPTH
)/backend.RecursiveMakeBackend
:
531 $(error Build configuration changed. Build with |mach build| or run |mach build-backend| to regenerate build config
)
533 include $(DEPTH
)/backend.RecursiveMakeBackend.pp
535 default
:: $(DEPTH
)/backend.RecursiveMakeBackend
537 export MOZBUILD_BACKEND_CHECKED
=1
542 # The root makefile doesn't want to do a plain export/libs, because
543 # of the tiers and because of libxul. Suppress the default rules in favor
544 # of something else. Makefiles which use this var *must* provide a sensible
545 # default rule before including rules.mk
548 ifdef COMPILE_ENVIRONMENT
554 ifeq ($(findstring s
,$(filter-out --%, $(MAKEFLAGS
))),)
562 # Do everything from scratch
567 STATIC_LIB_DEP
= $(if
$(wildcard $(1).
$(LIBS_DESC_SUFFIX
)),$(1).
$(LIBS_DESC_SUFFIX
),$(1))
568 STATIC_LIBS_DEPS
:= $(foreach l
,$(STATIC_LIBS
),$(call STATIC_LIB_DEP
,$(l
)))
570 # Dependencies which, if modified, should cause everything to rebuild
571 GLOBAL_DEPS
+= Makefile
$(DEPTH
)/config
/autoconf.mk
$(topsrcdir
)/config
/config.mk
573 ##############################################
574 ifdef COMPILE_ENVIRONMENT
575 OBJ_TARGETS
= $(OBJS
) $(PROGOBJS
) $(HOST_OBJS
) $(HOST_PROGOBJS
)
577 compile
:: host target
579 host
:: $(HOST_LIBRARY
) $(HOST_PROGRAM
) $(HOST_SIMPLE_PROGRAMS
)
581 target
:: $(LIBRARY
) $(SHARED_LIBRARY
) $(PROGRAM
) $(SIMPLE_PROGRAMS
)
583 include $(topsrcdir
)/config
/makefiles
/target_binaries.mk
586 ##############################################
587 ifneq (1,$(NO_PROFILE_GUIDED_OPTIMIZE
))
588 ifdef MOZ_PROFILE_USE
589 ifeq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
590 # When building with PGO, we have to make sure to re-link
591 # in the MOZ_PROFILE_USE phase if we linked in the
592 # MOZ_PROFILE_GENERATE phase. We'll touch this pgo.relink
593 # file in the link rule in the GENERATE phase to indicate
594 # that we need a relink.
596 $(SHARED_LIBRARY
): pgo.relink
599 $(PROGRAM
): pgo.relink
602 # In the second pass, we need to merge the pgc files into the pgd file.
603 # The compiler would do this for us automatically if they were in the right
604 # place, but they're in dist/bin.
605 ifneq (,$(SHARED_LIBRARY
)$(PROGRAM
))
608 $(PYTHON
) $(topsrcdir
)/build
/win32
/pgomerge.py \
609 $(PROGRAM
:$(BIN_SUFFIX
)=) $(DIST
)/bin
612 $(PYTHON
) $(topsrcdir
)/build
/win32
/pgomerge.py \
613 $(patsubst $(DLL_PREFIX
)%$(DLL_SUFFIX
),%,$(SHARED_LIBRARY
)) $(DIST
)/bin
615 endif # SHARED_LIBRARY || PROGRAM
617 endif # MOZ_PROFILE_USE
618 ifdef MOZ_PROFILE_GENERATE
619 # Clean up profiling data during PROFILE_GENERATE phase
621 ifeq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
622 $(foreach pgd
,$(wildcard *.pgd
),pgomgr
-clear
$(pgd
);)
630 ifneq (,$(MOZ_PROFILE_GENERATE
)$(MOZ_PROFILE_USE
))
632 # Force rebuilding libraries and programs in both passes because each
633 # pass uses different object files.
634 $(PROGRAM
) $(SHARED_LIBRARY
) $(LIBRARY
): FORCE
638 endif # NO_PROFILE_GUIDED_OPTIMIZE
640 ##############################################
643 $(MAKE
) -C
$(topsrcdir
) -f client.mk checkout
645 clean clobber realclean clobber_all
::
647 -$(RM
) -r
$(ALL_TRASH_DIRS
)
650 clean clobber realclean clobber_all
distclean::
652 $(foreach tier
, $(TIERS
), $(tier_
$(tier
)_dirs
)), \
653 -$(call SUBMAKE
,$@
,$(dir)))
655 clean clobber realclean clobber_all
distclean::
656 $(foreach dir,$(DIRS
),-$(call SUBMAKE
,$@
,$(dir)))
660 -$(RM
) -r
$(ALL_TRASH_DIRS
)
661 -$(RM
) $(ALL_TRASH
) \
662 Makefile .HSancillary \
663 $(wildcard *.
$(OBJ_SUFFIX
)) $(wildcard *.ho
) $(wildcard host_
*.o
*) \
664 $(wildcard *.
$(LIB_SUFFIX
)) $(wildcard *$(DLL_SUFFIX
)) \
665 $(wildcard *.
$(IMPORT_LIB_SUFFIX
))
669 find
$(topsrcdir
) -name
dist -prune
-o \
( -name
'*.[hc]' -o
-name
'*.cp' -o
-name
'*.cpp' -o
-name
'*.idl' \
) -print |
$(TAG_PROGRAM
)
673 # creates OBJS, links with LIBS to create Foo
675 $(PROGRAM
): $(PROGOBJS
) $(STATIC_LIBS_DEPS
) $(EXTRA_DEPS
) $(EXE_DEF_FILE
) $(RESFILE
) $(GLOBAL_DEPS
)
678 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
679 $(EXPAND_LD
) -NOLOGO
-OUT
:$@
-PDB
:$(LINK_PDBFILE
) $(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(MOZ_GLUE_PROGRAM_LDFLAGS
) $(PROGOBJS
) $(RESFILE
) $(STATIC_LIBS
) $(SHARED_LIBS
) $(EXTRA_LIBS
) $(OS_LIBS
)
680 ifdef MSMANIFEST_TOOL
681 @if
test -f
$@.manifest
; then \
682 if
test -f
'$(srcdir)/$@.manifest'; then \
683 echo
'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
684 mt.exe
-NOLOGO
-MANIFEST
'$(win_srcdir)/$@.manifest' $@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
686 echo
'Embedding manifest from $@.manifest'; \
687 mt.exe
-NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
689 elif
test -f
'$(srcdir)/$@.manifest'; then \
690 echo
'Embedding manifest from $(srcdir)/$@.manifest'; \
691 mt.exe
-NOLOGO
-MANIFEST
'$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE
:$@\
;1; \
693 endif # MSVC with manifest tool
694 ifdef MOZ_PROFILE_GENERATE
695 # touch it a few seconds into the future to work around FAT's
696 # 2-second granularity
697 touch
-t
`date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
699 else # !WINNT || GNU_CC
700 $(EXPAND_CCC
) -o
$@
$(CXXFLAGS
) $(PROGOBJS
) $(RESFILE
) $(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(WRAP_LDFLAGS
) $(STATIC_LIBS
) $(MOZ_GLUE_PROGRAM_LDFLAGS
) $(SHARED_LIBS
) $(EXTRA_LIBS
) $(OS_LIBS
) $(BIN_FLAGS
) $(EXE_DEF_FILE
) $(STLPORT_LIBS
)
701 $(call CHECK_BINARY
,$@
)
702 endif # WINNT && !GNU_CC
705 $(STRIP
) $(STRIP_FLAGS
) $@
707 ifdef MOZ_POST_PROGRAM_COMMAND
708 $(MOZ_POST_PROGRAM_COMMAND
) $@
711 $(HOST_PROGRAM
): $(HOST_PROGOBJS
) $(HOST_LIBS
) $(HOST_EXTRA_DEPS
) $(GLOBAL_DEPS
)
713 ifeq (_WINNT
,$(GNU_CC
)_
$(HOST_OS_ARCH
))
714 $(EXPAND_LIBS_EXEC
) -- $(HOST_LD
) -NOLOGO
-OUT
:$@
-PDB
:$(HOST_PDBFILE
) $(HOST_OBJS
) $(WIN32_EXE_LDFLAGS
) $(HOST_LDFLAGS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
715 ifdef MSMANIFEST_TOOL
716 @if
test -f
$@.manifest
; then \
717 if
test -f
'$(srcdir)/$@.manifest'; then \
718 echo
'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
719 mt.exe
-NOLOGO
-MANIFEST
'$(win_srcdir)/$@.manifest' $@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
721 echo
'Embedding manifest from $@.manifest'; \
722 mt.exe
-NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
724 elif
test -f
'$(srcdir)/$@.manifest'; then \
725 echo
'Embedding manifest from $(srcdir)/$@.manifest'; \
726 mt.exe
-NOLOGO
-MANIFEST
'$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE
:$@\
;1; \
728 endif # MSVC with manifest tool
730 ifeq ($(HOST_CPP_PROG_LINK
),1)
731 $(EXPAND_LIBS_EXEC
) -- $(HOST_CXX
) -o
$@
$(HOST_CXXFLAGS
) $(HOST_LDFLAGS
) $(HOST_PROGOBJS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
733 $(EXPAND_LIBS_EXEC
) -- $(HOST_CC
) -o
$@
$(HOST_CFLAGS
) $(HOST_LDFLAGS
) $(HOST_PROGOBJS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
734 endif # HOST_CPP_PROG_LINK
738 # This is an attempt to support generation of multiple binaries
739 # in one directory, it assumes everything to compile Foo is in
740 # Foo.o (from either Foo.c or Foo.cpp).
742 # SIMPLE_PROGRAMS = Foo Bar
743 # creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
745 $(SIMPLE_PROGRAMS
): %$(BIN_SUFFIX
): %.
$(OBJ_SUFFIX
) $(STATIC_LIBS_DEPS
) $(EXTRA_DEPS
) $(GLOBAL_DEPS
)
747 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
748 $(EXPAND_LD
) -nologo
-out
:$@
-pdb
:$(LINK_PDBFILE
) $< $(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(MOZ_GLUE_PROGRAM_LDFLAGS
) $(STATIC_LIBS
) $(SHARED_LIBS
) $(EXTRA_LIBS
) $(OS_LIBS
)
749 ifdef MSMANIFEST_TOOL
750 @if
test -f
$@.manifest
; then \
751 mt.exe
-NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
754 endif # MSVC with manifest tool
756 $(EXPAND_CCC
) $(CXXFLAGS
) -o
$@
$< $(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(WRAP_LDFLAGS
) $(STATIC_LIBS
) $(MOZ_GLUE_PROGRAM_LDFLAGS
) $(SHARED_LIBS
) $(EXTRA_LIBS
) $(OS_LIBS
) $(BIN_FLAGS
) $(STLPORT_LIBS
)
757 $(call CHECK_BINARY
,$@
)
758 endif # WINNT && !GNU_CC
761 $(STRIP
) $(STRIP_FLAGS
) $@
763 ifdef MOZ_POST_PROGRAM_COMMAND
764 $(MOZ_POST_PROGRAM_COMMAND
) $@
767 $(HOST_SIMPLE_PROGRAMS
): host_
%$(HOST_BIN_SUFFIX
): host_
%.
$(OBJ_SUFFIX
) $(HOST_LIBS
) $(HOST_EXTRA_DEPS
) $(GLOBAL_DEPS
)
769 ifeq (WINNT_
,$(HOST_OS_ARCH
)_
$(GNU_CC
))
770 $(EXPAND_LIBS_EXEC
) -- $(HOST_LD
) -NOLOGO
-OUT
:$@
-PDB
:$(HOST_PDBFILE
) $< $(WIN32_EXE_LDFLAGS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
772 ifneq (,$(HOST_CPPSRCS
)$(USE_HOST_CXX
))
773 $(EXPAND_LIBS_EXEC
) -- $(HOST_CXX
) $(HOST_OUTOPTION
)$@
$(HOST_CXXFLAGS
) $(INCLUDES
) $< $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
775 $(EXPAND_LIBS_EXEC
) -- $(HOST_CC
) $(HOST_OUTOPTION
)$@
$(HOST_CFLAGS
) $(INCLUDES
) $< $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
779 ifdef DTRACE_PROBE_OBJ
780 EXTRA_DEPS
+= $(DTRACE_PROBE_OBJ
)
781 OBJS
+= $(DTRACE_PROBE_OBJ
)
784 $(filter %.
$(LIB_SUFFIX
),$(LIBRARY
)): $(OBJS
) $(STATIC_LIBS_DEPS
) $(filter %.
$(LIB_SUFFIX
),$(EXTRA_LIBS
)) $(EXTRA_DEPS
) $(GLOBAL_DEPS
)
787 $(EXPAND_AR
) $(AR_FLAGS
) $(OBJS
) $(STATIC_LIBS
) $(filter %.
$(LIB_SUFFIX
),$(EXTRA_LIBS
))
789 $(filter-out %.
$(LIB_SUFFIX
),$(LIBRARY
)): $(filter %.
$(LIB_SUFFIX
),$(LIBRARY
)) $(OBJS
) $(STATIC_LIBS_DEPS
) $(filter %.
$(LIB_SUFFIX
),$(EXTRA_LIBS
)) $(EXTRA_DEPS
) $(GLOBAL_DEPS
)
790 # When we only build a library descriptor, blow out any existing library
792 $(if
$(filter %.
$(LIB_SUFFIX
),$(LIBRARY
)),,$(RM
) $(REAL_LIBRARY
))
793 $(EXPAND_LIBS_GEN
) -o
$@
$(OBJS
) $(STATIC_LIBS
) $(filter %.
$(LIB_SUFFIX
),$(EXTRA_LIBS
))
795 ifeq ($(OS_ARCH
),WINNT
)
796 # Import libraries are created by the rules creating shared libraries.
797 # The rules to copy them to $(DIST)/lib depend on $(IMPORT_LIBRARY),
798 # but make will happily consider the import library before it is refreshed
799 # when rebuilding the corresponding shared library. Defining an empty recipe
800 # for import libraries forces make to wait for the shared library recipe to
801 # have run before considering other targets that depend on the import library.
803 $(IMPORT_LIBRARY
): $(SHARED_LIBRARY
) ;
806 $(HOST_LIBRARY
): $(HOST_OBJS
) Makefile
809 $(EXPAND_LIBS_EXEC
) --extract
-- $(HOST_AR
) $(HOST_AR_FLAGS
) $(HOST_OBJS
)
813 ifdef DTRACE_PROBE_OBJ
814 ifndef DTRACE_LIB_DEPENDENT
815 NON_DTRACE_OBJS
:= $(filter-out $(DTRACE_PROBE_OBJ
),$(OBJS
))
816 $(DTRACE_PROBE_OBJ
): $(NON_DTRACE_OBJS
)
817 dtrace
-G
-C
-s
$(MOZILLA_DTRACE_SRC
) -o
$(DTRACE_PROBE_OBJ
) $(NON_DTRACE_OBJS
)
823 # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
824 # so instead of deleting .o files after repacking them into a dylib, we make
825 # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
826 # so no need to conditionalize on OS version or debugging format.
828 $(SHARED_LIBRARY
): $(OBJS
) $(RESFILE
) $(STATIC_LIBS_DEPS
) $(EXTRA_DEPS
) $(GLOBAL_DEPS
)
830 ifndef INCREMENTAL_LINKER
833 ifdef DTRACE_LIB_DEPENDENT
835 dtrace
-G
-C
-s
$(MOZILLA_DTRACE_SRC
) -o
$(DTRACE_PROBE_OBJ
) $(shell $(EXPAND_LIBS
) $(MOZILLA_PROBE_LIBS
))
837 $(EXPAND_MKSHLIB
) $(SHLIB_LDSTARTFILE
) $(OBJS
) $(SUB_SHLOBJS
) $(DTRACE_PROBE_OBJ
) $(MOZILLA_PROBE_LIBS
) $(RESFILE
) $(LDFLAGS
) $(WRAP_LDFLAGS
) $(STATIC_LIBS
) $(SHARED_LIBS
) $(EXTRA_DSO_LDOPTS
) $(MOZ_GLUE_LDFLAGS
) $(EXTRA_LIBS
) $(OS_LIBS
) $(SHLIB_LDENDFILE
) $(if
$(LIB_IS_C_ONLY
),,$(STLPORT_LIBS
))
838 @
$(RM
) $(DTRACE_PROBE_OBJ
)
839 else # ! DTRACE_LIB_DEPENDENT
840 $(EXPAND_MKSHLIB
) $(SHLIB_LDSTARTFILE
) $(OBJS
) $(SUB_SHLOBJS
) $(RESFILE
) $(LDFLAGS
) $(WRAP_LDFLAGS
) $(STATIC_LIBS
) $(SHARED_LIBS
) $(EXTRA_DSO_LDOPTS
) $(MOZ_GLUE_LDFLAGS
) $(EXTRA_LIBS
) $(OS_LIBS
) $(SHLIB_LDENDFILE
) $(if
$(LIB_IS_C_ONLY
),,$(STLPORT_LIBS
))
841 endif # DTRACE_LIB_DEPENDENT
842 $(call CHECK_BINARY
,$@
)
844 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
845 ifdef MSMANIFEST_TOOL
846 ifdef EMBED_MANIFEST_AT
847 @if
test -f
$@.manifest
; then \
848 mt.exe
-NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;$(EMBED_MANIFEST_AT
); \
851 endif # EMBED_MANIFEST_AT
852 endif # MSVC with manifest tool
853 ifdef MOZ_PROFILE_GENERATE
854 touch
-t
`date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
856 endif # WINNT && !GCC
857 @
$(RM
) foodummyfilefoo
$(DELETE_AFTER_LINK
)
860 $(STRIP
) $(STRIP_FLAGS
) $@
862 ifdef MOZ_POST_DSO_LIB_COMMAND
863 $(MOZ_POST_DSO_LIB_COMMAND
) $@
866 ifeq ($(SOLARIS_SUNPRO_CC
),1)
867 _MDDEPFILE
= $(MDDEPDIR
)/$(@F
).pp
869 define MAKE_DEPS_AUTO_CC
870 if
test -d
$(@D
); then \
871 echo
'Building deps for $< using Sun Studio cc'; \
872 $(CC
) $(COMPILE_CFLAGS
) -xM
$< >$(_MDDEPFILE
) ; \
873 $(PYTHON
) $(topsrcdir
)/build
/unix
/add_phony_targets.py
$(_MDDEPFILE
) ; \
876 define MAKE_DEPS_AUTO_CXX
877 if
test -d
$(@D
); then \
878 echo
'Building deps for $< using Sun Studio CC'; \
879 $(CXX
) $(COMPILE_CXXFLAGS
) -xM
$< >$(_MDDEPFILE
) ; \
880 $(PYTHON
) $(topsrcdir
)/build
/unix
/add_phony_targets.py
$(_MDDEPFILE
) ; \
883 endif # Sun Studio on Solaris
885 # The object file is in the current directory, and the source file can be any
886 # relative path. This macro adds the dependency obj: src for each source file.
887 # This dependency must be first for the $< flag to work correctly, and the
888 # rules that have commands for these targets must not list any other
889 # prerequisites, or they will override the $< variable.
891 $(basename $2$(notdir $1)).
$(OBJ_SUFFIX
): $1 $$(call mkdir_deps
,$$(MDDEPDIR
))
893 $(foreach f
,$(CSRCS
) $(SSRCS
) $(CPPSRCS
) $(CMSRCS
) $(CMMSRCS
) $(ASFILES
),$(eval
$(call src_objdep
,$(f
))))
894 $(foreach f
,$(HOST_CSRCS
) $(HOST_CPPSRCS
) $(HOST_CMSRCS
) $(HOST_CMMSRCS
),$(eval
$(call src_objdep
,$(f
),host_
)))
896 $(OBJS
) $(HOST_OBJS
) $(PROGOBJS
) $(HOST_PROGOBJS
): $(GLOBAL_DEPS
)
898 # Rules for building native targets must come first because of the host_ prefix
901 $(ELOG
) $(HOST_CC
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CFLAGS
) $(INCLUDES
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
905 $(ELOG
) $(HOST_CXX
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CXXFLAGS
) $(INCLUDES
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
909 $(ELOG
) $(HOST_CC
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CFLAGS
) $(HOST_CMFLAGS
) $(INCLUDES
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
913 $(ELOG
) $(HOST_CXX
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CXXFLAGS
) $(HOST_CMMFLAGS
) $(INCLUDES
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
917 @
$(MAKE_DEPS_AUTO_CC
)
918 $(ELOG
) $(CC
) $(OUTOPTION
)$@
-c
$(COMPILE_CFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
920 # DEFINES and ACDEFINES are needed here to enable conditional compilation of Q_OBJECTs:
921 # 'moc' only knows about #defines it gets on the command line (-D...), not in
922 # included headers like mozilla-config.h
923 $(filter moc_
%.
cpp,$(CPPSRCS
)): moc_
%.
cpp: %.h
925 $(ELOG
) $(MOC
) $(DEFINES
) $(ACDEFINES
) $< $(OUTOPTION
)$@
927 $(filter moc_
%.
cc,$(CPPSRCS
)): moc_
%.
cc: %.
cc
929 $(ELOG
) $(MOC
) $(DEFINES
) $(ACDEFINES
) $(_VPATH_SRCS
:.
cc=.h
) $(OUTOPTION
)$@
931 $(filter qrc_
%.
cpp,$(CPPSRCS
)): qrc_
%.
cpp: %.qrc
933 $(ELOG
) $(RCC
) -name
$* $< $(OUTOPTION
)$@
936 # The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
940 $(AS
) $(ASOUTOPTION
)$@
$(ASFLAGS
) $($(notdir $<)_FLAGS
) $(AS_DASH_C_FLAG
) $(_VPATH_SRCS
)
945 $(AS
) -o
$@
$(ASFLAGS
) $($(notdir $<)_FLAGS
) $(LOCAL_INCLUDES
) $(TARGET_LOCAL_INCLUDES
) -c
$<
949 @
$(MAKE_DEPS_AUTO_CXX
)
950 $(ELOG
) $(CCC
) $(OUTOPTION
)$@
-c
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
954 @
$(MAKE_DEPS_AUTO_CXX
)
955 $(ELOG
) $(CCC
) -o
$@
-c
$(COMPILE_CXXFLAGS
) $(COMPILE_CMMFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
959 @
$(MAKE_DEPS_AUTO_CC
)
960 $(ELOG
) $(CC
) -o
$@
-c
$(COMPILE_CFLAGS
) $(COMPILE_CMFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
962 $(filter %.s
,$(CPPSRCS
:%.
cpp=%.s
)): %.s
: %.
cpp $(call mkdir_deps
,$(MDDEPDIR
))
964 $(CCC
) -S
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
966 $(filter %.s
,$(CPPSRCS
:%.
cc=%.s
)): %.s
: %.
cc $(call mkdir_deps
,$(MDDEPDIR
))
968 $(CCC
) -S
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
970 $(filter %.s
,$(CPPSRCS
:%.
cxx=%.s
)): %.s
: %.
cpp $(call mkdir_deps
,$(MDDEPDIR
))
972 $(CCC
) -S
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
974 $(filter %.s
,$(CSRCS
:%.c
=%.s
)): %.s
: %.c
$(call mkdir_deps
,$(MDDEPDIR
))
976 $(CC
) -S
$(COMPILE_CFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
978 ifneq (,$(filter %.i
,$(MAKECMDGOALS
)))
979 # Call as $(call _group_srcs,extension,$(SRCS)) - this will create a list
980 # of the full sources, as well as the $(notdir) version. So:
981 # foo.cpp sub/bar.cpp
983 # foo.cpp sub/bar.cpp bar.cpp
985 # This way we can match both 'make sub/bar.i' and 'make bar.i'
986 _group_srcs
= $(sort $(patsubst %.
$1,%.i
,$(filter %.
$1,$2 $(notdir $2))))
987 _PREPROCESSED_CPP_FILES
:= $(call _group_srcs
,cpp,$(CPPSRCS
))
988 _PREPROCESSED_CC_FILES
:= $(call _group_srcs
,cc,$(CPPSRCS
))
989 _PREPROCESSED_CXX_FILES
:= $(call _group_srcs
,cxx,$(CPPSRCS
))
990 _PREPROCESSED_C_FILES
:= $(call _group_srcs
,c
,$(CSRCS
))
991 _PREPROCESSED_CMM_FILES
:= $(call _group_srcs
,mm
,$(CMMSRCS
))
993 # Hack up VPATH so we can reach the sources. Eg: 'make Parser.i' may need to
994 # reach $(srcdir)/frontend/Parser.i
995 VPATH
+= $(addprefix $(srcdir)/,$(sort $(dir $(CPPSRCS
) $(CSRCS
) $(CMMSRCS
))))
997 # Make preprocessed files PHONY so they are always executed, since they are
998 # manual targets and we don't necessarily write to $@.
999 .PHONY
: $(_PREPROCESSED_CPP_FILES
) $(_PREPROCESSED_CC_FILES
) $(_PREPROCESSED_CXX_FILES
) $(_PREPROCESSED_C_FILES
) $(_PREPROCESSED_CMM_FILES
)
1001 $(_PREPROCESSED_CPP_FILES
): %.i
: %.
cpp $(call mkdir_deps
,$(MDDEPDIR
))
1003 $(addprefix $(MKDIR
) -p
,$(filter-out .
,$(@D
)))
1004 $(CCC
) -C
$(PREPROCESS_OPTION
)$@
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
1006 $(_PREPROCESSED_CC_FILES
): %.i
: %.
cc $(call mkdir_deps
,$(MDDEPDIR
))
1008 $(addprefix $(MKDIR
) -p
,$(filter-out .
,$(@D
)))
1009 $(CCC
) -C
$(PREPROCESS_OPTION
)$@
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
1011 $(_PREPROCESSED_CXX_FILES
): %.i
: %.
cxx $(call mkdir_deps
,$(MDDEPDIR
))
1013 $(addprefix $(MKDIR
) -p
,$(filter-out .
,$(@D
)))
1014 $(CCC
) -C
$(PREPROCESS_OPTION
)$@
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
1016 $(_PREPROCESSED_C_FILES
): %.i
: %.c
$(call mkdir_deps
,$(MDDEPDIR
))
1018 $(addprefix $(MKDIR
) -p
,$(filter-out .
,$(@D
)))
1019 $(CC
) -C
$(PREPROCESS_OPTION
)$@
$(COMPILE_CFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
1021 $(_PREPROCESSED_CMM_FILES
): %.i
: %.mm
$(call mkdir_deps
,$(MDDEPDIR
))
1023 $(addprefix $(MKDIR
) -p
,$(filter-out .
,$(@D
)))
1024 $(CCC
) -C
$(PREPROCESS_OPTION
)$@
$(COMPILE_CXXFLAGS
) $(COMPILE_CMMFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
1026 # Default to pre-processing the actual unified file. This can be overridden
1027 # at the command-line to pre-process only the individual source file.
1030 # PP_REINVOKE gets set on the sub-make to prevent us from going in an
1031 # infinite loop if the filename doesn't exist in the unified source files.
1034 MATCH_cpp
= \
(cpp\|
cc|
cxx\
)
1039 # When building with PP_UNIFIED=0, we also have to look in the Unified files to
1040 # find a matching pathname.
1041 _get_all_sources
= $1 $(if
$(filter Unified
%,$1),$(shell sed
-n
's/\#include "\(.*\)"$$/\1/p' $(filter Unified
%,$1)))
1042 all_cpp_sources
:= $(call _get_all_sources
,$(CPPSRCS
))
1043 all_mm_sources
:= $(call _get_all_sources
,$(CMMSRCS
))
1044 all_c_sources
:= $(call _get_all_sources
,$(CSRCS
))
1045 all_sources
:= $(all_cpp_sources
) $(all_cmm_sources
) $(all_c_sources
)
1047 # The catch-all %.i rule runs when we pass in a .i filename that doesn't match
1048 # one of the *SRCS variables. The two code paths depend on whether or not
1049 # we are requesting a unified file (PP_UNIFIED=1, the default) or not:
1052 # - Look for it in any of the Unified files, and re-exec make with
1053 # Unified_foo0.i as the target. This gets us the full unified preprocessed
1057 # - If the .i filename is in *SRCS, or in a Unified filename, then we re-exec
1058 # make with that filename as the target. The *SRCS variables are modified
1059 # to have the Unified sources appended to them so that the static pattern
1062 ifeq ($(PP_UNIFIED
),1)
1063 @
$(MAKE
) PP_REINVOKE
=1 \
1064 $(or
$(addsuffix .i
, \
1065 $(foreach type
,c
cpp mm
, \
1066 $(if
$(filter Unified
%,$($(UPPER_
$(type
))SRCS
)), \
1067 $(shell grep
-l
'#include "\(.*/\)\?$(basename $@).$(or $(MATCH_$(type)),$(type))"' Unified
*.
$(type
) | sed
's/\.$(type)$$//') \
1068 ))),$(error
"File not found for preprocessing: $@"))
1070 @
$(MAKE
) PP_REINVOKE
=1 $@ \
1071 $(foreach type
,c
cpp mm
,$(UPPER_
$(type
))SRCS
="$(all_$(type)_sources)")
1078 $(RESFILE
): %.res
: %.rc
1080 @echo Creating Resource file
: $@
1082 $(RC
) $(RCFLAGS
) $(filter-out -U
%,$(DEFINES
)) $(INCLUDES
:-I
%=--include-dir
%) $(OUTOPTION
)$@
$(_VPATH_SRCS
)
1084 $(RC
) $(RCFLAGS
) -r
$(DEFINES
) $(INCLUDES
) $(OUTOPTION
)$@
$(_VPATH_SRCS
)
1087 # Cancel GNU make built-in implicit rules
1090 ifneq (,$(filter WINNT
,$(OS_ARCH
)))
1097 SPACE
:= $(EMPTY
) $(EMPTY
)
1099 # MSYS has its own special path form, but javac expects the source and class
1100 # paths to be in the DOS form (i.e. e:/builds/...). This function does the
1101 # appropriate conversion on Windows, but is a noop on other systems.
1102 ifeq ($(HOST_OS_ARCH
),WINNT
)
1103 # We use 'pwd -W' to get DOS form of the path. However, since the given path
1104 # could be a file or a non-existent path, we cannot call 'pwd -W' directly
1105 # on the path. Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
1106 # on it, then merge with the rest of the path.
1107 root-path
= $(shell echo
$(1) | sed
-e
's|\(/[^/]*\)/\?\(.*\)|\1|')
1108 non-root-path
= $(shell echo
$(1) | sed
-e
's|\(/[^/]*\)/\?\(.*\)|\2|')
1109 normalizepath
= $(foreach p
,$(1),$(if
$(filter /%,$(1)),$(patsubst %/,%,$(shell cd
$(call root-path
,$(1)) && pwd
-W
))/$(call non-root-path
,$(1)),$(1)))
1111 normalizepath
= $(1)
1114 ###############################################################################
1116 ###############################################################################
1117 ifneq (,$(JAVAFILES
)$(ANDROID_RESFILES
)$(ANDROID_APKNAME
)$(JAVA_JAR_TARGETS
))
1118 include $(topsrcdir
)/config
/makefiles
/java-build.mk
1121 ###############################################################################
1122 # Bunch of things that extend the 'export' rule (in order):
1123 ###############################################################################
1125 ifneq ($(XPI_NAME
),)
1129 export:: $(FINAL_TARGET
)
1132 ################################################################################
1133 # Copy each element of PREF_JS_EXPORTS
1135 # The default location for PREF_JS_EXPORTS is the gre prefs directory.
1136 PREF_DIR
= defaults
/pref
1138 # If DIST_SUBDIR is defined it indicates that app and gre dirs are
1139 # different and that we are building app related resources. Hence,
1140 # PREF_DIR should point to the app prefs location.
1141 ifneq (,$(DIST_SUBDIR
)$(XPI_NAME
)$(LIBXUL_SDK
))
1142 PREF_DIR
= defaults
/preferences
1145 # on win32, pref files need CRLF line endings... see bug 206029
1146 ifeq (WINNT
,$(OS_ARCH
))
1147 PREF_PPFLAGS
+= --line-endings
=crlf
1150 ifneq ($(PREF_JS_EXPORTS
),)
1151 ifndef NO_DIST_INSTALL
1152 PREF_JS_EXPORTS_PATH
:= $(FINAL_TARGET
)/$(PREF_DIR
)
1153 PREF_JS_EXPORTS_FLAGS
:= $(PREF_PPFLAGS
)
1154 PP_TARGETS
+= PREF_JS_EXPORTS
1158 ################################################################################
1159 # Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
1161 ifneq ($(AUTOCFG_JS_EXPORTS
),)
1162 ifndef NO_DIST_INSTALL
1163 AUTOCFG_JS_EXPORTS_FILES
:= $(AUTOCFG_JS_EXPORTS
)
1164 AUTOCFG_JS_EXPORTS_DEST
:= $(FINAL_TARGET
)/defaults
/autoconfig
1165 AUTOCFG_JS_EXPORTS_TARGET
:= export
1166 INSTALL_TARGETS
+= AUTOCFG_JS_EXPORTS
1170 ################################################################################
1171 # Install a linked .xpt into the appropriate place.
1172 # This should ideally be performed by the non-recursive idl make file. Some day.
1175 ifndef NO_DIST_INSTALL
1176 _XPT_NAME_FILES
:= $(DEPTH
)/config
/makefiles
/xpidl
/xpt
/$(XPT_NAME
)
1177 _XPT_NAME_DEST
:= $(FINAL_TARGET
)/components
1178 INSTALL_TARGETS
+= _XPT_NAME
1180 ifndef NO_INTERFACES_MANIFEST
1181 libs
:: $(call mkdir_deps
,$(FINAL_TARGET
)/components
)
1182 $(call py_action
,buildlist
,$(FINAL_TARGET
)/components
/interfaces.manifest
'interfaces $(XPT_NAME)')
1183 $(call py_action
,buildlist
,$(FINAL_TARGET
)/chrome.manifest
'manifest components/interfaces.manifest')
1189 ################################################################################
1190 # Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
1191 ifneq (,$(filter %.js
,$(EXTRA_COMPONENTS
) $(EXTRA_PP_COMPONENTS
)))
1192 ifeq (,$(filter %.manifest
,$(EXTRA_COMPONENTS
) $(EXTRA_PP_COMPONENTS
)))
1193 ifndef NO_JS_MANIFEST
1194 $(error .js component without matching .manifest. See https
://developer.mozilla.org
/en
/XPCOM
/XPCOM_changes_in_Gecko_2.0
)
1199 ifdef EXTRA_COMPONENTS
1200 libs
:: $(EXTRA_COMPONENTS
)
1201 ifndef NO_DIST_INSTALL
1202 EXTRA_COMPONENTS_FILES
:= $(EXTRA_COMPONENTS
)
1203 EXTRA_COMPONENTS_DEST
:= $(FINAL_TARGET
)/components
1204 INSTALL_TARGETS
+= EXTRA_COMPONENTS
1209 ifdef EXTRA_PP_COMPONENTS
1210 ifndef NO_DIST_INSTALL
1211 EXTRA_PP_COMPONENTS_PATH
:= $(FINAL_TARGET
)/components
1212 PP_TARGETS
+= EXTRA_PP_COMPONENTS
1216 EXTRA_MANIFESTS
= $(filter %.manifest
,$(EXTRA_COMPONENTS
) $(EXTRA_PP_COMPONENTS
))
1217 ifneq (,$(EXTRA_MANIFESTS
))
1218 libs
:: $(call mkdir_deps
,$(FINAL_TARGET
))
1219 $(call py_action
,buildlist
,$(FINAL_TARGET
)/chrome.manifest
$(patsubst %,'manifest components/%',$(notdir $(EXTRA_MANIFESTS
))))
1222 ################################################################################
1223 # Copy each element of EXTRA_JS_MODULES to
1224 # $(FINAL_TARGET)/modules.
1225 FINAL_JS_MODULES_PATH
:= $(FINAL_TARGET
)/modules
1227 ifdef EXTRA_JS_MODULES
1228 ifndef NO_DIST_INSTALL
1229 EXTRA_JS_MODULES_FILES
:= $(EXTRA_JS_MODULES
)
1230 EXTRA_JS_MODULES_DEST
:= $(FINAL_JS_MODULES_PATH
)
1231 INSTALL_TARGETS
+= EXTRA_JS_MODULES
1235 ifdef EXTRA_PP_JS_MODULES
1236 ifndef NO_DIST_INSTALL
1237 EXTRA_PP_JS_MODULES_PATH
:= $(FINAL_JS_MODULES_PATH
)
1238 PP_TARGETS
+= EXTRA_PP_JS_MODULES
1242 ################################################################################
1245 ifneq (,$(SDK_LIBRARY
))
1246 ifndef NO_DIST_INSTALL
1247 SDK_LIBRARY_FILES
:= $(SDK_LIBRARY
)
1248 SDK_LIBRARY_DEST
:= $(SDK_LIB_DIR
)
1249 SDK_LIBRARY_TARGET
:= target
1250 INSTALL_TARGETS
+= SDK_LIBRARY
1254 # SDK_BINARY is still used in various makefiles for non-products of the
1255 # compilation, so we need to keep that running on the libs tier.
1256 ifneq (,$(strip $(SDK_BINARY
)))
1257 ifndef NO_DIST_INSTALL
1258 SDK_BINARY_FILES
:= $(SDK_BINARY
)
1259 SDK_BINARY_DEST
:= $(SDK_BIN_DIR
)
1260 # SDK_BINARY_TARGET is set in xpcom/idl-parser/Makefile.in
1261 SDK_BINARY_TARGET ?
= libs target
1262 INSTALL_TARGETS
+= SDK_BINARY
1266 ################################################################################
1273 $(FINAL_TARGET
)/chrome
: $(call mkdir_deps
,$(FINAL_TARGET
)/chrome
)
1275 ifneq (,$(JAR_MANIFEST
))
1276 ifndef NO_DIST_INSTALL
1279 ifdef XPI_ROOT_APPID
1280 # For add-on packaging we may specify that an application
1281 # sub-dir should be added to the root chrome manifest with
1282 # a specific application id.
1283 MAKE_JARS_FLAGS
+= --root-manifest-entry-appid
='$(XPI_ROOT_APPID)'
1286 # if DIST_SUBDIR is defined but XPI_ROOT_APPID is not there's
1287 # no way langpacks will get packaged right, so error out.
1288 ifneq (,$(DIST_SUBDIR
))
1289 ifndef XPI_ROOT_APPID
1290 $(error XPI_ROOT_APPID is not defined
- langpacks will break.
)
1295 libs realchrome
:: $(FINAL_TARGET
)/chrome
1296 $(call py_action
,jar_maker
,\
1297 $(QUIET
) -j
$(FINAL_TARGET
)/chrome \
1298 $(MAKE_JARS_FLAGS
) $(XULPPFLAGS
) $(DEFINES
) $(ACDEFINES
) \
1303 # This is a temporary check to ensure patches relying on the old behavior
1304 # of silently picking up jar.mn files continue to work.
1305 else # No JAR_MANIFEST
1306 ifneq (,$(wildcard $(srcdir)/jar.mn
))
1307 $(error
$(srcdir) contains a jar.mn file but this file is not declared in a JAR_MANIFESTS variable in a moz.build file
)
1311 ifneq ($(DIST_FILES
),)
1312 DIST_FILES_PATH
:= $(FINAL_TARGET
)
1313 DIST_FILES_FLAGS
:= $(XULAPP_DEFINES
)
1314 PP_TARGETS
+= DIST_FILES
1317 # When you move this out of the tools tier, please remove the corresponding
1318 # hacks in recursivemake.py that check if Makefile.in sets the variable.
1319 ifneq ($(XPI_PKGNAME
),)
1323 @echo
'Stripping $(XPI_PKGNAME) package directory...'
1324 @echo
$(FINAL_TARGET
)
1325 @cd
$(FINAL_TARGET
) && find .
! -type d \
1335 ! -name
'*.properties' \
1346 $(PLATFORM_EXCLUDE_LIST
) \
1347 -exec
$(STRIP
) $(STRIP_FLAGS
) {} >/dev
/null
2>&1 \
;
1350 @echo
'Packaging $(XPI_PKGNAME).xpi...'
1351 cd
$(FINAL_TARGET
) && $(ZIP
) -qr ..
/$(XPI_PKGNAME
).xpi
*
1354 # See comment above about moving this out of the tools tier.
1355 ifdef INSTALL_EXTENSION_ID
1357 $(error XPI_NAME must be set for INSTALL_EXTENSION_ID
)
1361 $(RM
) -r
'$(DIST)/bin/distribution$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)'
1362 $(NSINSTALL
) -D
'$(DIST)/bin/distribution$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)'
1363 $(call copy_dir
,$(FINAL_TARGET
),$(DIST
)/bin
/distribution
$(DIST_SUBDIR
:%=/%)/extensions
/$(INSTALL_EXTENSION_ID
))
1367 #############################################################################
1368 # MDDEPDIR is the subdirectory where all the dependency files are placed.
1369 # This uses a make rule (instead of a macro) to support parallel
1370 # builds (-jN). If this were done in the LOOP_OVER_DIRS macro, two
1371 # processes could simultaneously try to create the same directory.
1373 # We use $(CURDIR) in the rule's target to ensure that we don't find
1374 # a dependency directory in the source tree via VPATH (perhaps from
1375 # a previous build in the source tree) and thus neglect to create a
1376 # dependency directory in the object directory, where we really need
1379 ifneq (,$(filter-out all chrome default
export realchrome
clean clobber clobber_all
distclean realclean,$(MAKECMDGOALS
)))
1380 MDDEPEND_FILES
:= $(strip $(wildcard $(addprefix $(MDDEPDIR
)/,$(EXTRA_MDDEPEND_FILES
) $(addsuffix .pp
,$(notdir $(sort $(OBJS
) $(PROGOBJS
) $(HOST_OBJS
) $(HOST_PROGOBJS
)))))))
1382 ifneq (,$(MDDEPEND_FILES
))
1383 $(call include_deps
,$(MDDEPEND_FILES
))
1389 ifneq (,$(filter export,$(MAKECMDGOALS
)))
1390 MDDEPEND_FILES
:= $(strip $(wildcard $(addprefix $(MDDEPDIR
)/,$(EXTRA_EXPORT_MDDEPEND_FILES
))))
1392 ifneq (,$(MDDEPEND_FILES
))
1393 $(call include_deps
,$(MDDEPEND_FILES
))
1398 #############################################################################
1400 -include $(topsrcdir
)/$(MOZ_BUILD_APP
)/app-rules.mk
1401 -include $(MY_RULES
)
1404 # Generate Emacs tags in a file named TAGS if ETAGS was set in $(MY_CONFIG)
1408 ifneq ($(CSRCS
)$(CPPSRCS
)$(HEADERS
),)
1410 TAGS
:: $(CSRCS
) $(CPPSRCS
) $(HEADERS
)
1411 $(ETAGS
) $(CSRCS
) $(CPPSRCS
) $(HEADERS
)
1415 ################################################################################
1416 # Install/copy rules
1418 # The INSTALL_TARGETS variable contains a list of all install target
1419 # categories. Each category defines a list of files and executables, and an
1420 # install destination,
1422 # FOO_FILES := foo bar
1423 # FOO_EXECUTABLES := baz
1424 # FOO_DEST := target_path
1425 # INSTALL_TARGETS += FOO
1427 # Additionally, a FOO_TARGET variable may be added to indicate the target for
1428 # which the files and executables are installed. Default is "libs".
1430 # Finally, a FOO_KEEP_PATH variable may be set to 1 to indicate the paths given
1431 # in FOO_FILES/FOO_EXECUTABLES are to be kept at the destination. That is,
1432 # if FOO_FILES is bar/baz/qux.h, and FOO_DEST is $(DIST)/include, the installed
1433 # file would be $(DIST)/include/bar/baz/qux.h instead of $(DIST)/include/qux.h
1435 # If we're using binary nsinstall and it's not built yet, fallback to python nsinstall.
1436 ifneq (,$(filter $(DEPTH
)/config
/nsinstall
$(HOST_BIN_SUFFIX
),$(install_cmd
)))
1437 ifeq (,$(wildcard $(DEPTH
)/config
/nsinstall
$(HOST_BIN_SUFFIX
)))
1438 nsinstall_is_usable
= $(if
$(wildcard $(DEPTH
)/config
/nsinstall
$(HOST_BIN_SUFFIX
)),yes
)
1440 define install_cmd_override
1441 $(1): install_cmd
= $$(if
$$(nsinstall_is_usable
),$$(INSTALL
),$$(NSINSTALL_PY
) -t
) $$(1)
1446 install_target_tier
= $(or
$($(1)_TARGET
),libs
)
1447 INSTALL_TARGETS_TIERS
:= $(sort $(foreach category
,$(INSTALL_TARGETS
),$(call install_target_tier
,$(category
))))
1449 install_target_result
= $($(1)_DEST
:%/=%)/$(if
$($(1)_KEEP_PATH
),$(2),$(notdir $(2)))
1450 install_target_files
= $(foreach file
,$($(1)_FILES
),$(call install_target_result
,$(category
),$(file
)))
1451 install_target_executables
= $(foreach file
,$($(1)_EXECUTABLES
),$(call install_target_result
,$(category
),$(file
)))
1453 # Work around a GNU make 3.81 bug where it gives $< the wrong value.
1454 # See details in bug 934864.
1455 define create_dependency
1460 define install_target_template
1461 $(call install_cmd_override
,$(2))
1462 $(call create_dependency
,$(2),$(1))
1465 $(foreach category
,$(INSTALL_TARGETS
),\
1466 $(if
$($(category
)_DEST
),,$(error Missing
$(category
)_DEST
)) \
1467 $(foreach tier
,$(call install_target_tier
,$(category
)),\
1468 $(eval INSTALL_TARGETS_FILES_
$(tier
) += $(call install_target_files
,$(category
))) \
1469 $(eval INSTALL_TARGETS_EXECUTABLES_
$(tier
) += $(call install_target_executables
,$(category
))) \
1471 $(foreach file
,$($(category
)_FILES
) $($(category
)_EXECUTABLES
), \
1472 $(eval
$(call install_target_template
,$(file
),$(call install_target_result
,$(category
),$(file
)))) \
1476 $(foreach tier
,$(INSTALL_TARGETS_TIERS
), \
1477 $(eval
$(tier
):: $(INSTALL_TARGETS_FILES_
$(tier
)) $(INSTALL_TARGETS_EXECUTABLES_
$(tier
))) \
1480 install_targets_sanity
= $(if
$(filter-out $(notdir $@
),$(notdir $(<))),$(error Looks like
$@ has an unexpected dependency on
$< which breaks INSTALL_TARGETS
))
1482 $(sort $(foreach tier
,$(INSTALL_TARGETS_TIERS
),$(INSTALL_TARGETS_FILES_
$(tier
)))):
1483 $(install_targets_sanity
)
1484 $(call install_cmd
,$(IFLAGS1
) '$<' '$(@D)')
1486 $(sort $(foreach tier
,$(INSTALL_TARGETS_TIERS
),$(INSTALL_TARGETS_EXECUTABLES_
$(tier
)))):
1487 $(install_targets_sanity
)
1488 $(call install_cmd
,$(IFLAGS2
) '$<' '$(@D)')
1490 ################################################################################
1491 # Preprocessing rules
1493 # The PP_TARGETS variable contains a list of all preprocessing target
1494 # categories. Each category has associated variables listing input files, the
1495 # output directory, extra preprocessor flags, and so on. For example:
1498 # FOO_PATH := target-directory
1499 # FOO_FLAGS := -Dsome_flag
1502 # If PP_TARGETS lists a category name <C> (like FOO, above), then we consult the
1503 # following make variables to see what to do:
1505 # - <C> lists input files to be preprocessed with mozbuild.action.preprocessor.
1506 # We search VPATH for the names given here. If an input file name ends in
1507 # '.in', that suffix is omitted from the output file name.
1509 # - <C>_PATH names the directory in which to place the preprocessed output
1510 # files. We create this directory if it does not already exist. Setting
1511 # this variable is optional; if unset, we install the files in $(CURDIR).
1513 # - <C>_FLAGS lists flags to pass to mozbuild.action.preprocessor, in addition
1514 # to the usual bunch. Setting this variable is optional.
1516 # - <C>_TARGET names the 'make' target that should depend on creating the output
1517 # files. Setting this variable is optional; if unset, we preprocess the
1518 # files for the 'libs' target.
1520 # - <C>_KEEP_PATH may be set to 1 to indicate the paths given in <C> are to be
1521 # kept under <C>_PATH. That is, if <C> is bar/baz/qux.h.in and <C>_PATH is
1522 # $(DIST)/include, the preprocessed file would be $(DIST)/include/bar/baz/qux.h
1523 # instead of $(DIST)/include/qux.h.
1525 pp_target_tier
= $(or
$($(1)_TARGET
),libs
)
1526 PP_TARGETS_TIERS
:= $(sort $(foreach category
,$(PP_TARGETS
),$(call pp_target_tier
,$(category
))))
1528 pp_target_result
= $(or
$($(1)_PATH
:%/=%),$(CURDIR
))/$(if
$($(1)_KEEP_PATH
),$(2:.in
=),$(notdir $(2:.in
=)))
1529 pp_target_results
= $(foreach file
,$($(1)),$(call pp_target_result
,$(category
),$(file
)))
1531 $(foreach category
,$(PP_TARGETS
), \
1532 $(foreach tier
,$(call pp_target_tier
,$(category
)), \
1533 $(eval PP_TARGETS_RESULTS_
$(tier
) += $(call pp_target_results
,$(category
))) \
1535 $(foreach file
,$($(category
)), \
1536 $(eval
$(call create_dependency
,$(call pp_target_result
,$(category
),$(file
)), \
1537 $(file
) $(GLOBAL_DEPS
))) \
1539 $(eval
$(call pp_target_results
,$(category
)): PP_TARGET_FLAGS
=$($(category
)_FLAGS
)) \
1542 $(foreach tier
,$(PP_TARGETS_TIERS
), \
1543 $(eval
$(tier
):: $(PP_TARGETS_RESULTS_
$(tier
))) \
1546 PP_TARGETS_ALL_RESULTS
:= $(sort $(foreach tier
,$(PP_TARGETS_TIERS
),$(PP_TARGETS_RESULTS_
$(tier
))))
1547 $(PP_TARGETS_ALL_RESULTS
):
1548 $(if
$(filter-out $(notdir $@
),$(notdir $(<:.in
=))),$(error Looks like
$@ has an unexpected dependency on
$< which breaks PP_TARGETS
))
1550 $(call py_action
,preprocessor
,--depend
$(MDDEPDIR
)/$(@F
).pp
$(PP_TARGET_FLAGS
) $(DEFINES
) $(ACDEFINES
) $(XULPPFLAGS
) '$<' -o
'$@')
1552 # The depfile is based on the filename, and we don't want conflicts. So check
1553 # there's only one occurrence of any given filename in PP_TARGETS_ALL_RESULTS.
1554 PP_TARGETS_ALL_RESULT_NAMES
:= $(notdir $(PP_TARGETS_ALL_RESULTS
))
1555 $(foreach file
,$(sort $(PP_TARGETS_ALL_RESULT_NAMES
)), \
1556 $(if
$(filter-out 1,$(words $(filter $(file
),$(PP_TARGETS_ALL_RESULT_NAMES
)))), \
1557 $(error Multiple preprocessing rules are creating a
$(file
) file
) \
1561 ifneq (,$(filter $(PP_TARGETS_TIERS
) $(PP_TARGETS_ALL_RESULTS
),$(MAKECMDGOALS
)))
1562 # If the depfile for a preprocessed file doesn't exist, add a dep to force
1564 $(foreach file
,$(PP_TARGETS_ALL_RESULTS
), \
1565 $(if
$(wildcard $(MDDEPDIR
)/$(notdir $(file
)).pp
), \
1567 $(eval
$(file
): FORCE
) \
1571 MDDEPEND_FILES
:= $(strip $(wildcard $(addprefix $(MDDEPDIR
)/,$(addsuffix .pp
,$(notdir $(PP_TARGETS_ALL_RESULTS
))))))
1573 ifneq (,$(MDDEPEND_FILES
))
1574 $(call include_deps
,$(MDDEPEND_FILES
))
1579 # Pull in non-recursive targets if this is a partial tree build.
1580 ifndef TOPLEVEL_BUILD
1581 include $(topsrcdir
)/config
/makefiles
/nonrecursive.mk
1584 ################################################################################
1585 # Special gmake rules.
1586 ################################################################################
1590 # Re-define the list of default suffixes, so gmake won't have to churn through
1591 # hundreds of built-in suffix rules for stuff we don't need.
1596 # Fake targets. Always run these rules, even if a file/directory with that
1597 # name already exists.
1599 .PHONY
: all alltags boot checkout chrome realchrome
clean clobber clobber_all
export install libs makefiles
realclean run_apprunner tools
$(DIRS
) FORCE
1601 # Used as a dependency to force targets to rebuild
1604 # Delete target if error occurs when building target
1609 TAGS
: $(CSRCS
) $(CPPSRCS
) $(wildcard *.h
)
1610 -etags
$(CSRCS
) $(CPPSRCS
) $(wildcard *.h
)
1613 ifndef INCLUDED_DEBUGMAKE_MK
#{
1614 ## Only parse when an echo* or show* target is requested
1615 ifneq (,$(call isTargetStem
,echo
,show
))
1616 include $(topsrcdir
)/config
/makefiles
/debugmake.mk
1622 $(DOXYGEN
) $(DEPTH
)/config
/doxygen.cfg
1630 FREEZE_VARIABLES
= \
1639 EXTRA_PP_COMPONENTS \
1642 $(foreach var
,$(FREEZE_VARIABLES
),$(eval
$(var
)_FROZEN
:= '$($(var))'))
1644 CHECK_FROZEN_VARIABLES
= $(foreach var
,$(FREEZE_VARIABLES
), \
1645 $(if
$(subst $($(var
)_FROZEN
),,'$($(var))'),$(error Makefile variable
'$(var)' changed value after including rules.mk. Was
$($(var
)_FROZEN
), now
$($(var
)).
)))
1648 $(CHECK_FROZEN_VARIABLES
)
1650 PURGECACHES_DIRS ?
= $(DIST
)/bin
1651 ifdef MOZ_WEBAPP_RUNTIME
1652 PURGECACHES_DIRS
+= $(DIST
)/bin
/webapprt
1655 PURGECACHES_FILES
= $(addsuffix /.purgecaches
,$(PURGECACHES_DIRS
))
1657 default
all:: $(PURGECACHES_FILES
)
1659 $(PURGECACHES_FILES
):
1660 if
test -d
$(@D
) ; then touch
$@
; fi
1662 .DEFAULT_GOAL
:= $(or
$(OVERRIDE_DEFAULT_GOAL
),default
)
1664 #############################################################################
1665 # Derived targets and dependencies
1667 include $(topsrcdir
)/config
/makefiles
/autotargets.mk
1668 ifneq ($(NULL
),$(AUTO_DEPS
))
1669 default
all libs tools
export:: $(AUTO_DEPS
)
1672 export:: $(GENERATED_FILES
)
1674 GARBAGE
+= $(GENERATED_FILES
)
1676 # We may have modified "frozen" variables in rules.mk (we do that), but we don't
1677 # want Makefile.in doing that, so collect the possibly modified variables here,
1678 # and check them again in recurse.mk, which is always included after Makefile.in
1680 $(foreach var
,$(_MOZBUILD_EXTERNAL_VARIABLES
),$(eval
$(var
)_FROZEN
:= '$($(var))'))
1681 $(foreach var
,$(_DEPRECATED_VARIABLES
),$(eval
$(var
)_FROZEN
:= '$($(var))'))