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
)
23 ifndef INCLUDED_CONFIG_MK
24 include $(topsrcdir
)/config
/config.mk
27 ifndef INCLUDED_VERSION_MK
28 include $(MOZILLA_DIR
)/config
/version.mk
31 USE_AUTOTARGETS_MK
= 1
32 include $(MOZILLA_DIR
)/config
/makefiles
/makeutils.mk
35 REPORT_BUILD
= $(info $(shell $(PYTHON
) $(MOZILLA_DIR
)/config
/rebuild_check.py
$@
$^
))
37 REPORT_BUILD
= $(info $(notdir $@
))
42 # ELOG prints out failed command when building silently (gmake -s). Pymake
43 # prints out failed commands anyway, so ELOG just makes things worse by
44 # forcing shell invocations.
45 ifneq (,$(findstring s
, $(filter-out --%, $(MAKEFLAGS
))))
46 ELOG
:= $(EXEC
) sh
$(BUILD_TOOLS
)/print-failed-commands.sh
51 _VPATH_SRCS
= $(abspath
$<)
53 ################################################################################
54 # Testing frameworks support
55 ################################################################################
57 testxpcobjdir
= $(DEPTH
)/_tests
/xpcshell
61 # Add test directories to the regular directories list. TEST_DIRS should
62 # arguably have the same status as other *_DIRS variables. It is coded this way
63 # until Makefiles stop using the "ifdef ENABLE_TESTS; DIRS +=" convention.
65 # The current developer workflow expects tests to be updated when processing
66 # the default target. If we ever change this implementation, the behavior
67 # should be preserved or the change should be widely communicated. A
68 # consequence of not processing test dir targets during the default target is
69 # that changes to tests may not be updated and code could assume to pass
70 # locally against non-current test code.
74 ifdef COMPILE_ENVIRONMENT
76 # Compile the tests to $(DIST)/bin. Make lots of niceties available by default
77 # through TestHarness.h, by modifying the list of includes and the libs against
79 SIMPLE_PROGRAMS
+= $(CPP_UNIT_TESTS
)
80 INCLUDES
+= -I
$(DIST
)/include/testing
82 ifndef MOZ_PROFILE_GENERATE
83 CPP_UNIT_TESTS_FILES
= $(CPP_UNIT_TESTS
)
84 CPP_UNIT_TESTS_DEST
= $(DIST
)/cppunittests
85 CPP_UNIT_TESTS_TARGET
= target
86 INSTALL_TARGETS
+= CPP_UNIT_TESTS
90 @
$(PYTHON
) $(MOZILLA_DIR
)/testing
/runcppunittests.py
--xre-path
=$(DIST
)/bin
--symbols-path
=$(DIST
)/crashreporter-symbols
$(CPP_UNIT_TESTS
)
92 cppunittests-remote
: DM_TRANS?
=adb
94 @if
[ '${TEST_DEVICE}' != '' -o
'$(DM_TRANS)' = 'adb' ]; then \
95 $(PYTHON
) -u
$(MOZILLA_DIR
)/testing
/remotecppunittests.py \
96 --xre-path
=$(DEPTH
)/dist/bin \
97 --localLib
=$(DEPTH
)/dist/$(MOZ_APP_NAME
) \
98 --dm_trans
=$(DM_TRANS
) \
99 --deviceIP
=${TEST_DEVICE} \
100 $(CPP_UNIT_TESTS
) $(EXTRA_TEST_ARGS
); \
102 echo
'please prepare your host with environment variables for TEST_DEVICE'; \
105 endif # COMPILE_ENVIRONMENT
106 endif # CPP_UNIT_TESTS
110 ifdef PYTHON_UNIT_TESTS
112 RUN_PYTHON_UNIT_TESTS
:= $(addsuffix -run
,$(PYTHON_UNIT_TESTS
))
114 .PHONY
: $(RUN_PYTHON_UNIT_TESTS
)
116 check:: $(RUN_PYTHON_UNIT_TESTS
)
118 $(RUN_PYTHON_UNIT_TESTS
): %-run
: %
119 @PYTHONDONTWRITEBYTECODE
=1 $(PYTHON
) $<
121 endif # PYTHON_UNIT_TESTS
129 # If FORCE_STATIC_LIB is set, build a static library.
130 # Otherwise, build a shared library.
135 # Don't build actual static library if a shared library is also built
136 ifdef FORCE_SHARED_LIB
137 # ... except when we really want one
139 LIBRARY
:= $(REAL_LIBRARY
)
141 LIBRARY
:= $(REAL_LIBRARY
).
$(LIBS_DESC_SUFFIX
)
144 # Only build actual library if it is installed in DIST/lib or SDK
145 ifeq (,$(SDK_LIBRARY
)$(DIST_INSTALL
)$(NO_EXPAND_LIBS
))
146 LIBRARY
:= $(REAL_LIBRARY
).
$(LIBS_DESC_SUFFIX
)
149 LIBRARY
:= $(REAL_LIBRARY
)
151 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
$(MOZILLA_DIR
)/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
481 ifeq ($(OS_ARCH
),WINNT
)
484 DSO_LDOPTS
+= -Wl
,--out-implib
-Wl
,$(IMPORT_LIBRARY
)
497 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
499 PREPROCESS_OPTION
= -P
-Fi
# eol
502 PREPROCESS_OPTION
= -E
-o
#eol
503 endif # WINNT && !GNU_CC
505 ifneq (,$(filter ml
%,$(AS
)))
506 ASOUTOPTION
= -Fo
# eol
508 ASOUTOPTION
= -o
# eol
511 ifeq (,$(CROSS_COMPILE
))
512 HOST_OUTOPTION
= $(OUTOPTION
)
514 HOST_OUTOPTION
= -o
# eol
516 ################################################################################
518 # Ensure the build config is up to date. This is done automatically when builds
519 # are performed through |mach build|. The check here is to catch people not
520 # using mach. If we ever enforce builds through mach, this code can be removed.
521 ifndef MOZBUILD_BACKEND_CHECKED
523 ifndef TOPLEVEL_BUILD
524 $(DEPTH
)/backend.RecursiveMakeBackend
:
525 $(error Build configuration changed. Build with |mach build| or run |mach build-backend| to regenerate build config
)
527 include $(DEPTH
)/backend.RecursiveMakeBackend.pp
529 default
:: $(DEPTH
)/backend.RecursiveMakeBackend
531 export MOZBUILD_BACKEND_CHECKED
=1
536 # The root makefile doesn't want to do a plain export/libs, because
537 # of the tiers and because of libxul. Suppress the default rules in favor
538 # of something else. Makefiles which use this var *must* provide a sensible
539 # default rule before including rules.mk
541 $(foreach tier
,$(TIERS
),$(call SUBMAKE
,$(tier
)))
543 ifeq ($(findstring s
,$(filter-out --%, $(MAKEFLAGS
))),)
551 # Do everything from scratch
556 STATIC_LIB_DEP
= $(if
$(wildcard $(1).
$(LIBS_DESC_SUFFIX
)),$(1).
$(LIBS_DESC_SUFFIX
),$(1))
557 STATIC_LIBS_DEPS
:= $(foreach l
,$(STATIC_LIBS
),$(call STATIC_LIB_DEP
,$(l
)))
559 # Dependencies which, if modified, should cause everything to rebuild
560 GLOBAL_DEPS
+= Makefile
$(addprefix $(DEPTH
)/config
/,$(INCLUDED_AUTOCONF_MK
)) $(MOZILLA_DIR
)/config
/config.mk
562 ##############################################
563 ifdef COMPILE_ENVIRONMENT
564 OBJ_TARGETS
= $(OBJS
) $(PROGOBJS
) $(HOST_OBJS
) $(HOST_PROGOBJS
)
566 compile
:: host target
568 host
:: $(HOST_LIBRARY
) $(HOST_PROGRAM
) $(HOST_SIMPLE_PROGRAMS
)
570 target
:: $(LIBRARY
) $(SHARED_LIBRARY
) $(PROGRAM
) $(SIMPLE_PROGRAMS
)
572 include $(MOZILLA_DIR
)/config
/makefiles
/target_binaries.mk
575 ##############################################
576 ifneq (1,$(NO_PROFILE_GUIDED_OPTIMIZE
))
577 ifdef MOZ_PROFILE_USE
578 ifeq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
579 # When building with PGO, we have to make sure to re-link
580 # in the MOZ_PROFILE_USE phase if we linked in the
581 # MOZ_PROFILE_GENERATE phase. We'll touch this pgo.relink
582 # file in the link rule in the GENERATE phase to indicate
583 # that we need a relink.
585 $(SHARED_LIBRARY
): pgo.relink
588 $(PROGRAM
): pgo.relink
591 # In the second pass, we need to merge the pgc files into the pgd file.
592 # The compiler would do this for us automatically if they were in the right
593 # place, but they're in dist/bin.
594 ifneq (,$(SHARED_LIBRARY
)$(PROGRAM
))
597 $(PYTHON
) $(MOZILLA_DIR
)/build
/win32
/pgomerge.py \
598 $(PROGRAM
:$(BIN_SUFFIX
)=) $(DIST
)/bin
601 $(PYTHON
) $(MOZILLA_DIR
)/build
/win32
/pgomerge.py \
602 $(patsubst $(DLL_PREFIX
)%$(DLL_SUFFIX
),%,$(SHARED_LIBRARY
)) $(DIST
)/bin
604 endif # SHARED_LIBRARY || PROGRAM
606 endif # MOZ_PROFILE_USE
607 ifdef MOZ_PROFILE_GENERATE
608 # Clean up profiling data during PROFILE_GENERATE phase
610 ifeq ($(OS_ARCH
)_
$(GNU_CC
), WINNT_
)
611 $(foreach pgd
,$(wildcard *.pgd
),pgomgr
-clear
$(pgd
);)
619 ifneq (,$(MOZ_PROFILE_GENERATE
)$(MOZ_PROFILE_USE
))
621 # Force rebuilding libraries and programs in both passes because each
622 # pass uses different object files.
623 $(PROGRAM
) $(SHARED_LIBRARY
) $(LIBRARY
): FORCE
627 endif # NO_PROFILE_GUIDED_OPTIMIZE
629 ##############################################
632 $(MAKE
) -C
$(topsrcdir
) -f client.mk checkout
634 clean clobber realclean clobber_all
::
636 -$(RM
) -r
$(ALL_TRASH_DIRS
)
638 clean clobber realclean clobber_all
distclean::
639 $(foreach dir,$(DIRS
),-$(call SUBMAKE
,$@
,$(dir)))
642 -$(RM
) -r
$(ALL_TRASH_DIRS
)
643 -$(RM
) $(ALL_TRASH
) \
644 Makefile .HSancillary \
645 $(wildcard *.
$(OBJ_SUFFIX
)) $(wildcard *.ho
) $(wildcard host_
*.o
*) \
646 $(wildcard *.
$(LIB_SUFFIX
)) $(wildcard *$(DLL_SUFFIX
)) \
647 $(wildcard *.
$(IMPORT_LIB_SUFFIX
))
651 find
$(topsrcdir
) -name
dist -prune
-o \
( -name
'*.[hc]' -o
-name
'*.cp' -o
-name
'*.cpp' -o
-name
'*.idl' \
) -print |
$(TAG_PROGRAM
)
655 # creates OBJS, links with LIBS to create Foo
657 $(PROGRAM
): $(PROGOBJS
) $(STATIC_LIBS_DEPS
) $(EXTRA_DEPS
) $(EXE_DEF_FILE
) $(RESFILE
) $(GLOBAL_DEPS
)
660 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
661 $(EXPAND_LD
) -NOLOGO
-OUT
:$@
-PDB
:$(LINK_PDBFILE
) $(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(MOZ_PROGRAM_LDFLAGS
) $(PROGOBJS
) $(RESFILE
) $(STATIC_LIBS
) $(SHARED_LIBS
) $(EXTRA_LIBS
) $(OS_LIBS
)
662 ifdef MSMANIFEST_TOOL
663 @if
test -f
$@.manifest
; then \
664 if
test -f
'$(srcdir)/$@.manifest'; then \
665 echo
'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
666 mt.exe
-NOLOGO
-MANIFEST
'$(win_srcdir)/$@.manifest' $@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
668 echo
'Embedding manifest from $@.manifest'; \
669 mt.exe
-NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
671 elif
test -f
'$(srcdir)/$@.manifest'; then \
672 echo
'Embedding manifest from $(srcdir)/$@.manifest'; \
673 mt.exe
-NOLOGO
-MANIFEST
'$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE
:$@\
;1; \
675 endif # MSVC with manifest tool
676 ifdef MOZ_PROFILE_GENERATE
677 # touch it a few seconds into the future to work around FAT's
678 # 2-second granularity
679 touch
-t
`date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
681 else # !WINNT || GNU_CC
682 $(EXPAND_CCC
) -o
$@
$(CXXFLAGS
) $(PROGOBJS
) $(RESFILE
) $(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(WRAP_LDFLAGS
) $(STATIC_LIBS
) $(MOZ_PROGRAM_LDFLAGS
) $(SHARED_LIBS
) $(EXTRA_LIBS
) $(OS_LIBS
) $(BIN_FLAGS
) $(EXE_DEF_FILE
)
683 $(call CHECK_BINARY
,$@
)
684 endif # WINNT && !GNU_CC
687 $(STRIP
) $(STRIP_FLAGS
) $@
689 ifdef MOZ_POST_PROGRAM_COMMAND
690 $(MOZ_POST_PROGRAM_COMMAND
) $@
693 $(HOST_PROGRAM
): $(HOST_PROGOBJS
) $(HOST_LIBS
) $(HOST_EXTRA_DEPS
) $(GLOBAL_DEPS
)
695 ifeq (_WINNT
,$(GNU_CC
)_
$(HOST_OS_ARCH
))
696 $(EXPAND_LIBS_EXEC
) -- $(HOST_LD
) -NOLOGO
-OUT
:$@
-PDB
:$(HOST_PDBFILE
) $(HOST_OBJS
) $(WIN32_EXE_LDFLAGS
) $(HOST_LDFLAGS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
697 ifdef MSMANIFEST_TOOL
698 @if
test -f
$@.manifest
; then \
699 if
test -f
'$(srcdir)/$@.manifest'; then \
700 echo
'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
701 mt.exe
-NOLOGO
-MANIFEST
'$(win_srcdir)/$@.manifest' $@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
703 echo
'Embedding manifest from $@.manifest'; \
704 mt.exe
-NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
706 elif
test -f
'$(srcdir)/$@.manifest'; then \
707 echo
'Embedding manifest from $(srcdir)/$@.manifest'; \
708 mt.exe
-NOLOGO
-MANIFEST
'$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE
:$@\
;1; \
710 endif # MSVC with manifest tool
712 ifeq ($(HOST_CPP_PROG_LINK
),1)
713 $(EXPAND_LIBS_EXEC
) -- $(HOST_CXX
) -o
$@
$(HOST_CXXFLAGS
) $(HOST_LDFLAGS
) $(HOST_PROGOBJS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
715 $(EXPAND_LIBS_EXEC
) -- $(HOST_CC
) -o
$@
$(HOST_CFLAGS
) $(HOST_LDFLAGS
) $(HOST_PROGOBJS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
716 endif # HOST_CPP_PROG_LINK
720 # This is an attempt to support generation of multiple binaries
721 # in one directory, it assumes everything to compile Foo is in
722 # Foo.o (from either Foo.c or Foo.cpp).
724 # SIMPLE_PROGRAMS = Foo Bar
725 # creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
727 $(SIMPLE_PROGRAMS
): %$(BIN_SUFFIX
): %.
$(OBJ_SUFFIX
) $(STATIC_LIBS_DEPS
) $(EXTRA_DEPS
) $(GLOBAL_DEPS
)
729 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
730 $(EXPAND_LD
) -nologo
-out
:$@
-pdb
:$(LINK_PDBFILE
) $< $(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(MOZ_PROGRAM_LDFLAGS
) $(STATIC_LIBS
) $(SHARED_LIBS
) $(EXTRA_LIBS
) $(OS_LIBS
)
731 ifdef MSMANIFEST_TOOL
732 @if
test -f
$@.manifest
; then \
733 mt.exe
-NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
736 endif # MSVC with manifest tool
738 $(EXPAND_CCC
) $(CXXFLAGS
) -o
$@
$< $(WIN32_EXE_LDFLAGS
) $(LDFLAGS
) $(WRAP_LDFLAGS
) $(STATIC_LIBS
) $(MOZ_PROGRAM_LDFLAGS
) $(SHARED_LIBS
) $(EXTRA_LIBS
) $(OS_LIBS
) $(BIN_FLAGS
)
739 $(call CHECK_BINARY
,$@
)
740 endif # WINNT && !GNU_CC
743 $(STRIP
) $(STRIP_FLAGS
) $@
745 ifdef MOZ_POST_PROGRAM_COMMAND
746 $(MOZ_POST_PROGRAM_COMMAND
) $@
749 $(HOST_SIMPLE_PROGRAMS
): host_
%$(HOST_BIN_SUFFIX
): host_
%.
$(OBJ_SUFFIX
) $(HOST_LIBS
) $(HOST_EXTRA_DEPS
) $(GLOBAL_DEPS
)
751 ifeq (WINNT_
,$(HOST_OS_ARCH
)_
$(GNU_CC
))
752 $(EXPAND_LIBS_EXEC
) -- $(HOST_LD
) -NOLOGO
-OUT
:$@
-PDB
:$(HOST_PDBFILE
) $< $(WIN32_EXE_LDFLAGS
) $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
754 ifneq (,$(HOST_CPPSRCS
)$(USE_HOST_CXX
))
755 $(EXPAND_LIBS_EXEC
) -- $(HOST_CXX
) $(HOST_OUTOPTION
)$@
$(HOST_CXXFLAGS
) $(INCLUDES
) $< $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
757 $(EXPAND_LIBS_EXEC
) -- $(HOST_CC
) $(HOST_OUTOPTION
)$@
$(HOST_CFLAGS
) $(INCLUDES
) $< $(HOST_LIBS
) $(HOST_EXTRA_LIBS
)
761 ifdef DTRACE_PROBE_OBJ
762 EXTRA_DEPS
+= $(DTRACE_PROBE_OBJ
)
763 OBJS
+= $(DTRACE_PROBE_OBJ
)
766 $(filter %.
$(LIB_SUFFIX
),$(LIBRARY
)): $(OBJS
) $(STATIC_LIBS_DEPS
) $(filter %.
$(LIB_SUFFIX
),$(EXTRA_LIBS
)) $(EXTRA_DEPS
) $(GLOBAL_DEPS
)
768 # Always remove both library and library descriptor
769 $(RM
) $(REAL_LIBRARY
) $(REAL_LIBRARY
).
$(LIBS_DESC_SUFFIX
)
770 $(EXPAND_AR
) $(AR_FLAGS
) $(OBJS
) $(STATIC_LIBS
) $(filter %.
$(LIB_SUFFIX
),$(EXTRA_LIBS
))
772 $(filter-out %.
$(LIB_SUFFIX
),$(LIBRARY
)): $(filter %.
$(LIB_SUFFIX
),$(LIBRARY
)) $(OBJS
) $(STATIC_LIBS_DEPS
) $(filter %.
$(LIB_SUFFIX
),$(EXTRA_LIBS
)) $(EXTRA_DEPS
) $(GLOBAL_DEPS
)
773 # When we only build a library descriptor, blow out any existing library
775 $(if
$(filter %.
$(LIB_SUFFIX
),$(LIBRARY
)),,$(RM
) $(REAL_LIBRARY
))
776 $(EXPAND_LIBS_GEN
) -o
$@
$(OBJS
) $(STATIC_LIBS
) $(filter %.
$(LIB_SUFFIX
),$(EXTRA_LIBS
))
778 ifeq ($(OS_ARCH
),WINNT
)
779 # Import libraries are created by the rules creating shared libraries.
780 # The rules to copy them to $(DIST)/lib depend on $(IMPORT_LIBRARY),
781 # but make will happily consider the import library before it is refreshed
782 # when rebuilding the corresponding shared library. Defining an empty recipe
783 # for import libraries forces make to wait for the shared library recipe to
784 # have run before considering other targets that depend on the import library.
786 $(IMPORT_LIBRARY
): $(SHARED_LIBRARY
) ;
789 $(HOST_LIBRARY
): $(HOST_OBJS
) Makefile
792 $(EXPAND_LIBS_EXEC
) --extract
-- $(HOST_AR
) $(HOST_AR_FLAGS
) $(HOST_OBJS
)
796 ifdef DTRACE_PROBE_OBJ
797 ifndef DTRACE_LIB_DEPENDENT
798 NON_DTRACE_OBJS
:= $(filter-out $(DTRACE_PROBE_OBJ
),$(OBJS
))
799 $(DTRACE_PROBE_OBJ
): $(NON_DTRACE_OBJS
)
800 dtrace
-x nolibs
-G
-C
-s
$(MOZILLA_DTRACE_SRC
) -o
$(DTRACE_PROBE_OBJ
) $(NON_DTRACE_OBJS
)
806 # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
807 # so instead of deleting .o files after repacking them into a dylib, we make
808 # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
809 # so no need to conditionalize on OS version or debugging format.
811 $(SHARED_LIBRARY
): $(OBJS
) $(RESFILE
) $(STATIC_LIBS_DEPS
) $(EXTRA_DEPS
) $(GLOBAL_DEPS
)
813 ifndef INCREMENTAL_LINKER
816 ifdef DTRACE_LIB_DEPENDENT
818 dtrace
-x nolibs
-G
-C
-s
$(MOZILLA_DTRACE_SRC
) -o
$(DTRACE_PROBE_OBJ
) $(shell $(EXPAND_LIBS
) $(MOZILLA_PROBE_LIBS
))
820 $(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
)
821 @
$(RM
) $(DTRACE_PROBE_OBJ
)
822 else # ! DTRACE_LIB_DEPENDENT
823 $(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
)
824 endif # DTRACE_LIB_DEPENDENT
825 $(call CHECK_BINARY
,$@
)
827 ifeq (_WINNT
,$(GNU_CC
)_
$(OS_ARCH
))
828 ifdef MSMANIFEST_TOOL
829 ifdef EMBED_MANIFEST_AT
830 @if
test -f
$@.manifest
; then \
831 mt.exe
-NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;$(EMBED_MANIFEST_AT
); \
834 endif # EMBED_MANIFEST_AT
835 endif # MSVC with manifest tool
836 ifdef MOZ_PROFILE_GENERATE
837 touch
-t
`date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
839 endif # WINNT && !GCC
842 $(STRIP
) $(STRIP_FLAGS
) $@
844 ifdef MOZ_POST_DSO_LIB_COMMAND
845 $(MOZ_POST_DSO_LIB_COMMAND
) $@
848 ifeq ($(SOLARIS_SUNPRO_CC
),1)
849 _MDDEPFILE
= $(MDDEPDIR
)/$(@F
).pp
851 define MAKE_DEPS_AUTO_CC
852 if
test -d
$(@D
); then \
853 echo
'Building deps for $< using Sun Studio cc'; \
854 $(CC
) $(COMPILE_CFLAGS
) -xM
$< >$(_MDDEPFILE
) ; \
855 $(PYTHON
) $(MOZILLA_DIR
)/build
/unix
/add_phony_targets.py
$(_MDDEPFILE
) ; \
858 define MAKE_DEPS_AUTO_CXX
859 if
test -d
$(@D
); then \
860 echo
'Building deps for $< using Sun Studio CC'; \
861 $(CXX
) $(COMPILE_CXXFLAGS
) -xM
$< >$(_MDDEPFILE
) ; \
862 $(PYTHON
) $(MOZILLA_DIR
)/build
/unix
/add_phony_targets.py
$(_MDDEPFILE
) ; \
865 endif # Sun Studio on Solaris
867 # The object file is in the current directory, and the source file can be any
868 # relative path. This macro adds the dependency obj: src for each source file.
869 # This dependency must be first for the $< flag to work correctly, and the
870 # rules that have commands for these targets must not list any other
871 # prerequisites, or they will override the $< variable.
873 $(basename $2$(notdir $1)).
$(OBJ_SUFFIX
): $1 $$(call mkdir_deps
,$$(MDDEPDIR
))
875 $(foreach f
,$(CSRCS
) $(SSRCS
) $(CPPSRCS
) $(CMSRCS
) $(CMMSRCS
) $(ASFILES
),$(eval
$(call src_objdep
,$(f
))))
876 $(foreach f
,$(HOST_CSRCS
) $(HOST_CPPSRCS
) $(HOST_CMSRCS
) $(HOST_CMMSRCS
),$(eval
$(call src_objdep
,$(f
),host_
)))
878 $(OBJS
) $(HOST_OBJS
) $(PROGOBJS
) $(HOST_PROGOBJS
): $(GLOBAL_DEPS
)
880 # Rules for building native targets must come first because of the host_ prefix
883 $(ELOG
) $(HOST_CC
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CFLAGS
) $(INCLUDES
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
887 $(ELOG
) $(HOST_CXX
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CXXFLAGS
) $(INCLUDES
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
891 $(ELOG
) $(HOST_CC
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CFLAGS
) $(HOST_CMFLAGS
) $(INCLUDES
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
895 $(ELOG
) $(HOST_CXX
) $(HOST_OUTOPTION
)$@
-c
$(HOST_CXXFLAGS
) $(HOST_CMMFLAGS
) $(INCLUDES
) $(NSPR_CFLAGS
) $(_VPATH_SRCS
)
899 @
$(MAKE_DEPS_AUTO_CC
)
900 $(ELOG
) $(CC
) $(OUTOPTION
)$@
-c
$(COMPILE_CFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
902 # DEFINES and ACDEFINES are needed here to enable conditional compilation of Q_OBJECTs:
903 # 'moc' only knows about #defines it gets on the command line (-D...), not in
904 # included headers like mozilla-config.h
905 $(filter moc_
%.
cpp,$(CPPSRCS
)): moc_
%.
cpp: %.h
907 $(ELOG
) $(MOC
) $(DEFINES
) $(ACDEFINES
) $< $(OUTOPTION
)$@
909 $(filter moc_
%.
cc,$(CPPSRCS
)): moc_
%.
cc: %.
cc
911 $(ELOG
) $(MOC
) $(DEFINES
) $(ACDEFINES
) $(_VPATH_SRCS
:.
cc=.h
) $(OUTOPTION
)$@
913 $(filter qrc_
%.
cpp,$(CPPSRCS
)): qrc_
%.
cpp: %.qrc
915 $(ELOG
) $(RCC
) -name
$* $< $(OUTOPTION
)$@
918 # The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
922 $(AS
) $(ASOUTOPTION
)$@
$(ASFLAGS
) $($(notdir $<)_FLAGS
) $(AS_DASH_C_FLAG
) $(_VPATH_SRCS
)
927 $(AS
) -o
$@
$(ASFLAGS
) $($(notdir $<)_FLAGS
) $(LOCAL_INCLUDES
) $(TARGET_LOCAL_INCLUDES
) -c
$<
931 @
$(MAKE_DEPS_AUTO_CXX
)
932 $(ELOG
) $(CCC
) $(OUTOPTION
)$@
-c
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
936 @
$(MAKE_DEPS_AUTO_CXX
)
937 $(ELOG
) $(CCC
) -o
$@
-c
$(COMPILE_CXXFLAGS
) $(COMPILE_CMMFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
941 @
$(MAKE_DEPS_AUTO_CC
)
942 $(ELOG
) $(CC
) -o
$@
-c
$(COMPILE_CFLAGS
) $(COMPILE_CMFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
944 $(filter %.s
,$(CPPSRCS
:%.
cpp=%.s
)): %.s
: %.
cpp $(call mkdir_deps
,$(MDDEPDIR
))
946 $(CCC
) -S
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
948 $(filter %.s
,$(CPPSRCS
:%.
cc=%.s
)): %.s
: %.
cc $(call mkdir_deps
,$(MDDEPDIR
))
950 $(CCC
) -S
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
952 $(filter %.s
,$(CPPSRCS
:%.
cxx=%.s
)): %.s
: %.
cpp $(call mkdir_deps
,$(MDDEPDIR
))
954 $(CCC
) -S
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
956 $(filter %.s
,$(CSRCS
:%.c
=%.s
)): %.s
: %.c
$(call mkdir_deps
,$(MDDEPDIR
))
958 $(CC
) -S
$(COMPILE_CFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
960 ifneq (,$(filter %.i
,$(MAKECMDGOALS
)))
961 # Call as $(call _group_srcs,extension,$(SRCS)) - this will create a list
962 # of the full sources, as well as the $(notdir) version. So:
963 # foo.cpp sub/bar.cpp
965 # foo.cpp sub/bar.cpp bar.cpp
967 # This way we can match both 'make sub/bar.i' and 'make bar.i'
968 _group_srcs
= $(sort $(patsubst %.
$1,%.i
,$(filter %.
$1,$2 $(notdir $2))))
969 _PREPROCESSED_CPP_FILES
:= $(call _group_srcs
,cpp,$(CPPSRCS
))
970 _PREPROCESSED_CC_FILES
:= $(call _group_srcs
,cc,$(CPPSRCS
))
971 _PREPROCESSED_CXX_FILES
:= $(call _group_srcs
,cxx,$(CPPSRCS
))
972 _PREPROCESSED_C_FILES
:= $(call _group_srcs
,c
,$(CSRCS
))
973 _PREPROCESSED_CMM_FILES
:= $(call _group_srcs
,mm
,$(CMMSRCS
))
975 # Hack up VPATH so we can reach the sources. Eg: 'make Parser.i' may need to
976 # reach $(srcdir)/frontend/Parser.i
977 VPATH
+= $(addprefix $(srcdir)/,$(sort $(dir $(CPPSRCS
) $(CSRCS
) $(CMMSRCS
))))
979 # Make preprocessed files PHONY so they are always executed, since they are
980 # manual targets and we don't necessarily write to $@.
981 .PHONY
: $(_PREPROCESSED_CPP_FILES
) $(_PREPROCESSED_CC_FILES
) $(_PREPROCESSED_CXX_FILES
) $(_PREPROCESSED_C_FILES
) $(_PREPROCESSED_CMM_FILES
)
983 $(_PREPROCESSED_CPP_FILES
): %.i
: %.
cpp $(call mkdir_deps
,$(MDDEPDIR
))
985 $(addprefix $(MKDIR
) -p
,$(filter-out .
,$(@D
)))
986 $(CCC
) -C
$(PREPROCESS_OPTION
)$@
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
988 $(_PREPROCESSED_CC_FILES
): %.i
: %.
cc $(call mkdir_deps
,$(MDDEPDIR
))
990 $(addprefix $(MKDIR
) -p
,$(filter-out .
,$(@D
)))
991 $(CCC
) -C
$(PREPROCESS_OPTION
)$@
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
993 $(_PREPROCESSED_CXX_FILES
): %.i
: %.
cxx $(call mkdir_deps
,$(MDDEPDIR
))
995 $(addprefix $(MKDIR
) -p
,$(filter-out .
,$(@D
)))
996 $(CCC
) -C
$(PREPROCESS_OPTION
)$@
$(COMPILE_CXXFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
998 $(_PREPROCESSED_C_FILES
): %.i
: %.c
$(call mkdir_deps
,$(MDDEPDIR
))
1000 $(addprefix $(MKDIR
) -p
,$(filter-out .
,$(@D
)))
1001 $(CC
) -C
$(PREPROCESS_OPTION
)$@
$(COMPILE_CFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
1003 $(_PREPROCESSED_CMM_FILES
): %.i
: %.mm
$(call mkdir_deps
,$(MDDEPDIR
))
1005 $(addprefix $(MKDIR
) -p
,$(filter-out .
,$(@D
)))
1006 $(CCC
) -C
$(PREPROCESS_OPTION
)$@
$(COMPILE_CXXFLAGS
) $(COMPILE_CMMFLAGS
) $($(notdir $<)_FLAGS
) $(TARGET_LOCAL_INCLUDES
) $(_VPATH_SRCS
)
1008 # Default to pre-processing the actual unified file. This can be overridden
1009 # at the command-line to pre-process only the individual source file.
1012 # PP_REINVOKE gets set on the sub-make to prevent us from going in an
1013 # infinite loop if the filename doesn't exist in the unified source files.
1016 MATCH_cpp
= \
(cpp\|
cc|
cxx\
)
1021 # When building with PP_UNIFIED=0, we also have to look in the Unified files to
1022 # find a matching pathname.
1023 _get_all_sources
= $1 $(if
$(filter Unified
%,$1),$(shell sed
-n
's/\#include "\(.*\)"$$/\1/p' $(filter Unified
%,$1)))
1024 all_cpp_sources
:= $(call _get_all_sources
,$(CPPSRCS
))
1025 all_mm_sources
:= $(call _get_all_sources
,$(CMMSRCS
))
1026 all_c_sources
:= $(call _get_all_sources
,$(CSRCS
))
1027 all_sources
:= $(all_cpp_sources
) $(all_cmm_sources
) $(all_c_sources
)
1029 # The catch-all %.i rule runs when we pass in a .i filename that doesn't match
1030 # one of the *SRCS variables. The two code paths depend on whether or not
1031 # we are requesting a unified file (PP_UNIFIED=1, the default) or not:
1034 # - Look for it in any of the Unified files, and re-exec make with
1035 # Unified_foo0.i as the target. This gets us the full unified preprocessed
1039 # - If the .i filename is in *SRCS, or in a Unified filename, then we re-exec
1040 # make with that filename as the target. The *SRCS variables are modified
1041 # to have the Unified sources appended to them so that the static pattern
1044 ifeq ($(PP_UNIFIED
),1)
1045 @
$(MAKE
) PP_REINVOKE
=1 \
1046 $(or
$(addsuffix .i
, \
1047 $(foreach type
,c
cpp mm
, \
1048 $(if
$(filter Unified
%,$($(UPPER_
$(type
))SRCS
)), \
1049 $(shell grep
-l
'#include "\(.*/\)\?$(basename $@).$(or $(MATCH_$(type)),$(type))"' Unified
*.
$(type
) | sed
's/\.$(type)$$//') \
1050 ))),$(error
"File not found for preprocessing: $@"))
1052 @
$(MAKE
) PP_REINVOKE
=1 $@ \
1053 $(foreach type
,c
cpp mm
,$(UPPER_
$(type
))SRCS
="$(all_$(type)_sources)")
1060 $(RESFILE
): %.res
: %.rc
1062 @echo Creating Resource file
: $@
1064 $(RC
) $(RCFLAGS
) $(filter-out -U
%,$(DEFINES
)) $(INCLUDES
:-I
%=--include-dir
%) $(OUTOPTION
)$@
$(_VPATH_SRCS
)
1066 $(RC
) $(RCFLAGS
) -r
$(DEFINES
) $(INCLUDES
) $(OUTOPTION
)$@
$(_VPATH_SRCS
)
1069 # Cancel GNU make built-in implicit rules
1072 ifneq (,$(filter WINNT
,$(OS_ARCH
)))
1079 SPACE
:= $(EMPTY
) $(EMPTY
)
1081 # MSYS has its own special path form, but javac expects the source and class
1082 # paths to be in the DOS form (i.e. e:/builds/...). This function does the
1083 # appropriate conversion on Windows, but is a noop on other systems.
1084 ifeq ($(HOST_OS_ARCH
),WINNT
)
1085 # We use 'pwd -W' to get DOS form of the path. However, since the given path
1086 # could be a file or a non-existent path, we cannot call 'pwd -W' directly
1087 # on the path. Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
1088 # on it, then merge with the rest of the path.
1089 root-path
= $(shell echo
$(1) | sed
-e
's|\(/[^/]*\)/\?\(.*\)|\1|')
1090 non-root-path
= $(shell echo
$(1) | sed
-e
's|\(/[^/]*\)/\?\(.*\)|\2|')
1091 normalizepath
= $(foreach p
,$(1),$(if
$(filter /%,$(1)),$(patsubst %/,%,$(shell cd
$(call root-path
,$(1)) && pwd
-W
))/$(call non-root-path
,$(1)),$(1)))
1093 normalizepath
= $(1)
1096 ###############################################################################
1098 ###############################################################################
1099 ifneq (,$(JAVAFILES
)$(ANDROID_RESFILES
)$(ANDROID_APKNAME
)$(JAVA_JAR_TARGETS
))
1100 include $(MOZILLA_DIR
)/config
/makefiles
/java-build.mk
1103 ###############################################################################
1104 # Bunch of things that extend the 'export' rule (in order):
1105 ###############################################################################
1107 ifneq ($(XPI_NAME
),)
1111 export:: $(FINAL_TARGET
)
1114 ################################################################################
1115 # Copy each element of PREF_JS_EXPORTS
1117 # The default location for PREF_JS_EXPORTS is the gre prefs directory.
1118 PREF_DIR
= defaults
/pref
1120 # If DIST_SUBDIR is defined it indicates that app and gre dirs are
1121 # different and that we are building app related resources. Hence,
1122 # PREF_DIR should point to the app prefs location.
1123 ifneq (,$(DIST_SUBDIR
)$(XPI_NAME
)$(LIBXUL_SDK
))
1124 PREF_DIR
= defaults
/preferences
1127 # on win32, pref files need CRLF line endings... see bug 206029
1128 ifeq (WINNT
,$(OS_ARCH
))
1129 PREF_PPFLAGS
+= --line-endings
=crlf
1132 ifneq ($(PREF_JS_EXPORTS
),)
1133 ifndef NO_DIST_INSTALL
1134 PREF_JS_EXPORTS_PATH
:= $(FINAL_TARGET
)/$(PREF_DIR
)
1135 # We preprocess these, but they don't necessarily have preprocessor directives,
1136 # so tell them preprocessor to not complain about that.
1137 PREF_JS_EXPORTS_FLAGS
:= $(PREF_PPFLAGS
) --silence-missing-directive-warnings
1138 PP_TARGETS
+= PREF_JS_EXPORTS
1142 ################################################################################
1143 # Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
1145 ifneq ($(AUTOCFG_JS_EXPORTS
),)
1146 ifndef NO_DIST_INSTALL
1147 AUTOCFG_JS_EXPORTS_FILES
:= $(AUTOCFG_JS_EXPORTS
)
1148 AUTOCFG_JS_EXPORTS_DEST
:= $(FINAL_TARGET
)/defaults
/autoconfig
1149 AUTOCFG_JS_EXPORTS_TARGET
:= export
1150 INSTALL_TARGETS
+= AUTOCFG_JS_EXPORTS
1154 ################################################################################
1155 # Install a linked .xpt into the appropriate place.
1156 # This should ideally be performed by the non-recursive idl make file. Some day.
1159 ifndef NO_DIST_INSTALL
1160 ifndef NO_INTERFACES_MANIFEST
1161 misc
:: $(call mkdir_deps
,$(FINAL_TARGET
)/components
)
1162 $(call py_action
,buildlist
,$(FINAL_TARGET
)/components
/interfaces.manifest
'interfaces $(XPT_NAME)')
1163 $(call py_action
,buildlist
,$(FINAL_TARGET
)/chrome.manifest
'manifest components/interfaces.manifest')
1169 ################################################################################
1170 # Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
1171 ifneq (,$(filter %.js
,$(EXTRA_COMPONENTS
) $(EXTRA_PP_COMPONENTS
)))
1172 ifeq (,$(filter %.manifest
,$(EXTRA_COMPONENTS
) $(EXTRA_PP_COMPONENTS
)))
1173 ifndef NO_JS_MANIFEST
1174 $(error .js component without matching .manifest. See https
://developer.mozilla.org
/en
/XPCOM
/XPCOM_changes_in_Gecko_2.0
)
1179 ifdef EXTRA_COMPONENTS
1180 misc
:: $(EXTRA_COMPONENTS
)
1181 ifndef NO_DIST_INSTALL
1182 EXTRA_COMPONENTS_FILES
:= $(EXTRA_COMPONENTS
)
1183 EXTRA_COMPONENTS_DEST
:= $(FINAL_TARGET
)/components
1184 EXTRA_COMPONENTS_TARGET
:= misc
1185 INSTALL_TARGETS
+= EXTRA_COMPONENTS
1190 ifdef EXTRA_PP_COMPONENTS
1191 ifndef NO_DIST_INSTALL
1192 EXTRA_PP_COMPONENTS_PATH
:= $(FINAL_TARGET
)/components
1193 EXTRA_PP_COMPONENTS_TARGET
:= misc
1194 PP_TARGETS
+= EXTRA_PP_COMPONENTS
1198 EXTRA_MANIFESTS
= $(filter %.manifest
,$(EXTRA_COMPONENTS
) $(EXTRA_PP_COMPONENTS
))
1199 ifneq (,$(EXTRA_MANIFESTS
))
1200 misc
:: $(call mkdir_deps
,$(FINAL_TARGET
))
1201 $(call py_action
,buildlist
,$(FINAL_TARGET
)/chrome.manifest
$(patsubst %,'manifest components/%',$(notdir $(EXTRA_MANIFESTS
))))
1204 ################################################################################
1207 ifneq (,$(SDK_LIBRARY
))
1208 ifndef NO_DIST_INSTALL
1209 SDK_LIBRARY_FILES
:= $(SDK_LIBRARY
)
1210 SDK_LIBRARY_DEST
:= $(SDK_LIB_DIR
)
1211 SDK_LIBRARY_TARGET
:= target
1212 INSTALL_TARGETS
+= SDK_LIBRARY
1216 # SDK_BINARY is still used in various makefiles for non-products of the
1217 # compilation, so we need to keep that running on the libs tier.
1218 ifneq (,$(strip $(SDK_BINARY
)))
1219 ifndef NO_DIST_INSTALL
1220 SDK_BINARY_FILES
:= $(SDK_BINARY
)
1221 SDK_BINARY_DEST
:= $(SDK_BIN_DIR
)
1222 # SDK_BINARY_TARGET is set in xpcom/idl-parser/Makefile.in
1223 SDK_BINARY_TARGET ?
= libs target
1224 INSTALL_TARGETS
+= SDK_BINARY
1228 ################################################################################
1235 $(FINAL_TARGET
)/chrome
: $(call mkdir_deps
,$(FINAL_TARGET
)/chrome
)
1237 ifneq (,$(JAR_MANIFEST
))
1238 ifndef NO_DIST_INSTALL
1241 ifdef XPI_ROOT_APPID
1242 # For add-on packaging we may specify that an application
1243 # sub-dir should be added to the root chrome manifest with
1244 # a specific application id.
1245 MAKE_JARS_FLAGS
+= --root-manifest-entry-appid
='$(XPI_ROOT_APPID)'
1248 # if DIST_SUBDIR is defined but XPI_ROOT_APPID is not there's
1249 # no way langpacks will get packaged right, so error out.
1250 ifneq (,$(DIST_SUBDIR
))
1251 ifndef XPI_ROOT_APPID
1252 $(error XPI_ROOT_APPID is not defined
- langpacks will break.
)
1257 libs realchrome
:: $(FINAL_TARGET
)/chrome
1258 $(call py_action
,jar_maker
,\
1259 $(QUIET
) -j
$(FINAL_TARGET
)/chrome \
1260 $(MAKE_JARS_FLAGS
) $(XULPPFLAGS
) $(DEFINES
) $(ACDEFINES
) \
1265 # This is a temporary check to ensure patches relying on the old behavior
1266 # of silently picking up jar.mn files continue to work.
1267 else # No JAR_MANIFEST
1268 ifneq (,$(wildcard $(srcdir)/jar.mn
))
1269 $(error
$(srcdir) contains a jar.mn file but this file is not declared in a JAR_MANIFESTS variable in a moz.build file
)
1273 ifneq ($(DIST_FILES
),)
1274 DIST_FILES_PATH
:= $(FINAL_TARGET
)
1275 # We preprocess these, but they don't necessarily have preprocessor directives,
1276 # so tell them preprocessor to not complain about that.
1277 DIST_FILES_FLAGS
:= $(XULAPP_DEFINES
) --silence-missing-directive-warnings
1278 PP_TARGETS
+= DIST_FILES
1281 # When you move this out of the tools tier, please remove the corresponding
1282 # hacks in recursivemake.py that check if Makefile.in sets the variable.
1283 ifneq ($(XPI_PKGNAME
),)
1287 @echo
'Stripping $(XPI_PKGNAME) package directory...'
1288 @echo
$(FINAL_TARGET
)
1289 @cd
$(FINAL_TARGET
) && find .
! -type d \
1299 ! -name
'*.properties' \
1310 $(PLATFORM_EXCLUDE_LIST
) \
1311 -exec
$(STRIP
) $(STRIP_FLAGS
) {} >/dev
/null
2>&1 \
;
1314 @echo
'Packaging $(XPI_PKGNAME).xpi...'
1315 cd
$(FINAL_TARGET
) && $(ZIP
) -qr ..
/$(XPI_PKGNAME
).xpi
*
1318 # See comment above about moving this out of the tools tier.
1319 ifdef INSTALL_EXTENSION_ID
1321 $(error XPI_NAME must be set for INSTALL_EXTENSION_ID
)
1325 $(RM
) -r
'$(DIST)/bin/distribution$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)'
1326 $(NSINSTALL
) -D
'$(DIST)/bin/distribution$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)'
1327 $(call copy_dir
,$(FINAL_TARGET
),$(DIST
)/bin
/distribution
$(DIST_SUBDIR
:%=/%)/extensions
/$(INSTALL_EXTENSION_ID
))
1331 #############################################################################
1332 # MDDEPDIR is the subdirectory where all the dependency files are placed.
1333 # This uses a make rule (instead of a macro) to support parallel
1334 # builds (-jN). If this were done in the LOOP_OVER_DIRS macro, two
1335 # processes could simultaneously try to create the same directory.
1337 # We use $(CURDIR) in the rule's target to ensure that we don't find
1338 # a dependency directory in the source tree via VPATH (perhaps from
1339 # a previous build in the source tree) and thus neglect to create a
1340 # dependency directory in the object directory, where we really need
1343 ifneq (,$(filter-out all chrome default
export realchrome
clean clobber clobber_all
distclean realclean,$(MAKECMDGOALS
)))
1344 MDDEPEND_FILES
:= $(strip $(wildcard $(addprefix $(MDDEPDIR
)/,$(EXTRA_MDDEPEND_FILES
) $(addsuffix .pp
,$(notdir $(sort $(OBJS
) $(PROGOBJS
) $(HOST_OBJS
) $(HOST_PROGOBJS
)))))))
1346 ifneq (,$(MDDEPEND_FILES
))
1347 $(call include_deps
,$(MDDEPEND_FILES
))
1353 ifneq (,$(filter export,$(MAKECMDGOALS
)))
1354 MDDEPEND_FILES
:= $(strip $(wildcard $(addprefix $(MDDEPDIR
)/,$(EXTRA_EXPORT_MDDEPEND_FILES
))))
1356 ifneq (,$(MDDEPEND_FILES
))
1357 $(call include_deps
,$(MDDEPEND_FILES
))
1362 #############################################################################
1364 -include $(topsrcdir
)/$(MOZ_BUILD_APP
)/app-rules.mk
1365 -include $(MY_RULES
)
1368 # Generate Emacs tags in a file named TAGS if ETAGS was set in $(MY_CONFIG)
1372 ifneq ($(CSRCS
)$(CPPSRCS
)$(HEADERS
),)
1374 TAGS
:: $(CSRCS
) $(CPPSRCS
) $(HEADERS
)
1375 $(ETAGS
) $(CSRCS
) $(CPPSRCS
) $(HEADERS
)
1379 ################################################################################
1380 # Install/copy rules
1382 # The INSTALL_TARGETS variable contains a list of all install target
1383 # categories. Each category defines a list of files and executables, and an
1384 # install destination,
1386 # FOO_FILES := foo bar
1387 # FOO_EXECUTABLES := baz
1388 # FOO_DEST := target_path
1389 # INSTALL_TARGETS += FOO
1391 # Additionally, a FOO_TARGET variable may be added to indicate the target for
1392 # which the files and executables are installed. Default is "libs".
1394 # Finally, a FOO_KEEP_PATH variable may be set to 1 to indicate the paths given
1395 # in FOO_FILES/FOO_EXECUTABLES are to be kept at the destination. That is,
1396 # if FOO_FILES is bar/baz/qux.h, and FOO_DEST is $(DIST)/include, the installed
1397 # file would be $(DIST)/include/bar/baz/qux.h instead of $(DIST)/include/qux.h
1399 # If we're using binary nsinstall and it's not built yet, fallback to python nsinstall.
1400 ifneq (,$(filter $(DEPTH
)/config
/nsinstall
$(HOST_BIN_SUFFIX
),$(install_cmd
)))
1401 ifeq (,$(wildcard $(DEPTH
)/config
/nsinstall
$(HOST_BIN_SUFFIX
)))
1402 nsinstall_is_usable
= $(if
$(wildcard $(DEPTH
)/config
/nsinstall
$(HOST_BIN_SUFFIX
)),yes
)
1404 define install_cmd_override
1405 $(1): install_cmd
= $$(if
$$(nsinstall_is_usable
),$$(INSTALL
),$$(NSINSTALL_PY
) -t
) $$(1)
1410 install_target_tier
= $(or
$($(1)_TARGET
),libs
)
1411 INSTALL_TARGETS_TIERS
:= $(sort $(foreach category
,$(INSTALL_TARGETS
),$(call install_target_tier
,$(category
))))
1413 install_target_result
= $($(1)_DEST
:%/=%)/$(if
$($(1)_KEEP_PATH
),$(2),$(notdir $(2)))
1414 install_target_files
= $(foreach file
,$($(1)_FILES
),$(call install_target_result
,$(category
),$(file
)))
1415 install_target_executables
= $(foreach file
,$($(1)_EXECUTABLES
),$(call install_target_result
,$(category
),$(file
)))
1417 # Work around a GNU make 3.81 bug where it gives $< the wrong value.
1418 # See details in bug 934864.
1419 define create_dependency
1424 define install_target_template
1425 $(call install_cmd_override
,$(2))
1426 $(call create_dependency
,$(2),$(1))
1429 $(foreach category
,$(INSTALL_TARGETS
),\
1430 $(if
$($(category
)_DEST
),,$(error Missing
$(category
)_DEST
)) \
1431 $(foreach tier
,$(call install_target_tier
,$(category
)),\
1432 $(eval INSTALL_TARGETS_FILES_
$(tier
) += $(call install_target_files
,$(category
))) \
1433 $(eval INSTALL_TARGETS_EXECUTABLES_
$(tier
) += $(call install_target_executables
,$(category
))) \
1435 $(foreach file
,$($(category
)_FILES
) $($(category
)_EXECUTABLES
), \
1436 $(eval
$(call install_target_template
,$(file
),$(call install_target_result
,$(category
),$(file
)))) \
1440 $(foreach tier
,$(INSTALL_TARGETS_TIERS
), \
1441 $(eval
$(tier
):: $(INSTALL_TARGETS_FILES_
$(tier
)) $(INSTALL_TARGETS_EXECUTABLES_
$(tier
))) \
1444 install_targets_sanity
= $(if
$(filter-out $(notdir $@
),$(notdir $(<))),$(error Looks like
$@ has an unexpected dependency on
$< which breaks INSTALL_TARGETS
))
1446 $(sort $(foreach tier
,$(INSTALL_TARGETS_TIERS
),$(INSTALL_TARGETS_FILES_
$(tier
)))):
1447 $(install_targets_sanity
)
1448 $(call install_cmd
,$(IFLAGS1
) '$<' '$(@D)')
1450 $(sort $(foreach tier
,$(INSTALL_TARGETS_TIERS
),$(INSTALL_TARGETS_EXECUTABLES_
$(tier
)))):
1451 $(install_targets_sanity
)
1452 $(call install_cmd
,$(IFLAGS2
) '$<' '$(@D)')
1454 ################################################################################
1455 # Preprocessing rules
1457 # The PP_TARGETS variable contains a list of all preprocessing target
1458 # categories. Each category has associated variables listing input files, the
1459 # output directory, extra preprocessor flags, and so on. For example:
1462 # FOO_PATH := target-directory
1463 # FOO_FLAGS := -Dsome_flag
1466 # If PP_TARGETS lists a category name <C> (like FOO, above), then we consult the
1467 # following make variables to see what to do:
1469 # - <C> lists input files to be preprocessed with mozbuild.action.preprocessor.
1470 # We search VPATH for the names given here. If an input file name ends in
1471 # '.in', that suffix is omitted from the output file name.
1473 # - <C>_PATH names the directory in which to place the preprocessed output
1474 # files. We create this directory if it does not already exist. Setting
1475 # this variable is optional; if unset, we install the files in $(CURDIR).
1477 # - <C>_FLAGS lists flags to pass to mozbuild.action.preprocessor, in addition
1478 # to the usual bunch. Setting this variable is optional.
1480 # - <C>_TARGET names the 'make' target that should depend on creating the output
1481 # files. Setting this variable is optional; if unset, we preprocess the
1482 # files for the 'libs' target.
1484 # - <C>_KEEP_PATH may be set to 1 to indicate the paths given in <C> are to be
1485 # kept under <C>_PATH. That is, if <C> is bar/baz/qux.h.in and <C>_PATH is
1486 # $(DIST)/include, the preprocessed file would be $(DIST)/include/bar/baz/qux.h
1487 # instead of $(DIST)/include/qux.h.
1489 pp_target_tier
= $(or
$($(1)_TARGET
),libs
)
1490 PP_TARGETS_TIERS
:= $(sort $(foreach category
,$(PP_TARGETS
),$(call pp_target_tier
,$(category
))))
1492 pp_target_result
= $(or
$($(1)_PATH
:%/=%),$(CURDIR
))/$(if
$($(1)_KEEP_PATH
),$(2:.in
=),$(notdir $(2:.in
=)))
1493 pp_target_results
= $(foreach file
,$($(1)),$(call pp_target_result
,$(category
),$(file
)))
1495 $(foreach category
,$(PP_TARGETS
), \
1496 $(foreach tier
,$(call pp_target_tier
,$(category
)), \
1497 $(eval PP_TARGETS_RESULTS_
$(tier
) += $(call pp_target_results
,$(category
))) \
1499 $(foreach file
,$($(category
)), \
1500 $(eval
$(call create_dependency
,$(call pp_target_result
,$(category
),$(file
)), \
1501 $(file
) $(GLOBAL_DEPS
))) \
1503 $(eval
$(call pp_target_results
,$(category
)): PP_TARGET_FLAGS
=$($(category
)_FLAGS
)) \
1506 $(foreach tier
,$(PP_TARGETS_TIERS
), \
1507 $(eval
$(tier
):: $(PP_TARGETS_RESULTS_
$(tier
))) \
1510 PP_TARGETS_ALL_RESULTS
:= $(sort $(foreach tier
,$(PP_TARGETS_TIERS
),$(PP_TARGETS_RESULTS_
$(tier
))))
1511 $(PP_TARGETS_ALL_RESULTS
):
1512 $(if
$(filter-out $(notdir $@
),$(notdir $(<:.in
=))),$(error Looks like
$@ has an unexpected dependency on
$< which breaks PP_TARGETS
))
1514 $(call py_action
,preprocessor
,--depend
$(MDDEPDIR
)/$(@F
).pp
$(PP_TARGET_FLAGS
) $(DEFINES
) $(ACDEFINES
) $(XULPPFLAGS
) '$<' -o
'$@')
1516 # The depfile is based on the filename, and we don't want conflicts. So check
1517 # there's only one occurrence of any given filename in PP_TARGETS_ALL_RESULTS.
1518 PP_TARGETS_ALL_RESULT_NAMES
:= $(notdir $(PP_TARGETS_ALL_RESULTS
))
1519 $(foreach file
,$(sort $(PP_TARGETS_ALL_RESULT_NAMES
)), \
1520 $(if
$(filter-out 1,$(words $(filter $(file
),$(PP_TARGETS_ALL_RESULT_NAMES
)))), \
1521 $(error Multiple preprocessing rules are creating a
$(file
) file
) \
1525 ifneq (,$(filter $(PP_TARGETS_TIERS
) $(PP_TARGETS_ALL_RESULTS
),$(MAKECMDGOALS
)))
1526 # If the depfile for a preprocessed file doesn't exist, add a dep to force
1528 $(foreach file
,$(PP_TARGETS_ALL_RESULTS
), \
1529 $(if
$(wildcard $(MDDEPDIR
)/$(notdir $(file
)).pp
), \
1531 $(eval
$(file
): FORCE
) \
1535 MDDEPEND_FILES
:= $(strip $(wildcard $(addprefix $(MDDEPDIR
)/,$(addsuffix .pp
,$(notdir $(PP_TARGETS_ALL_RESULTS
))))))
1537 ifneq (,$(MDDEPEND_FILES
))
1538 $(call include_deps
,$(MDDEPEND_FILES
))
1543 # Pull in non-recursive targets if this is a partial tree build.
1544 ifndef TOPLEVEL_BUILD
1545 include $(MOZILLA_DIR
)/config
/makefiles
/nonrecursive.mk
1548 ################################################################################
1549 # Special gmake rules.
1550 ################################################################################
1554 # Re-define the list of default suffixes, so gmake won't have to churn through
1555 # hundreds of built-in suffix rules for stuff we don't need.
1560 # Fake targets. Always run these rules, even if a file/directory with that
1561 # name already exists.
1563 .PHONY
: all alltags boot checkout chrome realchrome
clean clobber clobber_all
export install libs makefiles
realclean run_apprunner tools
$(DIRS
) FORCE
1565 # Used as a dependency to force targets to rebuild
1568 # Delete target if error occurs when building target
1573 TAGS
: $(CSRCS
) $(CPPSRCS
) $(wildcard *.h
)
1574 -etags
$(CSRCS
) $(CPPSRCS
) $(wildcard *.h
)
1577 ifndef INCLUDED_DEBUGMAKE_MK
#{
1578 ## Only parse when an echo* or show* target is requested
1579 ifneq (,$(call isTargetStem
,echo
,show
))
1580 include $(MOZILLA_DIR
)/config
/makefiles
/debugmake.mk
1586 $(DOXYGEN
) $(DEPTH
)/config
/doxygen.cfg
1594 FREEZE_VARIABLES
= \
1602 EXTRA_PP_COMPONENTS \
1605 $(foreach var
,$(FREEZE_VARIABLES
),$(eval
$(var
)_FROZEN
:= '$($(var))'))
1607 CHECK_FROZEN_VARIABLES
= $(foreach var
,$(FREEZE_VARIABLES
), \
1608 $(if
$(subst $($(var
)_FROZEN
),,'$($(var))'),$(error Makefile variable
'$(var)' changed value after including rules.mk. Was
$($(var
)_FROZEN
), now
$($(var
)).
)))
1611 $(CHECK_FROZEN_VARIABLES
)
1613 PURGECACHES_DIRS ?
= $(DIST
)/bin
1614 ifdef MOZ_WEBAPP_RUNTIME
1615 PURGECACHES_DIRS
+= $(DIST
)/bin
/webapprt
1618 PURGECACHES_FILES
= $(addsuffix /.purgecaches
,$(PURGECACHES_DIRS
))
1620 default
all:: $(PURGECACHES_FILES
)
1622 $(PURGECACHES_FILES
):
1623 if
test -d
$(@D
) ; then touch
$@
; fi
1625 .DEFAULT_GOAL
:= $(or
$(OVERRIDE_DEFAULT_GOAL
),default
)
1627 #############################################################################
1628 # Derived targets and dependencies
1630 include $(MOZILLA_DIR
)/config
/makefiles
/autotargets.mk
1631 ifneq ($(NULL
),$(AUTO_DEPS
))
1632 default
all libs tools
export:: $(AUTO_DEPS
)
1635 export:: $(GENERATED_FILES
)
1637 GARBAGE
+= $(GENERATED_FILES
)
1639 # We may have modified "frozen" variables in rules.mk (we do that), but we don't
1640 # want Makefile.in doing that, so collect the possibly modified variables here,
1641 # and check them again in recurse.mk, which is always included after Makefile.in
1643 $(foreach var
,$(_MOZBUILD_EXTERNAL_VARIABLES
),$(eval
$(var
)_FROZEN
:= '$($(var))'))
1644 $(foreach var
,$(_DEPRECATED_VARIABLES
),$(eval
$(var
)_FROZEN
:= '$($(var))'))