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 # Integrate with mozbuild-generated make files. We first verify that no
14 # variables provided by the automatically generated .mk files are
15 # present. If they are, this is a violation of the separation of
16 # responsibility between Makefile.in and mozbuild files.
17 _MOZBUILD_EXTERNAL_VARIABLES
:= \
27 ifndef EXTERNALLY_MANAGED_MAKE_FILE
28 # Using $(firstword) may not be perfect. But it should be good enough for most
30 _current_makefile
= $(CURDIR
)/$(firstword $(MAKEFILE_LIST
))
32 $(foreach var
,$(_MOZBUILD_EXTERNAL_VARIABLES
),$(if
$($(var
)),\
33 $(error Variable
$(var
) is defined in
$(_current_makefile
). It should only be defined in moz.build files
),\
36 ifneq (,$(XPIDLSRCS
)$(SDK_XPIDLSRCS
))
37 $(error XPIDLSRCS and SDK_XPIDLSRCS have been merged and moved to moz.build files
as the XPIDL_SOURCES variable. You must move these variables out of
$(_current_makefile
))
40 # Import the automatically generated backend file. If this file doesn't exist,
41 # the backend hasn't been properly configured. We want this to be a fatal
42 # error, hence not using "-include".
43 ifndef STANDALONE_MAKEFILE
44 GLOBAL_DEPS
+= backend.mk
50 DIRS
+= $(foreach tier
,$(TIERS
),$(tier_
$(tier
)_dirs
))
51 STATIC_DIRS
+= $(foreach tier
,$(TIERS
),$(tier_
$(tier
)_staticdirs
))
55 MOZILLA_DIR
= $(topsrcdir
)
58 ifndef INCLUDED_CONFIG_MK
59 include $(topsrcdir
)/config
/config.mk
62 ifndef INCLUDED_VERSION_MK
63 include $(topsrcdir
)/config
/version.mk
66 USE_AUTOTARGETS_MK
= 1
67 include $(topsrcdir
)/config
/makefiles
/makeutils.mk
70 _EXTRA_EXPORTS
:= $(filter-out $(EXPORTS
),$(SDK_HEADERS
))
71 EXPORTS
+= $(_EXTRA_EXPORTS
)
74 REPORT_BUILD
= $(info $(notdir $<))
82 # Don't copy xulrunner files at install time, when using system xulrunner
87 # ELOG prints out failed command when building silently (gmake -s). Pymake
88 # prints out failed commands anyway, so ELOG just makes things worse by
89 # forcing shell invocations.
91 ifneq (,$(findstring s
, $(filter-out --%, $(MAKEFLAGS
))))
92 ELOG
:= $(EXEC
) sh
$(BUILD_TOOLS
)/print-failed-commands.sh
98 endif # ifndef .PYMAKE
100 _VPATH_SRCS
= $(abspath
$<)
103 EXTRA_DSO_LIBS
:= $(call EXPAND_MOZLIBNAME
,$(EXTRA_DSO_LIBS
))
106 ################################################################################
107 # Testing frameworks support
108 ################################################################################
110 testxpcobjdir
= $(DEPTH
)/_tests
/xpcshell
114 # Add test directories to the regular directories list. TEST_DIRS should
115 # arguably have the same status as TOOL_DIRS and other *_DIRS variables. It is
116 # coded this way until Makefiles stop using the "ifdef ENABLE_TESTS; DIRS +="
119 # The current developer workflow expects tests to be updated when processing
120 # the default target. If we ever change this implementation, the behavior
121 # should be preserved or the change should be widely communicated. A
122 # consequence of not processing test dir targets during the default target is
123 # that changes to tests may not be updated and code could assume to pass
124 # locally against non-current test code.
127 ifndef INCLUDED_TESTS_XPCSHELL_MK
#{
128 include $(topsrcdir
)/config
/makefiles
/xpcshell.mk
131 ifndef INCLUDED_TESTS_MOCHITEST_MK
#{
132 include $(topsrcdir
)/config
/makefiles
/mochitest.mk
135 ifdef MOZ_ENABLE_GTEST
137 CPPSRCS
+= $(GTEST_CPPSRCS
)
141 CSRCS
+= $(GTEST_CSRCS
)
145 CMMSRCS
+= $(GTEST_CMMSRCS
)
151 # Compile the tests to $(DIST)/bin. Make lots of niceties available by default
152 # through TestHarness.h, by modifying the list of includes and the libs against
154 CPPSRCS
+= $(CPP_UNIT_TESTS
)
155 SIMPLE_PROGRAMS
+= $(CPP_UNIT_TESTS
:.
cpp=$(BIN_SUFFIX
))
156 INCLUDES
+= -I
$(DIST
)/include/testing
157 LIBS
+= $(XPCOM_GLUE_LDOPTS
) $(NSPR_LIBS
) $(MOZ_JS_LIBS
) $(if
$(JS_SHARED_LIBRARY
),,$(MOZ_ZLIB_LIBS
))
160 @
$(PYTHON
) $(topsrcdir
)/testing
/runcppunittests.py
--xre-path
=$(DIST
)/bin
--symbols-path
=$(DIST
)/crashreporter-symbols
$(subst .
cpp,$(BIN_SUFFIX
),$(CPP_UNIT_TESTS
))
162 cppunittests-remote
: DM_TRANS?
=adb
164 @if
[ "${TEST_DEVICE}" != "" -o
"$(DM_TRANS)" = "adb" ]; then \
165 $(PYTHON
) -u
$(topsrcdir
)/testing
/remotecppunittests.py \
166 --xre-path
=$(DEPTH
)/dist/bin \
167 --localLib
=$(DEPTH
)/dist/$(MOZ_APP_NAME
) \
168 --dm_trans
=$(DM_TRANS
) \
169 --deviceIP
=${TEST_DEVICE} \
170 $(subst .
cpp,$(BIN_SUFFIX
),$(CPP_UNIT_TESTS
)) $(EXTRA_TEST_ARGS
); \
172 echo
"please prepare your host with environment variables for TEST_DEVICE"; \
175 endif # CPP_UNIT_TESTS
179 ifdef PYTHON_UNIT_TESTS
181 RUN_PYTHON_UNIT_TESTS
:= $(addprefix run-
,$(PYTHON_UNIT_TESTS
))
183 .PHONY
: $(RUN_PYTHON_UNIT_TESTS
)
185 check:: $(RUN_PYTHON_UNIT_TESTS
)
187 $(RUN_PYTHON_UNIT_TESTS
): run-
%: %
188 @PYTHONDONTWRITEBYTECODE
=1 $(PYTHON
) $<
190 endif # PYTHON_UNIT_TESTS
198 # If FORCE_STATIC_LIB is set, build a static library.
199 # Otherwise, build a shared library.
203 ifdef STATIC_LIBRARY_NAME
204 REAL_LIBRARY
:= $(LIB_PREFIX
)$(STATIC_LIBRARY_NAME
).
$(LIB_SUFFIX
)
205 # Only build actual library if it is installed in DIST/lib or SDK
206 ifeq (,$(SDK_LIBRARY
)$(DIST_INSTALL
)$(NO_EXPAND_LIBS
))
207 LIBRARY
:= $(REAL_LIBRARY
).
$(LIBS_DESC_SUFFIX
)
209 LIBRARY
:= $(REAL_LIBRARY
) $(REAL_LIBRARY
).
$(LIBS_DESC_SUFFIX
)
211 endif # STATIC_LIBRARY_NAME
215 ifdef HOST_LIBRARY_NAME
216 HOST_LIBRARY
:= $(LIB_PREFIX
)$(HOST_LIBRARY_NAME
).
$(LIB_SUFFIX
)
221 ifdef FORCE_SHARED_LIB
225 MKSHLIB
= $(MKCSHLIB
)
228 ifneq (,$(filter OS2 WINNT
,$(OS_ARCH
)))
229 IMPORT_LIBRARY
:= $(LIB_PREFIX
)$(SHARED_LIBRARY_NAME
).
$(IMPORT_LIB_SUFFIX
)
232 ifeq (OS2
,$(OS_ARCH
))
234 SHARED_LIBRARY_NAME
:= $(SHORT_LIBNAME
)
239 SHARED_LIBRARY
:= $(SHARED_LIBRARY_NAME
)
241 SHARED_LIBRARY
:= $(DLL_PREFIX
)$(SHARED_LIBRARY_NAME
)$(DLL_SUFFIX
)
244 ifeq ($(OS_ARCH
),OS2
)
245 DEF_FILE
:= $(SHARED_LIBRARY
:.dll
=.def
)
251 endif # FORCE_SHARED_LIB
254 ifdef FORCE_STATIC_LIB
255 ifndef FORCE_SHARED_LIB
256 SHARED_LIBRARY
:= $(NULL
)
258 IMPORT_LIBRARY
:= $(NULL
)
262 ifdef FORCE_SHARED_LIB
263 ifndef FORCE_STATIC_LIB
268 ifdef JAVA_LIBRARY_NAME
269 JAVA_LIBRARY
:= $(JAVA_LIBRARY_NAME
).jar
272 ifeq ($(OS_ARCH
),WINNT
)
276 # Unless we're building SIMPLE_PROGRAMS, all C++ files share a PDB file per
277 # directory. For parallel builds, this PDB file is shared and locked by
278 # MSPDBSRV.EXE, starting with MSVC8 SP1. If you're using MSVC 7.1 or MSVC8
279 # without SP1, don't do parallel builds.
281 # The final PDB for libraries and programs is created by the linker and uses
282 # a different name from the single PDB file created by the compiler. See
286 ifdef SIMPLE_PROGRAMS
287 COMPILE_PDBFILE
= $(basename $(@F
)).pdb
289 COMPILE_PDBFILE
= generated.pdb
292 LINK_PDBFILE
= $(basename $(@F
)).pdb
294 CODFILE
=$(basename $(@F
)).cod
298 ifdef SHARED_LIBRARY_NAME
299 MAPFILE
=$(SHARED_LIBRARY_NAME
).map
301 MAPFILE
=$(basename $(@F
)).map
302 endif # SHARED_LIBRARY_NAME
306 OS_LDFLAGS
+= -DEF
:$(call normalizepath
,$(DEFFILE
))
307 EXTRA_DEPS
+= $(DEFFILE
)
311 OS_LDFLAGS
+= -MAP
:$(MAPFILE
)
317 OS_LDFLAGS
+= $(call normalizepath
,$(DEFFILE
))
318 EXTRA_DEPS
+= $(DEFFILE
)
325 ifeq ($(SOLARIS_SUNPRO_CXX
),1)
326 ifeq (86,$(findstring 86,$(OS_TEST
)))
327 OS_LDFLAGS
+= -M
$(topsrcdir
)/config
/solaris_ia32.map
329 endif # Solaris Sun Studio C++
331 ifeq ($(HOST_OS_ARCH
),WINNT
)
332 HOST_PDBFILE
=$(basename $(@F
)).pdb
335 # Don't build SIMPLE_PROGRAMS during the MOZ_PROFILE_GENERATE pass
336 ifdef MOZ_PROFILE_GENERATE
341 TARGETS
= $(LIBRARY
) $(SHARED_LIBRARY
) $(PROGRAM
) $(SIMPLE_PROGRAMS
) $(HOST_LIBRARY
) $(HOST_PROGRAM
) $(HOST_SIMPLE_PROGRAMS
) $(JAVA_LIBRARY
)
344 COBJS
= $(CSRCS
:.c
=.
$(OBJ_SUFFIX
))
345 SOBJS
= $(SSRCS
:.S
=.
$(OBJ_SUFFIX
))
346 CCOBJS
= $(patsubst %.
cc,%.
$(OBJ_SUFFIX
),$(filter %.
cc,$(CPPSRCS
)))
347 CPPOBJS
= $(patsubst %.
cpp,%.
$(OBJ_SUFFIX
),$(filter %.
cpp,$(CPPSRCS
)))
348 CMOBJS
= $(CMSRCS
:.m
=.
$(OBJ_SUFFIX
))
349 CMMOBJS
= $(CMMSRCS
:.mm
=.
$(OBJ_SUFFIX
))
350 ASOBJS
= $(ASFILES
:.
$(ASM_SUFFIX
)=.
$(OBJ_SUFFIX
))
352 _OBJS
= $(COBJS
) $(SOBJS
) $(CCOBJS
) $(CPPOBJS
) $(CMOBJS
) $(CMMOBJS
) $(ASOBJS
)
353 OBJS
= $(strip $(_OBJS
))
356 HOST_COBJS
= $(addprefix host_
,$(HOST_CSRCS
:.c
=.
$(OBJ_SUFFIX
)))
357 HOST_CCOBJS
= $(addprefix host_
,$(patsubst %.
cc,%.
$(OBJ_SUFFIX
),$(filter %.
cc,$(HOST_CPPSRCS
))))
358 HOST_CPPOBJS
= $(addprefix host_
,$(patsubst %.
cpp,%.
$(OBJ_SUFFIX
),$(filter %.
cpp,$(HOST_CPPSRCS
))))
359 HOST_CMOBJS
= $(addprefix host_
,$(HOST_CMSRCS
:.m
=.
$(OBJ_SUFFIX
)))
360 HOST_CMMOBJS
= $(addprefix host_
,$(HOST_CMMSRCS
:.mm
=.
$(OBJ_SUFFIX
)))
362 _HOST_OBJS
= $(HOST_COBJS
) $(HOST_CCOBJS
) $(HOST_CPPOBJS
) $(HOST_CMOBJS
) $(HOST_CMMOBJS
)
363 HOST_OBJS
= $(strip $(_HOST_OBJS
))
367 $(GARBAGE
) $(TARGETS
) $(OBJS
) $(PROGOBJS
) LOGS TAGS a.out \
368 $(filter-out $(ASFILES
),$(OBJS
:.
$(OBJ_SUFFIX
)=.s
)) $(OBJS
:.
$(OBJ_SUFFIX
)=.ii
) \
369 $(OBJS
:.
$(OBJ_SUFFIX
)=.i
) $(OBJS
:.
$(OBJ_SUFFIX
)=.i_o
) \
370 $(HOST_PROGOBJS
) $(HOST_OBJS
) $(IMPORT_LIBRARY
) $(DEF_FILE
)\
371 $(EXE_DEF_FILE
) so_locations _gen _stubs
$(wildcard *.res
) $(wildcard *.RES
) \
372 $(wildcard *.pdb
) $(CODFILE
) $(MAPFILE
) $(IMPORT_LIBRARY
) \
373 $(SHARED_LIBRARY
:$(DLL_SUFFIX
)=.exp
) $(wildcard *.ilk
) \
374 $(PROGRAM
:$(BIN_SUFFIX
)=.exp
) $(SIMPLE_PROGRAMS
:$(BIN_SUFFIX
)=.exp
) \
375 $(PROGRAM
:$(BIN_SUFFIX
)=.lib
) $(SIMPLE_PROGRAMS
:$(BIN_SUFFIX
)=.lib
) \
376 $(SIMPLE_PROGRAMS
:$(BIN_SUFFIX
)=.
$(OBJ_SUFFIX
)) \
377 $(wildcard gts_tmp_
*) $(LIBRARY
:%.a
=.
%.timestamp
)
379 $(GARBAGE_DIRS
) /no-such-file
382 GARBAGE
+= $(MOCSRCS
)
383 GARBAGE
+= $(RCCSRCS
)
386 ifdef SIMPLE_PROGRAMS
387 GARBAGE
+= $(SIMPLE_PROGRAMS
:%=%.
$(OBJ_SUFFIX
))
390 ifdef HOST_SIMPLE_PROGRAMS
391 GARBAGE
+= $(HOST_SIMPLE_PROGRAMS
:%=%.
$(OBJ_SUFFIX
))
395 # the Solaris WorkShop template repository cache. it occasionally can get
396 # out of sync, so targets like clobber should kill it.
398 ifeq ($(SOLARIS_SUNPRO_CXX
),1)
399 GARBAGE_DIRS
+= SunWS_cache
402 XPIDL_GEN_DIR
= _xpidlgen
404 ifdef MOZ_UPDATE_XTERM
405 # Its good not to have a newline at the end of the titlebar string because it
406 # makes the make -s output easier to read. Echo -n does not work on all
407 # platforms, but we can trick printf into doing it.
408 UPDATE_TITLE
= printf
"\033]0;%s in %s\007" $(1) $(shell $(BUILD_TOOLS
)/print-depth-path.sh
)/$(2) ;
411 define SUBMAKE
# $(call SUBMAKE,target,directory)
413 +$(MAKE
) $(if
$(2),-C
$(2)) $(1)
415 endef # The extra line is important here! don't delete it
417 ifneq (,$(strip $(DIRS
)))
419 $(foreach dir,$(DIRS
),$(call SUBMAKE
,$@
,$(dir)))
422 # we only use this for the makefiles target and other stuff that doesn't matter
423 ifneq (,$(strip $(PARALLEL_DIRS
)))
424 LOOP_OVER_PARALLEL_DIRS
= \
425 $(foreach dir,$(PARALLEL_DIRS
),$(call SUBMAKE
,$@
,$(dir)))
428 ifneq (,$(strip $(STATIC_DIRS
)))
429 LOOP_OVER_STATIC_DIRS
= \
430 $(foreach dir,$(STATIC_DIRS
),$(call SUBMAKE
,$@
,$(dir)))
433 ifneq (,$(strip $(TOOL_DIRS
)))
434 LOOP_OVER_TOOL_DIRS
= \
435 $(foreach dir,$(TOOL_DIRS
),$(call SUBMAKE
,$@
,$(dir)))
439 # Now we can differentiate between objects used to build a library, and
440 # objects used to build an executable in the same directory.
447 HOST_PROGOBJS
= $(HOST_OBJS
)
450 GARBAGE_DIRS
+= $(wildcard $(CURDIR
)/$(MDDEPDIR
))
453 # Tags: emacs (etags), vi (ctags)
454 # TAG_PROGRAM := ctags -L -
456 TAG_PROGRAM
= xargs etags
-a
459 # Turn on C++ linking if we have any .cpp or .mm files
460 # (moved this from config.mk so that config.mk can be included
461 # before the CPPSRCS are defined)
463 ifneq ($(HOST_CPPSRCS
)$(HOST_CMMSRCS
),)
464 HOST_CPP_PROG_LINK
= 1
468 # This will strip out symbols that the component should not be
469 # exporting from the .dynsym section.
472 EXTRA_DSO_LDOPTS
+= $(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
)
476 # Enforce the requirement that MODULE_NAME must be set
477 # for components in static builds
481 ifndef FORCE_SHARED_LIB
483 $(error MODULE_NAME is required for components which may be used in static builds
)
490 # MacOS X specific stuff
493 ifeq ($(OS_ARCH
),Darwin
)
496 EXTRA_DSO_LDOPTS
+= -bundle
498 EXTRA_DSO_LDOPTS
+= -dynamiclib
-install_name @executable_path
/$(SHARED_LIBRARY
) -compatibility_version
1 -current_version
1 -single_module
504 # On NetBSD a.out systems, use -Bsymbolic. This fixes what would otherwise be
505 # fatal symbol name clashes between components.
507 ifeq ($(OS_ARCH
),NetBSD
)
508 ifeq ($(DLL_SUFFIX
),.so
.1.0)
510 EXTRA_DSO_LDOPTS
+= -Wl
,-Bsymbolic
515 ifeq ($(OS_ARCH
),FreeBSD
)
517 EXTRA_DSO_LDOPTS
+= -Wl
,-Bsymbolic
521 ifeq ($(OS_ARCH
),NetBSD
)
522 ifneq (,$(filter arc cobalt hpcmips mipsco newsmips pmax sgimips
,$(OS_TEST
)))
523 ifeq ($(MODULE
),layout
)
524 OS_CFLAGS
+= -Wa
,-xgot
525 OS_CXXFLAGS
+= -Wa
,-xgot
531 # HP-UXBeOS specific section: for COMPONENTS only, add -Bsymbolic flag
532 # which uses internal symbols first
534 ifeq ($(OS_ARCH
),HP-UX
)
536 ifeq ($(GNU_CC
)$(GNU_CXX
),)
537 EXTRA_DSO_LDOPTS
+= -Wl
,-Bsymbolic
538 ifneq ($(HAS_EXTRAEXPORTS
),1)
539 MKSHLIB
+= -Wl
,+eNSGetModule
-Wl
,+eerrno
540 MKCSHLIB
+= +eNSGetModule
+eerrno
541 ifneq ($(OS_TEST
),ia64
)
542 MKSHLIB
+= -Wl
,+e_shlInit
543 MKCSHLIB
+= +e_shlInit
545 endif # !HAS_EXTRAEXPORTS
546 endif # non-gnu compilers
550 ifeq ($(OS_ARCH
),AIX
)
552 ifneq ($(HAS_EXTRAEXPORTS
),1)
553 MKSHLIB
+= -bE
:$(MOZILLA_DIR
)/build
/unix
/aix.exp
-bnoexpall
554 MKCSHLIB
+= -bE
:$(MOZILLA_DIR
)/build
/unix
/aix.exp
-bnoexpall
555 endif # HAS_EXTRAEXPORTS
560 # Linux: add -Bsymbolic flag for components
562 ifeq ($(OS_ARCH
),Linux
)
564 EXTRA_DSO_LDOPTS
+= -Wl
,-Bsymbolic
569 # GNU doesn't have path length limitation
572 ifeq ($(OS_ARCH
),GNU
)
573 OS_CPPFLAGS
+= -DPATH_MAX
=1024 -DMAXPATHLEN
=1024
579 ifeq ($(OS_ARCH
),WINNT
)
582 DSO_LDOPTS
+= -Wl
,--out-implib
-Wl
,$(IMPORT_LIBRARY
)
595 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
599 endif # WINNT && !GNU_CC
601 ifneq (,$(filter ml
%,$(AS
)))
602 ASOUTOPTION
= -Fo
# eol
604 ASOUTOPTION
= -o
# eol
607 ifeq (,$(CROSS_COMPILE
))
608 HOST_OUTOPTION
= $(OUTOPTION
)
610 HOST_OUTOPTION
= -o
# eol
612 ################################################################################
614 # SUBMAKEFILES: List of Makefiles for next level down.
615 # This is used to update or create the Makefiles before invoking them.
616 SUBMAKEFILES
+= $(addsuffix /Makefile
, $(DIRS
) $(TOOL_DIRS
) $(PARALLEL_DIRS
))
618 # The root makefile doesn't want to do a plain export/libs, because
619 # of the tiers and because of libxul. Suppress the default rules in favor
620 # of something else. Makefiles which use this var *must* provide a sensible
621 # default rule before including rules.mk
622 ifndef SUPPRESS_DEFAULT_RULES
625 $(foreach tier
,$(TIERS
),$(call SUBMAKE
,tier_
$(tier
)))
629 ifneq (,$(strip $(STATIC_DIRS
)))
630 $(foreach dir,$(STATIC_DIRS
),$(call SUBMAKE
,,$(dir)))
644 endif # SUPPRESS_DEFAULT_RULES
646 ifeq ($(filter s
,$(MAKEFLAGS
)),)
654 MAKE_TIER_SUBMAKEFILES
= +$(if
$(tier_
$*_dirs
),$(MAKE
) $(addsuffix /Makefile
,$(tier_
$*_dirs
)))
656 $(foreach tier
,$(TIERS
),tier_
$(tier
))::
657 @
$(ECHO
) "$@: $($@_staticdirs) $($@_dirs)"
658 $(foreach dir,$($@_staticdirs
),$(call SUBMAKE
,,$(dir)))
663 # Do everything from scratch
668 # Add dummy depend target for tinderboxes
671 # Target to only regenerate makefiles
672 makefiles
: $(SUBMAKEFILES
)
673 ifneq (,$(DIRS
)$(TOOL_DIRS
)$(PARALLEL_DIRS
))
674 $(LOOP_OVER_PARALLEL_DIRS
)
676 $(LOOP_OVER_TOOL_DIRS
)
679 include $(topsrcdir
)/config
/makefiles
/target_export.mk
680 include $(topsrcdir
)/config
/makefiles
/target_tools.mk
682 ifneq (,$(filter-out %.
$(LIB_SUFFIX
),$(SHARED_LIBRARY_LIBS
)))
683 $(error SHARED_LIBRARY_LIBS must contain .
$(LIB_SUFFIX
) files only
)
686 HOST_LIBS_DEPS
= $(filter %.
$(LIB_SUFFIX
),$(HOST_LIBS
))
688 # Dependencies which, if modified, should cause everything to rebuild
689 GLOBAL_DEPS
+= Makefile
$(DEPTH
)/config
/autoconf.mk
$(topsrcdir
)/config
/config.mk
690 ifndef NO_MAKEFILE_RULE
691 GLOBAL_DEPS
+= Makefile.in
694 ##############################################
695 include $(topsrcdir
)/config
/makefiles
/target_libs.mk
697 ##############################################
698 ifndef NO_PROFILE_GUIDED_OPTIMIZE
699 ifdef MOZ_PROFILE_USE
700 ifeq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
701 # When building with PGO, we have to make sure to re-link
702 # in the MOZ_PROFILE_USE phase if we linked in the
703 # MOZ_PROFILE_GENERATE phase. We'll touch this pgo.relink
704 # file in the link rule in the GENERATE phase to indicate
705 # that we need a relink.
707 $(SHARED_LIBRARY
): pgo.relink
710 $(PROGRAM
): pgo.relink
713 # In the second pass, we need to merge the pgc files into the pgd file.
714 # The compiler would do this for us automatically if they were in the right
715 # place, but they're in dist/bin.
716 ifneq (,$(SHARED_LIBRARY
)$(PROGRAM
))
719 $(PYTHON
) $(topsrcdir
)/build
/win32
/pgomerge.py \
720 $(PROGRAM
:$(BIN_SUFFIX
)=) $(DIST
)/bin
723 $(PYTHON
) $(topsrcdir
)/build
/win32
/pgomerge.py \
724 $(SHARED_LIBRARY_NAME
) $(DIST
)/bin
726 endif # SHARED_LIBRARY || PROGRAM
728 endif # MOZ_PROFILE_USE
729 ifdef MOZ_PROFILE_GENERATE
730 # Clean up profiling data during PROFILE_GENERATE phase
732 ifeq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
733 $(foreach pgd
,$(wildcard *.pgd
),pgomgr
-clear
$(pgd
);)
741 ifneq (,$(MOZ_PROFILE_GENERATE
)$(MOZ_PROFILE_USE
))
743 # Force rebuilding libraries and programs in both passes because each
744 # pass uses different object files.
745 $(PROGRAM
) $(SHARED_LIBRARY
) $(LIBRARY
): FORCE
749 endif # NO_PROFILE_GUIDED_OPTIMIZE
751 ##############################################
754 $(MAKE
) -C
$(topsrcdir
) -f client.mk checkout
756 clean clobber realclean clobber_all
:: $(SUBMAKEFILES
)
758 -$(RM
) -r
$(ALL_TRASH_DIRS
)
759 $(foreach dir,$(PARALLEL_DIRS
) $(DIRS
) $(STATIC_DIRS
) $(TOOL_DIRS
),-$(call SUBMAKE
,$@
,$(dir)))
761 distclean:: $(SUBMAKEFILES
)
762 $(foreach dir,$(PARALLEL_DIRS
) $(DIRS
) $(STATIC_DIRS
) $(TOOL_DIRS
),-$(call SUBMAKE
,$@
,$(dir)))
763 -$(RM
) -r
$(ALL_TRASH_DIRS
)
764 -$(RM
) $(ALL_TRASH
) \
765 Makefile .HSancillary \
766 $(wildcard *.
$(OBJ_SUFFIX
)) $(wildcard *.ho
) $(wildcard host_
*.o
*) \
767 $(wildcard *.
$(LIB_SUFFIX
)) $(wildcard *$(DLL_SUFFIX
)) \
768 $(wildcard *.
$(IMPORT_LIB_SUFFIX
))
769 ifeq ($(OS_ARCH
),OS2
)
770 -$(RM
) $(PROGRAM
:.exe
=.map
)
775 find
$(topsrcdir
) -name
dist -prune
-o \
( -name
'*.[hc]' -o
-name
'*.cp' -o
-name
'*.cpp' -o
-name
'*.idl' \
) -print |
$(TAG_PROGRAM
)
779 # creates OBJS, links with LIBS to create Foo
781 $(PROGRAM
): $(PROGOBJS
) $(EXTRA_DEPS
) $(EXE_DEF_FILE
) $(RESFILE
) $(GLOBAL_DEPS
)
783 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
784 $(EXPAND_LD
) -NOLOGO
-OUT
:$@
-PDB
:$(LINK_PDBFILE
) $(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(MOZ_GLUE_PROGRAM_LDFLAGS
) $(PROGOBJS
) $(RESFILE
) $(LIBS
) $(EXTRA_LIBS
) $(OS_LIBS
)
785 ifdef MSMANIFEST_TOOL
786 @if
test -f
$@.manifest
; then \
787 if
test -f
"$(srcdir)/$@.manifest"; then \
788 echo
"Embedding manifest from $(srcdir)/$@.manifest and $@.manifest"; \
789 mt.exe
-NOLOGO
-MANIFEST
"$(win_srcdir)/$@.manifest" $@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
791 echo
"Embedding manifest from $@.manifest"; \
792 mt.exe
-NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
794 elif
test -f
"$(srcdir)/$@.manifest"; then \
795 echo
"Embedding manifest from $(srcdir)/$@.manifest"; \
796 mt.exe
-NOLOGO
-MANIFEST
"$(win_srcdir)/$@.manifest" -OUTPUTRESOURCE
:$@\
;1; \
798 endif # MSVC with manifest tool
799 ifdef MOZ_PROFILE_GENERATE
800 # touch it a few seconds into the future to work around FAT's
801 # 2-second granularity
802 touch
-t
`date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
804 else # !WINNT || GNU_CC
805 $(EXPAND_CCC
) -o
$@
$(CXXFLAGS
) $(PROGOBJS
) $(RESFILE
) $(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(WRAP_LDFLAGS
) $(LIBS_DIR
) $(LIBS
) $(MOZ_GLUE_PROGRAM_LDFLAGS
) $(OS_LIBS
) $(EXTRA_LIBS
) $(BIN_FLAGS
) $(EXE_DEF_FILE
)
806 @
$(call CHECK_STDCXX
,$@
)
807 endif # WINNT && !GNU_CC
812 ifdef MOZ_POST_PROGRAM_COMMAND
813 $(MOZ_POST_PROGRAM_COMMAND
) $@
816 $(HOST_PROGRAM
): $(HOST_PROGOBJS
) $(HOST_LIBS_DEPS
) $(HOST_EXTRA_DEPS
) $(GLOBAL_DEPS
)
817 ifeq (_WINNT
,$(GNU_CC
)_
$(HOST_OS_ARCH
))
818 $(HOST_LD
) -NOLOGO
-OUT
:$@
-PDB
:$(HOST_PDBFILE
) $(HOST_OBJS
) $(WIN32_EXE_LDFLAGS
) $(HOST_LDFLAGS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
819 ifdef MSMANIFEST_TOOL
820 @if
test -f
$@.manifest
; then \
821 if
test -f
"$(srcdir)/$@.manifest"; then \
822 echo
"Embedding manifest from $(srcdir)/$@.manifest and $@.manifest"; \
823 mt.exe
-NOLOGO
-MANIFEST
"$(win_srcdir)/$@.manifest" $@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
825 echo
"Embedding manifest from $@.manifest"; \
826 mt.exe
-NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
828 elif
test -f
"$(srcdir)/$@.manifest"; then \
829 echo
"Embedding manifest from $(srcdir)/$@.manifest"; \
830 mt.exe
-NOLOGO
-MANIFEST
"$(win_srcdir)/$@.manifest" -OUTPUTRESOURCE
:$@\
;1; \
832 endif # MSVC with manifest tool
834 ifeq ($(HOST_CPP_PROG_LINK
),1)
835 $(HOST_CXX
) -o
$@
$(HOST_CXXFLAGS
) $(HOST_LDFLAGS
) $(HOST_PROGOBJS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
837 $(HOST_CC
) -o
$@
$(HOST_CFLAGS
) $(HOST_LDFLAGS
) $(HOST_PROGOBJS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
838 endif # HOST_CPP_PROG_LINK
842 # This is an attempt to support generation of multiple binaries
843 # in one directory, it assumes everything to compile Foo is in
844 # Foo.o (from either Foo.c or Foo.cpp).
846 # SIMPLE_PROGRAMS = Foo Bar
847 # creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
849 $(SIMPLE_PROGRAMS
): %$(BIN_SUFFIX
): %.
$(OBJ_SUFFIX
) $(EXTRA_DEPS
) $(GLOBAL_DEPS
)
850 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
851 $(EXPAND_LD
) -nologo
-out
:$@
-pdb
:$(LINK_PDBFILE
) $< $(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(MOZ_GLUE_PROGRAM_LDFLAGS
) $(LIBS
) $(EXTRA_LIBS
) $(OS_LIBS
)
852 ifdef MSMANIFEST_TOOL
853 @if
test -f
$@.manifest
; then \
854 mt.exe
-NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
857 endif # MSVC with manifest tool
859 $(EXPAND_CCC
) $(CXXFLAGS
) -o
$@
$< $(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(WRAP_LDFLAGS
) $(LIBS_DIR
) $(LIBS
) $(MOZ_GLUE_PROGRAM_LDFLAGS
) $(OS_LIBS
) $(EXTRA_LIBS
) $(BIN_FLAGS
)
860 @
$(call CHECK_STDCXX
,$@
)
861 endif # WINNT && !GNU_CC
866 ifdef MOZ_POST_PROGRAM_COMMAND
867 $(MOZ_POST_PROGRAM_COMMAND
) $@
870 $(HOST_SIMPLE_PROGRAMS
): host_
%$(HOST_BIN_SUFFIX
): host_
%.
$(OBJ_SUFFIX
) $(HOST_LIBS_DEPS
) $(HOST_EXTRA_DEPS
) $(GLOBAL_DEPS
)
871 ifeq (WINNT_
,$(HOST_OS_ARCH
)_
$(GNU_CC
))
872 $(HOST_LD
) -NOLOGO
-OUT
:$@
-PDB
:$(HOST_PDBFILE
) $< $(WIN32_EXE_LDFLAGS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
874 ifneq (,$(HOST_CPPSRCS
)$(USE_HOST_CXX
))
875 $(HOST_CXX
) $(HOST_OUTOPTION
)$@
$(HOST_CXXFLAGS
) $(INCLUDES
) $< $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
877 $(HOST_CC
) $(HOST_OUTOPTION
)$@
$(HOST_CFLAGS
) $(INCLUDES
) $< $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
881 ifdef DTRACE_PROBE_OBJ
882 EXTRA_DEPS
+= $(DTRACE_PROBE_OBJ
)
883 OBJS
+= $(DTRACE_PROBE_OBJ
)
886 $(filter %.
$(LIB_SUFFIX
),$(LIBRARY
)): $(OBJS
) $(LOBJS
) $(EXTRA_DEPS
) $(GLOBAL_DEPS
)
888 $(EXPAND_AR
) $(AR_FLAGS
) $(OBJS
) $(LOBJS
) $(SHARED_LIBRARY_LIBS
)
891 $(filter-out %.
$(LIB_SUFFIX
),$(LIBRARY
)): $(filter %.
$(LIB_SUFFIX
),$(LIBRARY
)) $(OBJS
) $(LOBJS
) $(EXTRA_DEPS
) $(GLOBAL_DEPS
)
892 # When we only build a library descriptor, blow out any existing library
893 $(if
$(filter %.
$(LIB_SUFFIX
),$(LIBRARY
)),,$(RM
) $(REAL_LIBRARY
) $(EXPORT_LIBRARY
:%=%/$(REAL_LIBRARY
)))
894 $(EXPAND_LIBS_GEN
) -o
$@
$(OBJS
) $(LOBJS
) $(SHARED_LIBRARY_LIBS
)
896 ifeq ($(OS_ARCH
),WINNT
)
897 # Import libraries are created by the rules creating shared libraries.
898 # The rules to copy them to $(DIST)/lib depend on $(IMPORT_LIBRARY),
899 # but make will happily consider the import library before it is refreshed
900 # when rebuilding the corresponding shared library. Defining an empty recipe
901 # for import libraries forces make to wait for the shared library recipe to
902 # have run before considering other targets that depend on the import library.
904 $(IMPORT_LIBRARY
): $(SHARED_LIBRARY
) ;
907 ifeq ($(OS_ARCH
),OS2
)
908 $(DEF_FILE
): $(OBJS
) $(SHARED_LIBRARY_LIBS
)
910 echo LIBRARY
$(SHARED_LIBRARY_NAME
) INITINSTANCE TERMINSTANCE
> $@
912 echo CODE LOADONCALL MOVEABLE DISCARDABLE
>> $@
913 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED
>> $@
918 $(IMPORT_LIBRARY
): $(SHARED_LIBRARY
)
924 $(HOST_LIBRARY
): $(HOST_OBJS
) Makefile
926 $(HOST_AR
) $(HOST_AR_FLAGS
) $(HOST_OBJS
)
931 ifdef DTRACE_PROBE_OBJ
932 ifndef DTRACE_LIB_DEPENDENT
933 NON_DTRACE_OBJS
:= $(filter-out $(DTRACE_PROBE_OBJ
),$(OBJS
))
934 $(DTRACE_PROBE_OBJ
): $(NON_DTRACE_OBJS
)
935 dtrace
-G
-C
-s
$(MOZILLA_DTRACE_SRC
) -o
$(DTRACE_PROBE_OBJ
) $(NON_DTRACE_OBJS
)
941 # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
942 # so instead of deleting .o files after repacking them into a dylib, we make
943 # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
944 # so no need to conditionalize on OS version or debugging format.
946 $(SHARED_LIBRARY
): $(OBJS
) $(LOBJS
) $(DEF_FILE
) $(RESFILE
) $(LIBRARY
) $(EXTRA_DEPS
) $(GLOBAL_DEPS
)
947 ifndef INCREMENTAL_LINKER
950 ifdef DTRACE_LIB_DEPENDENT
952 dtrace
-G
-C
-s
$(MOZILLA_DTRACE_SRC
) -o
$(DTRACE_PROBE_OBJ
) $(shell $(EXPAND_LIBS
) $(MOZILLA_PROBE_LIBS
))
954 $(EXPAND_MKSHLIB
) $(SHLIB_LDSTARTFILE
) $(OBJS
) $(LOBJS
) $(SUB_SHLOBJS
) $(DTRACE_PROBE_OBJ
) $(MOZILLA_PROBE_LIBS
) $(RESFILE
) $(LDFLAGS
) $(WRAP_LDFLAGS
) $(SHARED_LIBRARY_LIBS
) $(EXTRA_DSO_LDOPTS
) $(MOZ_GLUE_LDFLAGS
) $(OS_LIBS
) $(EXTRA_LIBS
) $(DEF_FILE
) $(SHLIB_LDENDFILE
)
955 @
$(RM
) $(DTRACE_PROBE_OBJ
)
956 else # ! DTRACE_LIB_DEPENDENT
957 $(EXPAND_MKSHLIB
) $(SHLIB_LDSTARTFILE
) $(OBJS
) $(LOBJS
) $(SUB_SHLOBJS
) $(RESFILE
) $(LDFLAGS
) $(WRAP_LDFLAGS
) $(SHARED_LIBRARY_LIBS
) $(EXTRA_DSO_LDOPTS
) $(MOZ_GLUE_LDFLAGS
) $(OS_LIBS
) $(EXTRA_LIBS
) $(DEF_FILE
) $(SHLIB_LDENDFILE
)
958 endif # DTRACE_LIB_DEPENDENT
959 @
$(call CHECK_STDCXX
,$@
)
961 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
962 ifdef MSMANIFEST_TOOL
963 ifdef EMBED_MANIFEST_AT
964 @if
test -f
$@.manifest
; then \
965 mt.exe
-NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;$(EMBED_MANIFEST_AT
); \
968 endif # EMBED_MANIFEST_AT
969 endif # MSVC with manifest tool
970 ifdef MOZ_PROFILE_GENERATE
971 touch
-t
`date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
973 endif # WINNT && !GCC
974 @
$(RM
) foodummyfilefoo
$(DELETE_AFTER_LINK
)
979 ifdef MOZ_POST_DSO_LIB_COMMAND
980 $(MOZ_POST_DSO_LIB_COMMAND
) $@
983 ifeq ($(SOLARIS_SUNPRO_CC
),1)
984 _MDDEPFILE
= $(MDDEPDIR
)/$(@F
).pp
986 define MAKE_DEPS_AUTO_CC
987 if
test -d
$(@D
); then \
988 echo
"Building deps for $< using Sun Studio cc"; \
989 $(CC
) $(COMPILE_CFLAGS
) -xM
$< >$(_MDDEPFILE
) ; \
992 define MAKE_DEPS_AUTO_CXX
993 if
test -d
$(@D
); then \
994 echo
"Building deps for $< using Sun Studio CC"; \
995 $(CXX
) $(COMPILE_CXXFLAGS
) -xM
$< >$(_MDDEPFILE
) ; \
998 endif # Sun Studio on Solaris
1000 $(OBJS
) $(HOST_OBJS
): $(GLOBAL_DEPS
)
1002 # Rules for building native targets must come first because of the host_ prefix
1003 $(HOST_COBJS
): host_
%.
$(OBJ_SUFFIX
): %.c
1005 $(ELOG
) $(HOST_CC
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CFLAGS
) $(INCLUDES
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
1007 $(HOST_CPPOBJS
): host_
%.
$(OBJ_SUFFIX
): %.
cpp
1009 $(ELOG
) $(HOST_CXX
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CXXFLAGS
) $(INCLUDES
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
1011 $(HOST_CCOBJS
): host_
%.
$(OBJ_SUFFIX
): %.
cc
1013 $(ELOG
) $(HOST_CXX
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CXXFLAGS
) $(INCLUDES
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
1015 $(HOST_CMOBJS
): host_
%.
$(OBJ_SUFFIX
): %.m
1017 $(ELOG
) $(HOST_CC
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CFLAGS
) $(HOST_CMFLAGS
) $(INCLUDES
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
1019 $(HOST_CMMOBJS
): host_
%.
$(OBJ_SUFFIX
): %.mm
1021 $(ELOG
) $(HOST_CXX
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CXXFLAGS
) $(HOST_CMMFLAGS
) $(INCLUDES
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
1023 $(COBJS
): %.
$(OBJ_SUFFIX
): %.c
$(call mkdir_deps
,$(MDDEPDIR
))
1025 @
$(MAKE_DEPS_AUTO_CC
)
1026 $(ELOG
) $(CC
) $(OUTOPTION
)$@
-c
$(COMPILE_CFLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
1028 # DEFINES and ACDEFINES are needed here to enable conditional compilation of Q_OBJECTs:
1029 # 'moc' only knows about #defines it gets on the command line (-D...), not in
1030 # included headers like mozilla-config.h
1032 $(ELOG
) $(MOC
) $(DEFINES
) $(ACDEFINES
) $< $(OUTOPTION
)$@
1035 $(ELOG
) $(MOC
) $(DEFINES
) $(ACDEFINES
) $(_VPATH_SRCS
:.
cc=.h
) $(OUTOPTION
)$@
1038 $(ELOG
) $(RCC
) -name
$* $< $(OUTOPTION
)$@
1041 # The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
1043 $(ASOBJS
): %.
$(OBJ_SUFFIX
): %.
$(ASM_SUFFIX
)
1044 $(AS
) $(ASOUTOPTION
)$@
$(ASFLAGS
) $(AS_DASH_C_FLAG
) $(_VPATH_SRCS
)
1047 $(SOBJS
): %.
$(OBJ_SUFFIX
): %.S
1048 $(AS
) -o
$@
$(ASFLAGS
) $(LOCAL_INCLUDES
) $(TARGET_LOCAL_INCLUDES
) -c
$<
1051 # Please keep the next two rules in sync.
1053 $(CCOBJS
): %.
$(OBJ_SUFFIX
): %.
cc $(call mkdir_deps
,$(MDDEPDIR
))
1055 @
$(MAKE_DEPS_AUTO_CXX
)
1056 $(ELOG
) $(CCC
) $(OUTOPTION
)$@
-c
$(COMPILE_CXXFLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
1058 $(CPPOBJS
): %.
$(OBJ_SUFFIX
): %.
cpp $(call mkdir_deps
,$(MDDEPDIR
))
1060 @
$(MAKE_DEPS_AUTO_CXX
)
1061 $(ELOG
) $(CCC
) $(OUTOPTION
)$@
-c
$(COMPILE_CXXFLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
1063 $(CMMOBJS
): $(OBJ_PREFIX
)%.
$(OBJ_SUFFIX
): %.mm
$(call mkdir_deps
,$(MDDEPDIR
))
1065 @
$(MAKE_DEPS_AUTO_CXX
)
1066 $(ELOG
) $(CCC
) -o
$@
-c
$(COMPILE_CXXFLAGS
) $(COMPILE_CMMFLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
1068 $(CMOBJS
): $(OBJ_PREFIX
)%.
$(OBJ_SUFFIX
): %.m
$(call mkdir_deps
,$(MDDEPDIR
))
1070 @
$(MAKE_DEPS_AUTO_CC
)
1071 $(ELOG
) $(CC
) -o
$@
-c
$(COMPILE_CFLAGS
) $(COMPILE_CMFLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
1073 %.s
: %.
cpp $(call mkdir_deps
,$(MDDEPDIR
))
1074 $(CCC
) -S
$(COMPILE_CXXFLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
1076 %.s
: %.
cc $(call mkdir_deps
,$(MDDEPDIR
))
1077 $(CCC
) -S
$(COMPILE_CXXFLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
1079 %.s
: %.c
$(call mkdir_deps
,$(MDDEPDIR
))
1080 $(CC
) -S
$(COMPILE_CFLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
1082 %.i
: %.
cpp $(call mkdir_deps
,$(MDDEPDIR
))
1083 $(CCC
) -C
-E
$(COMPILE_CXXFLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
) > $*.i
1085 %.i
: %.
cc $(call mkdir_deps
,$(MDDEPDIR
))
1086 $(CCC
) -C
-E
$(COMPILE_CXXFLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
) > $*.i
1088 %.i
: %.c
$(call mkdir_deps
,$(MDDEPDIR
))
1089 $(CC
) -C
-E
$(COMPILE_CFLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
) > $*.i
1091 %.i
: %.mm
$(call mkdir_deps
,$(MDDEPDIR
))
1092 $(CCC
) -C
-E
$(COMPILE_CXXFLAGS
) $(COMPILE_CMMFLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
) > $*.i
1095 @echo Creating Resource file
: $@
1096 ifeq ($(OS_ARCH
),OS2
)
1097 $(RC
) $(RCFLAGS
:-D
%=-d
%) -i
$(subst /,\
,$(srcdir)) -r
$< $@
1100 $(RC
) $(RCFLAGS
) $(filter-out -U
%,$(DEFINES
)) $(INCLUDES
:-I
%=--include-dir
%) $(OUTOPTION
)$@
$(_VPATH_SRCS
)
1102 $(RC
) $(RCFLAGS
) -r
$(DEFINES
) $(INCLUDES
) $(OUTOPTION
)$@
$(_VPATH_SRCS
)
1106 # need 3 separate lines for OS/2
1117 # Cancel these implicit rules
1127 ###############################################################################
1129 ###############################################################################
1130 ifneq (,$(filter OS2 WINNT
,$(OS_ARCH
)))
1137 SPACE
:= $(EMPTY
) $(EMPTY
)
1139 # MSYS has its own special path form, but javac expects the source and class
1140 # paths to be in the DOS form (i.e. e:/builds/...). This function does the
1141 # appropriate conversion on Windows, but is a noop on other systems.
1142 ifeq ($(HOST_OS_ARCH
),WINNT
)
1143 # We use 'pwd -W' to get DOS form of the path. However, since the given path
1144 # could be a file or a non-existent path, we cannot call 'pwd -W' directly
1145 # on the path. Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
1146 # on it, then merge with the rest of the path.
1147 root-path
= $(shell echo
$(1) | sed
-e
"s|\(/[^/]*\)/\?\(.*\)|\1|")
1148 non-root-path
= $(shell echo
$(1) | sed
-e
"s|\(/[^/]*\)/\?\(.*\)|\2|")
1149 normalizepath
= $(foreach p
,$(1),$(if
$(filter /%,$(1)),$(patsubst %/,%,$(shell cd
$(call root-path
,$(1)) && pwd
-W
))/$(call non-root-path
,$(1)),$(1)))
1151 normalizepath
= $(1)
1154 ifneq (,$(value JAVAFILES
)$(value RESFILES
))
1155 include $(topsrcdir
)/config
/makefiles
/java-build.mk
1158 _srcdir
= $(call normalizepath
,$(srcdir))
1159 ifdef JAVA_SOURCEPATH
1160 SP
= $(subst $(SPACE
),$(SEP
),$(call normalizepath
,$(strip $(JAVA_SOURCEPATH
))))
1161 _JAVA_SOURCEPATH
= ".$(SEP)$(_srcdir)$(SEP)$(SP)"
1163 _JAVA_SOURCEPATH
= ".$(SEP)$(_srcdir)"
1166 ifdef JAVA_CLASSPATH
1167 CP
= $(subst $(SPACE
),$(SEP
),$(call normalizepath
,$(strip $(JAVA_CLASSPATH
))))
1168 _JAVA_CLASSPATH
= ".$(SEP)$(CP)"
1177 $(_JAVA_DIR
)/%.class
: %.java
$(GLOBAL_DEPS
) $(_JAVA_DIR
)
1178 $(JAVAC
) $(JAVAC_FLAGS
) -classpath
$(_JAVA_CLASSPATH
) \
1179 -sourcepath
$(_JAVA_SOURCEPATH
) -d
$(_JAVA_DIR
) $(_VPATH_SRCS
)
1181 $(JAVA_LIBRARY
): $(addprefix $(_JAVA_DIR
)/,$(JAVA_SRCS
:.java
=.class
)) $(GLOBAL_DEPS
)
1182 $(JAR
) cf
$@
-C
$(_JAVA_DIR
) .
1184 GARBAGE_DIRS
+= $(_JAVA_DIR
)
1186 ###############################################################################
1187 # Update Files Managed by Build Backend
1188 ###############################################################################
1190 ifdef MOZBUILD_DERIVED
1192 # If this Makefile is derived from moz.build files, substitution for all .in
1193 # files is handled by SUBSTITUTE_FILES. This includes Makefile.in.
1194 ifneq ($(SUBSTITUTE_FILES
),,)
1195 $(SUBSTITUTE_FILES
): % : $(srcdir)/%.in
$(DEPTH
)/config
/autoconf.mk
1196 @
$(PYTHON
) $(DEPTH
)/config.status
-n
--file
=$@
1200 # Detect when the backend.mk needs rebuilt. This will cause a full scan and
1201 # rebuild. While relatively expensive, it should only occur once per recursion.
1202 ifneq ($(BACKEND_INPUT_FILES
),,)
1203 backend.mk
: $(BACKEND_INPUT_FILES
)
1204 @
$(PYTHON
) $(DEPTH
)/config.status
-n
1208 endif # MOZBUILD_DERIVED
1210 ifndef NO_MAKEFILE_RULE
1211 Makefile
: Makefile.in
1212 @
$(PYTHON
) $(DEPTH
)/config.status
-n
--file
=Makefile
1216 ifndef NO_SUBMAKEFILES_RULE
1218 # VPATH does not work on some machines in this case, so add $(srcdir)
1219 $(SUBMAKEFILES
): % : $(srcdir)/%.in
1220 $(PYTHON
) $(DEPTH
)$(addprefix /,$(subsrcdir
))/config.status
-n
--file
="$@"
1225 ifdef AUTOUPDATE_CONFIGURE
1226 $(topsrcdir
)/configure
: $(topsrcdir
)/configure.in
1227 (cd
$(topsrcdir
) && $(AUTOCONF
)) && $(PYTHON
) $(DEPTH
)/config.status
-n
--recheck
1230 $(DEPTH
)/config
/autoconf.mk
: $(topsrcdir
)/config
/autoconf.mk.in
1231 $(PYTHON
) $(DEPTH
)/config.status
-n
--file
=$(DEPTH
)/config
/autoconf.mk
1234 ###############################################################################
1235 # Bunch of things that extend the 'export' rule (in order):
1236 ###############################################################################
1238 ################################################################################
1239 # Copy each element of EXPORTS to $(DIST)/include
1241 ifneq ($(XPI_NAME
),)
1245 export:: $(FINAL_TARGET
)
1248 ifndef NO_DIST_INSTALL
1250 EXPORTS_FILES
:= $(EXPORTS
)
1251 EXPORTS_DEST
:= $(DIST
)/include
1252 EXPORTS_TARGET
:= export
1253 INSTALL_TARGETS
+= EXPORTS
1255 endif # NO_DIST_INSTALL
1257 define EXPORT_NAMESPACE_RULE
1258 ifndef NO_DIST_INSTALL
1259 EXPORTS_
$(namespace
)_FILES
:= $$(EXPORTS_
$(namespace
))
1260 EXPORTS_
$(namespace
)_DEST
:= $$(DIST
)/include/$(namespace
)
1261 EXPORTS_
$(namespace
)_TARGET
:= export
1262 INSTALL_TARGETS
+= EXPORTS_
$(namespace
)
1263 endif # NO_DIST_INSTALL
1266 $(foreach namespace
,$(EXPORTS_NAMESPACES
),$(eval
$(EXPORT_NAMESPACE_RULE
)))
1268 ################################################################################
1269 # Copy each element of PREF_JS_EXPORTS
1271 # The default location for PREF_JS_EXPORTS is the gre prefs directory.
1272 PREF_DIR
= defaults
/pref
1274 # If DIST_SUBDIR is defined it indicates that app and gre dirs are
1275 # different and that we are building app related resources. Hence,
1276 # PREF_DIR should point to the app prefs location.
1277 ifneq (,$(DIST_SUBDIR
)$(XPI_NAME
)$(LIBXUL_SDK
))
1278 PREF_DIR
= defaults
/preferences
1281 # on win32, pref files need CRLF line endings... see bug 206029
1282 ifeq (WINNT
,$(OS_ARCH
))
1283 PREF_PPFLAGS
+= --line-endings
=crlf
1286 # Set a flag that can be used in pref files to disable features if
1287 # we are not building for Aurora or Nightly.
1288 ifeq (,$(findstring a
,$(GRE_MILESTONE
)))
1289 PREF_PPFLAGS
+= -DRELEASE_BUILD
1292 ifneq ($(PREF_JS_EXPORTS
),)
1293 ifndef NO_DIST_INSTALL
1294 PREF_JS_EXPORTS_PATH
:= $(FINAL_TARGET
)/$(PREF_DIR
)
1295 PREF_JS_EXPORTS_FLAGS
:= $(PREF_PPFLAGS
)
1296 PP_TARGETS
+= PREF_JS_EXPORTS
1300 ################################################################################
1301 # Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
1303 ifneq ($(AUTOCFG_JS_EXPORTS
),)
1304 ifndef NO_DIST_INSTALL
1305 AUTOCFG_JS_EXPORTS_FILES
:= $(AUTOCFG_JS_EXPORTS
)
1306 AUTOCFG_JS_EXPORTS_DEST
:= $(FINAL_TARGET
)/defaults
/autoconfig
1307 AUTOCFG_JS_EXPORTS_TARGET
:= export
1308 INSTALL_TARGETS
+= AUTOCFG_JS_EXPORTS
1312 ################################################################################
1313 # Export the elements of $(XPIDLSRCS)
1314 # generating .h and .xpt files and moving them to the appropriate places.
1316 ifneq ($(XPIDLSRCS
),) #{
1318 export:: $(patsubst %.idl
,$(XPIDL_GEN_DIR
)/%.h
, $(XPIDLSRCS
))
1321 XPIDL_MODULE
= $(MODULE
)
1324 ifeq ($(XPIDL_MODULE
),) # we need $(XPIDL_MODULE) to make $(XPIDL_MODULE).xpt
1327 @echo
"*** Error processing XPIDLSRCS:"
1328 @echo
"Please define MODULE or XPIDL_MODULE when defining XPIDLSRCS,"
1329 @echo
"so we have a module name to use when creating MODULE.xpt."
1330 @echo
; sleep
2; false
1333 # generate .h files from into $(XPIDL_GEN_DIR), then export to $(DIST)/include;
1334 # warn against overriding existing .h file.
1337 $(LIBXUL_DIST
)/sdk
/bin
/header.py \
1338 $(LIBXUL_DIST
)/sdk
/bin
/typelib.py \
1339 $(LIBXUL_DIST
)/sdk
/bin
/xpidl.py \
1343 $(call mkdir_deps
,$(XPIDL_GEN_DIR
)) \
1344 $(call mkdir_deps
,$(MDDEPDIR
)) \
1347 $(XPIDL_GEN_DIR
)/%.h
: %.idl
$(XPIDL_DEPS
) $(xpidl-preqs
)
1351 $(LIBXUL_DIST
)/sdk
/bin
/header.py
$(XPIDL_FLAGS
) $(_VPATH_SRCS
) -d
$(MDDEPDIR
)/$(@F
).pp
-o
$@
1352 @if
test -n
"$(findstring $*.h, $(EXPORTS))"; \
1353 then echo
"*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true
; fi
1355 # generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link
1356 # into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
1357 $(XPIDL_GEN_DIR
)/%.xpt
: %.idl
$(XPIDL_DEPS
) $(xpidl-preqs
)
1361 -I
$(topsrcdir
)/xpcom
/typelib
/xpt
/tools \
1362 $(LIBXUL_DIST
)/sdk
/bin
/typelib.py
$(XPIDL_FLAGS
) $(_VPATH_SRCS
) -d
$(MDDEPDIR
)/$(@F
).pp
-o
$@
1364 # no need to link together if XPIDLSRCS contains only XPIDL_MODULE
1365 ifneq ($(XPIDL_MODULE
).idl
,$(strip $(XPIDLSRCS
)))
1366 XPT_PY
= $(filter %/xpt.py
,$(XPIDL_LINK
))
1368 xpidl-idl2xpt
= $(patsubst %.idl
,$(XPIDL_GEN_DIR
)/%.xpt
,$(XPIDLSRCS
))
1369 xpidl-module-deps
= $(xpidl-idl2xpt
) $(GLOBAL_DEPS
) $(XPT_PY
)
1371 $(XPIDL_GEN_DIR
)/$(XPIDL_MODULE
).xpt
: $(xpidl-module-deps
)
1372 $(XPIDL_LINK
) $@
$(xpidl-idl2xpt
)
1375 $(MAKE
) -C
$(DEPTH
)/xpcom
/typelib
/xpt
/tools libs
1377 endif # XPIDL_MODULE.xpt != XPIDLSRCS
1379 ifndef NO_DIST_INSTALL
1380 XPIDL_MODULE_FILES
:= $(XPIDL_GEN_DIR
)/$(XPIDL_MODULE
).xpt
1381 XPIDL_MODULE_DEST
:= $(FINAL_TARGET
)/components
1382 INSTALL_TARGETS
+= XPIDL_MODULE
1384 ifndef NO_INTERFACES_MANIFEST
1385 libs
:: $(call mkdir_deps
,$(FINAL_TARGET
)/components
)
1386 @
$(PYTHON
) $(MOZILLA_DIR
)/config
/buildlist.py
$(FINAL_TARGET
)/components
/interfaces.manifest
"interfaces $(XPIDL_MODULE).xpt"
1387 @
$(PYTHON
) $(MOZILLA_DIR
)/config
/buildlist.py
$(FINAL_TARGET
)/chrome.manifest
"manifest components/interfaces.manifest"
1391 GARBAGE_DIRS
+= $(XPIDL_GEN_DIR
)
1393 ifndef NO_DIST_INSTALL
1394 XPIDL_HEADERS_FILES
:= $(patsubst %.idl
,$(XPIDL_GEN_DIR
)/%.h
, $(XPIDLSRCS
))
1395 XPIDL_HEADERS_DEST
:= $(DIST
)/include
1396 XPIDL_HEADERS_TARGET
:= export
1397 INSTALL_TARGETS
+= XPIDL_HEADERS
1399 XPIDLSRCS_FILES
:= $(XPIDLSRCS
)
1400 XPIDLSRCS_DEST
:= $(IDL_DIR
)
1401 XPIDLSRCS_TARGET
:= export
1402 INSTALL_TARGETS
+= XPIDLSRCS
1406 ################################################################################
1407 # Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
1408 ifneq (,$(filter %.js
,$(EXTRA_COMPONENTS
) $(EXTRA_PP_COMPONENTS
)))
1409 ifeq (,$(filter %.manifest
,$(EXTRA_COMPONENTS
) $(EXTRA_PP_COMPONENTS
)))
1410 ifndef NO_JS_MANIFEST
1411 $(error .js component without matching .manifest. See https
://developer.mozilla.org
/en
/XPCOM
/XPCOM_changes_in_Gecko_2.0
)
1416 ifdef EXTRA_COMPONENTS
1417 libs
:: $(EXTRA_COMPONENTS
)
1418 ifndef NO_DIST_INSTALL
1419 EXTRA_COMPONENTS_FILES
:= $(EXTRA_COMPONENTS
)
1420 EXTRA_COMPONENTS_DEST
:= $(FINAL_TARGET
)/components
1421 INSTALL_TARGETS
+= EXTRA_COMPONENTS
1426 ifdef EXTRA_PP_COMPONENTS
1427 ifndef NO_DIST_INSTALL
1428 EXTRA_PP_COMPONENTS_PATH
:= $(FINAL_TARGET
)/components
1429 PP_TARGETS
+= EXTRA_PP_COMPONENTS
1433 EXTRA_MANIFESTS
= $(filter %.manifest
,$(EXTRA_COMPONENTS
) $(EXTRA_PP_COMPONENTS
))
1434 ifneq (,$(EXTRA_MANIFESTS
))
1435 libs
:: $(call mkdir_deps
,$(FINAL_TARGET
))
1436 $(PYTHON
) $(MOZILLA_DIR
)/config
/buildlist.py
$(FINAL_TARGET
)/chrome.manifest
$(patsubst %,"manifest components/%",$(notdir $(EXTRA_MANIFESTS
)))
1439 ################################################################################
1440 # Copy each element of EXTRA_JS_MODULES to JS_MODULES_PATH, or
1441 # $(FINAL_TARGET)/modules if that isn't defined.
1442 JS_MODULES_PATH ?
= $(FINAL_TARGET
)/modules
1444 ifdef EXTRA_JS_MODULES
1445 ifndef NO_DIST_INSTALL
1446 EXTRA_JS_MODULES_FILES
:= $(EXTRA_JS_MODULES
)
1447 EXTRA_JS_MODULES_DEST
:= $(JS_MODULES_PATH
)
1448 INSTALL_TARGETS
+= EXTRA_JS_MODULES
1452 ifdef EXTRA_PP_JS_MODULES
1453 ifndef NO_DIST_INSTALL
1454 EXTRA_PP_JS_MODULES_PATH
:= $(JS_MODULES_PATH
)
1455 PP_TARGETS
+= EXTRA_PP_JS_MODULES
1459 ################################################################################
1460 # Copy testing-only JS modules to appropriate destination.
1462 # For each file defined in TESTING_JS_MODULES, copy it to
1463 # objdir/_tests/modules/. If TESTING_JS_MODULE_DIR is defined, that path
1464 # wlll be appended to the output directory.
1467 ifdef TESTING_JS_MODULES
1468 testmodulesdir
= $(DEPTH
)/_tests
/modules
/$(TESTING_JS_MODULE_DIR
)
1470 GENERATED_DIRS
+= $(testmodulesdir
)
1472 ifndef NO_DIST_INSTALL
1473 TESTING_JS_MODULES_FILES
:= $(TESTING_JS_MODULES
)
1474 TESTING_JS_MODULES_DEST
:= $(testmodulesdir
)
1475 INSTALL_TARGETS
+= TESTING_JS_MODULES
1481 ################################################################################
1484 ifneq (,$(SDK_LIBRARY
))
1485 ifndef NO_DIST_INSTALL
1486 SDK_LIBRARY_FILES
:= $(SDK_LIBRARY
)
1487 SDK_LIBRARY_DEST
:= $(SDK_LIB_DIR
)
1488 INSTALL_TARGETS
+= SDK_LIBRARY
1492 ifneq (,$(strip $(SDK_BINARY
)))
1493 ifndef NO_DIST_INSTALL
1494 SDK_BINARY_FILES
:= $(SDK_BINARY
)
1495 SDK_BINARY_DEST
:= $(SDK_BIN_DIR
)
1496 INSTALL_TARGETS
+= SDK_BINARY
1500 ################################################################################
1503 JAR_MANIFEST
:= $(srcdir)/jar.mn
1507 $(LOOP_OVER_PARALLEL_DIRS
)
1509 $(LOOP_OVER_TOOL_DIRS
)
1511 $(FINAL_TARGET
)/chrome
: $(call mkdir_deps
,$(FINAL_TARGET
)/chrome
)
1513 ifneq (,$(wildcard $(JAR_MANIFEST
)))
1514 ifndef NO_DIST_INSTALL
1517 ifdef XPI_ROOT_APPID
1518 # For add-on packaging we may specify that an application
1519 # sub-dir should be added to the root chrome manifest with
1520 # a specific application id.
1521 MAKE_JARS_FLAGS
+= --root-manifest-entry-appid
="$(XPI_ROOT_APPID)"
1524 # if DIST_SUBDIR is defined but XPI_ROOT_APPID is not there's
1525 # no way langpacks will get packaged right, so error out.
1526 ifneq (,$(DIST_SUBDIR
))
1527 ifndef XPI_ROOT_APPID
1528 $(error XPI_ROOT_APPID is not defined
- langpacks will break.
)
1533 libs realchrome
:: $(CHROME_DEPS
) $(FINAL_TARGET
)/chrome
1534 $(PYTHON
) $(MOZILLA_DIR
)/config
/JarMaker.py \
1535 $(QUIET
) -j
$(FINAL_TARGET
)/chrome \
1536 $(MAKE_JARS_FLAGS
) $(XULPPFLAGS
) $(DEFINES
) $(ACDEFINES
) \
1542 ifneq ($(DIST_FILES
),)
1543 DIST_FILES_PATH
:= $(FINAL_TARGET
)
1544 DIST_FILES_FLAGS
:= $(XULAPP_DEFINES
)
1545 PP_TARGETS
+= DIST_FILES
1548 ifneq ($(DIST_CHROME_FILES
),)
1549 DIST_CHROME_FILES_PATH
:= $(FINAL_TARGET
)/chrome
1550 DIST_CHROME_FILES_FLAGS
:= $(XULAPP_DEFINES
)
1551 PP_TARGETS
+= DIST_CHROME_FILES
1554 ifneq ($(XPI_PKGNAME
),)
1558 @echo
"Stripping $(XPI_PKGNAME) package directory..."
1559 @echo
$(FINAL_TARGET
)
1560 @cd
$(FINAL_TARGET
) && find .
! -type d \
1570 ! -name
"*.properties" \
1581 $(PLATFORM_EXCLUDE_LIST
) \
1582 -exec
$(STRIP
) $(STRIP_FLAGS
) {} >/dev
/null
2>&1 \
;
1585 @echo
"Packaging $(XPI_PKGNAME).xpi..."
1586 cd
$(FINAL_TARGET
) && $(ZIP
) -qr ..
/$(XPI_PKGNAME
).xpi
*
1589 ifdef INSTALL_EXTENSION_ID
1591 $(error XPI_NAME must be set for INSTALL_EXTENSION_ID
)
1595 $(RM
) -r
"$(DIST)/bin$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)"
1596 $(NSINSTALL
) -D
"$(DIST)/bin$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)"
1597 $(call copy_dir
,$(FINAL_TARGET
),$(DIST
)/bin
$(DIST_SUBDIR
:%=/%)/extensions
/$(INSTALL_EXTENSION_ID
))
1601 #############################################################################
1602 # MDDEPDIR is the subdirectory where all the dependency files are placed.
1603 # This uses a make rule (instead of a macro) to support parallel
1604 # builds (-jN). If this were done in the LOOP_OVER_DIRS macro, two
1605 # processes could simultaneously try to create the same directory.
1607 # We use $(CURDIR) in the rule's target to ensure that we don't find
1608 # a dependency directory in the source tree via VPATH (perhaps from
1609 # a previous build in the source tree) and thus neglect to create a
1610 # dependency directory in the object directory, where we really need
1613 ifneq (,$(filter-out all chrome default
export realchrome tools
clean clobber clobber_all
distclean realclean,$(MAKECMDGOALS
)))
1614 MDDEPEND_FILES
:= $(strip $(wildcard $(foreach file
,$(OBJS
) $(PROGOBJS
) $(HOST_OBJS
) $(HOST_PROGOBJS
) $(TARGETS
) $(XPIDLSRCS
:.idl
=.h
) $(XPIDLSRCS
:.idl
=.xpt
),$(MDDEPDIR
)/$(notdir $(file
)).pp
) $(addprefix $(MDDEPDIR
)/,$(EXTRA_MDDEPEND_FILES
))))
1616 ifneq (,$(MDDEPEND_FILES
))
1617 # The script mddepend.pl checks the dependencies and writes to stdout
1618 # one rule to force out-of-date objects. For example,
1619 # foo.o boo.o: FORCE
1620 # The script has an advantage over including the *.pp files directly
1621 # because it handles the case when header files are removed from the build.
1622 # 'make' would complain that there is no way to build missing headers.
1623 ALL_PP_RESULTS
= $(shell $(PERL
) $(BUILD_TOOLS
)/mddepend.pl
- $(MDDEPEND_FILES
))
1624 $(eval
$(ALL_PP_RESULTS
))
1628 #############################################################################
1630 -include $(topsrcdir
)/$(MOZ_BUILD_APP
)/app-rules.mk
1631 -include $(MY_RULES
)
1634 # Generate Emacs tags in a file named TAGS if ETAGS was set in $(MY_CONFIG)
1638 ifneq ($(CSRCS
)$(CPPSRCS
)$(HEADERS
),)
1640 TAGS
:: $(CSRCS
) $(CPPSRCS
) $(HEADERS
)
1641 $(ETAGS
) $(CSRCS
) $(CPPSRCS
) $(HEADERS
)
1645 ################################################################################
1646 # Install/copy rules
1648 # The INSTALL_TARGETS variable contains a list of all install target
1649 # categories. Each category defines a list of files and executables, and an
1650 # install destination,
1652 # FOO_FILES := foo bar
1653 # FOO_EXECUTABLES := baz
1654 # FOO_DEST := target_path
1655 # INSTALL_TARGETS += FOO
1657 # Additionally, a FOO_TARGET variable may be added to indicate the target for
1658 # which the files and executables are installed. Default is "libs".
1660 # If we're using binary nsinstall and it's not built yet, fallback to python nsinstall.
1661 ifneq (,$(filter $(CONFIG_TOOLS
)/nsinstall
$(HOST_BIN_SUFFIX
),$(install_cmd
)))
1662 ifeq (,$(wildcard $(CONFIG_TOOLS
)/nsinstall
$(HOST_BIN_SUFFIX
)))
1663 nsinstall_is_usable
= $(if
$(wildcard $(CONFIG_TOOLS
)/nsinstall
$(HOST_BIN_SUFFIX
)),yes
)
1665 define install_cmd_override
1666 $(1): install_cmd
= $$(if
$$(nsinstall_is_usable
),$$(INSTALL
),$$(NSINSTALL_PY
)) $$(1)
1671 define install_file_template
1672 $(or
$(3),libs
):: $(2)/$(notdir $(1))
1673 $(call install_cmd_override
,$(2)/$(notdir $(1)))
1674 $(2)/$(notdir $(1)): $(1)
1675 $$(call install_cmd
,$(4) "$$<" "$${@D}")
1677 $(foreach category
,$(INSTALL_TARGETS
),\
1678 $(if
$($(category
)_DEST
),,$(error Missing
$(category
)_DEST
))\
1679 $(foreach file
,$($(category
)_FILES
),\
1680 $(eval
$(call install_file_template
,$(file
),$($(category
)_DEST
),$($(category
)_TARGET
),$(IFLAGS1
)))\
1682 $(foreach file
,$($(category
)_EXECUTABLES
),\
1683 $(eval
$(call install_file_template
,$(file
),$($(category
)_DEST
),$($(category
)_TARGET
),$(IFLAGS2
)))\
1687 ################################################################################
1688 # Preprocessing rules
1690 # The PP_TARGETS variable contains a list of all preprocessing target
1691 # categories. Each category has associated variables listing input files, the
1692 # output directory, extra preprocessor flags, and so on. For example:
1695 # FOO_PATH := target-directory
1696 # FOO_FLAGS := -Dsome_flag
1699 # If PP_TARGETS lists a category name <C> (like FOO, above), then we consult the
1700 # following make variables to see what to do:
1702 # - <C> lists input files to be preprocessed with config/Preprocessor.py. We
1703 # search VPATH for the names given here. If an input file name ends in '.in',
1704 # that suffix is omitted from the output file name.
1706 # - <C>_PATH names the directory in which to place the preprocessed output
1707 # files. We create this directory if it does not already exist. Setting
1708 # this variable is optional; if unset, we install the files in $(CURDIR).
1710 # - <C>_FLAGS lists flags to pass to Preprocessor.py, in addition to the usual
1711 # bunch. Setting this variable is optional.
1713 # - <C>_TARGET names the 'make' target that should depend on creating the output
1714 # files. Setting this variable is optional; if unset, we preprocess the
1715 # files for the 'libs' target.
1717 # preprocess_file_template defines preprocessing rules.
1718 # $(call preprocess_file_template, source_file, output_file,
1719 # makefile_target, extra_flags)
1720 define preprocess_file_template
1721 $(2): $(1) $$(GLOBAL_DEPS
)
1723 $$(PYTHON
) $$(topsrcdir
)/config
/Preprocessor.py
$(4) $$(DEFINES
) $$(ACDEFINES
) $$(XULPPFLAGS
) "$$<" -o
"$$@"
1727 $(foreach category
,$(PP_TARGETS
), \
1728 $(foreach file
,$($(category
)), \
1729 $(eval
$(call preprocess_file_template
, \
1731 $(or
$($(category
)_PATH
),$(CURDIR
))/$(notdir $(file
:.in
=)), \
1732 $(or
$($(category
)_TARGET
),libs
), \
1733 $($(category
)_FLAGS
))) \
1737 ################################################################################
1738 # Special gmake rules.
1739 ################################################################################
1743 # Re-define the list of default suffixes, so gmake won't have to churn through
1744 # hundreds of built-in suffix rules for stuff we don't need.
1749 # Fake targets. Always run these rules, even if a file/directory with that
1750 # name already exists.
1752 .PHONY
: all alltags boot checkout chrome realchrome
clean clobber clobber_all
export install libs makefiles
realclean run_apprunner tools
$(DIRS
) $(TOOL_DIRS
) FORCE
1754 # Used as a dependency to force targets to rebuild
1757 # Delete target if error occurs when building target
1762 TAGS
: $(SUBMAKEFILES
) $(CSRCS
) $(CPPSRCS
) $(wildcard *.h
)
1763 -etags
$(CSRCS
) $(CPPSRCS
) $(wildcard *.h
)
1764 $(LOOP_OVER_PARALLEL_DIRS
)
1767 ifndef INCLUDED_DEBUGMAKE_MK
#{
1768 ## Only parse when an echo* or show* target is requested
1769 ifneq (,$(call isTargetStem
,echo
,show
))
1770 include $(topsrcdir
)/config
/makefiles
/debugmake.mk
1776 $(DOXYGEN
) $(DEPTH
)/config
/doxygen.cfg
1779 check:: $(SUBMAKEFILES
) $(MAKE_DIRS
)
1780 $(LOOP_OVER_PARALLEL_DIRS
)
1782 $(LOOP_OVER_TOOL_DIRS
)
1786 FREEZE_VARIABLES
= \
1797 EXTRA_PP_COMPONENTS \
1799 MOCHITEST_FILES_PARTS \
1800 MOCHITEST_CHROME_FILES \
1801 MOCHITEST_BROWSER_FILES \
1802 MOCHITEST_BROWSER_FILES_PARTS \
1803 MOCHITEST_A11Y_FILES \
1804 MOCHITEST_ROBOCOP_FILES \
1805 MOCHITEST_WEBAPPRT_CHROME_FILES \
1808 $(foreach var
,$(FREEZE_VARIABLES
),$(eval
$(var
)_FROZEN
:= '$($(var))'))
1810 CHECK_FROZEN_VARIABLES
= $(foreach var
,$(FREEZE_VARIABLES
), \
1811 $(if
$(subst $($(var
)_FROZEN
),,'$($(var))'),$(error Makefile variable
'$(var)' changed value after including rules.mk. Was
$($(var
)_FROZEN
), now
$($(var
)).
)))
1814 $(CHECK_FROZEN_VARIABLES
)
1816 PURGECACHES_DIRS ?
= $(DIST
)/bin
1817 ifdef MOZ_WEBAPP_RUNTIME
1818 PURGECACHES_DIRS
+= $(DIST
)/bin
/webapprt
1821 PURGECACHES_FILES
= $(addsuffix /.purgecaches
,$(PURGECACHES_DIRS
))
1823 default
all:: $(PURGECACHES_FILES
)
1825 $(PURGECACHES_FILES
):
1826 if
test -d
$(@D
) ; then touch
$@
; fi
1828 .DEFAULT_GOAL ?
= default
1830 #############################################################################
1831 # Derived targets and dependencies
1833 include $(topsrcdir
)/config
/makefiles
/autotargets.mk
1834 ifneq ($(NULL
),$(AUTO_DEPS
))
1835 default
all libs tools
export:: $(AUTO_DEPS
)