Bug 476245. Keep better track of our anonymous content. r=smaug, sr=jst
[mozilla-central.git] / config / rules.mk
blobc78d482ebeaea482f03734f971e404037a42c7ca
1 # vim:set ts=8 sw=8 sts=8 noet:
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
14 # License.
16 # The Original Code is mozilla.org code.
18 # The Initial Developer of the Original Code is
19 # Netscape Communications Corporation.
20 # Portions created by the Initial Developer are Copyright (C) 1998
21 # the Initial Developer. All Rights Reserved.
23 # Contributor(s):
24 # Chase Phillips <chase@mozilla.org>
25 # Benjamin Smedberg <benjamin@smedbergs.us>
26 # Jeff Walden <jwalden+code@mit.edu>
28 # Alternatively, the contents of this file may be used under the terms of
29 # either of the GNU General Public License Version 2 or later (the "GPL"),
30 # or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 # in which case the provisions of the GPL or the LGPL are applicable instead
32 # of those above. If you wish to allow use of your version of this file only
33 # under the terms of either the GPL or the LGPL, and not to allow others to
34 # use your version of this file under the terms of the MPL, indicate your
35 # decision by deleting the provisions above and replace them with the notice
36 # and other provisions required by the GPL or the LGPL. If you do not delete
37 # the provisions above, a recipient may use your version of this file under
38 # the terms of any one of the MPL, the GPL or the LGPL.
40 # ***** END LICENSE BLOCK *****
41 ifndef topsrcdir
42 topsrcdir = $(DEPTH)
43 endif
45 ifndef MOZILLA_DIR
46 MOZILLA_DIR = $(topsrcdir)
47 endif
49 ifndef INCLUDED_CONFIG_MK
50 include $(topsrcdir)/config/config.mk
51 endif
53 ifndef INCLUDED_VERSION_MK
54 include $(topsrcdir)/config/version.mk
55 endif
57 REPORT_BUILD = @echo $(notdir $<)
59 ifeq ($(OS_ARCH),OS2)
60 EXEC =
61 else
62 EXEC = exec
63 endif
65 # Don't copy xulrunner files at install time, when using system xulrunner
66 ifdef SYSTEM_LIBXUL
67 SKIP_COPY_XULRUNNER=1
68 endif
70 # ELOG prints out failed command when building silently (gmake -s).
71 ifneq (,$(findstring -s,$(MAKEFLAGS)))
72 ELOG := $(EXEC) sh $(BUILD_TOOLS)/print-failed-commands.sh
73 else
74 ELOG :=
75 endif
77 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
78 ifndef GNU_CC
79 _LIBNAME_RELATIVE_PATHS=1
80 endif
81 endif
83 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
84 PWD := $(shell pwd)
85 _VPATH_SRCS = $(if $(filter /%,$<),$<,$(PWD)/$<)
86 else
87 _VPATH_SRCS = $<
88 endif
90 # Add $(DIST)/lib to VPATH so that -lfoo dependencies are followed
91 VPATH += $(DIST)/lib
92 ifdef LIBXUL_SDK
93 VPATH += $(LIBXUL_SDK)/lib
94 endif
96 # EXPAND_LIBNAME - $(call EXPAND_LIBNAME,foo)
97 # expands to foo.lib on platforms with import libs and -lfoo otherwise
99 # EXPAND_LIBNAME_PATH - $(call EXPAND_LIBNAME_PATH,foo,dir)
100 # expands to dir/foo.lib on platforms with import libs and
101 # -Ldir -lfoo otherwise
103 # EXPAND_MOZLIBNAME - $(call EXPAND_MOZLIBNAME,foo)
104 # expands to $(DIST)/lib/foo.lib on platforms with import libs and
105 # -lfoo otherwise
107 ifdef _LIBNAME_RELATIVE_PATHS
108 EXPAND_LIBNAME = $(foreach lib,$(1),$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
109 EXPAND_LIBNAME_PATH = $(foreach lib,$(1),$(2)/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
110 EXPAND_MOZLIBNAME = $(foreach lib,$(1),$(DIST)/lib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
111 else
112 EXPAND_LIBNAME = $(addprefix -l,$(1))
113 EXPAND_LIBNAME_PATH = -L$(2) $(addprefix -l,$(1))
114 EXPAND_MOZLIBNAME = $(addprefix -l,$(1))
115 endif
117 ifdef EXTRA_DSO_LIBS
118 EXTRA_DSO_LIBS := $(call EXPAND_MOZLIBNAME,$(EXTRA_DSO_LIBS))
119 endif
121 ################################################################################
122 # Testing frameworks support
123 ################################################################################
125 ifdef ENABLE_TESTS
127 ifdef XPCSHELL_TESTS
128 ifndef MODULE
129 $(error Must define MODULE when defining XPCSHELL_TESTS.)
130 endif
132 testxpcobjdir = $(DEPTH)/_tests/xpcshell
134 # Test file installation
135 libs::
136 @$(EXIT_ON_ERROR) \
137 for testdir in $(XPCSHELL_TESTS); do \
138 $(INSTALL) \
139 $(srcdir)/$$testdir/*.js \
140 $(testxpcobjdir)/$(MODULE)/$$testdir; \
141 done
143 # Path formats on Windows are hard. We require a topsrcdir formatted so that
144 # it may be passed to nsILocalFile.initWithPath (in other words, an absolute
145 # path of the form X:\path\to\topsrcdir), which we store in NATIVE_TOPSRCDIR.
146 # We require a forward-slashed path to topsrcdir so that it may be combined
147 # with a relative forward-slashed path for loading scripts, both dynamically
148 # and statically for head/test/tail JS files. Of course, on non-Windows none
149 # of this matters, and things will work correctly because everything's
150 # forward-slashed, everywhere, always.
151 ifdef CYGWIN_WRAPPER
152 NATIVE_TOPSRCDIR := `cygpath -wa $(topsrcdir)`
153 FWDSLASH_TOPSRCDIR := `cygpath -ma $(topsrcdir)`
154 else
155 FWDSLASH_TOPSRCDIR := $(topsrcdir)
156 ifeq ($(HOST_OS_ARCH),WINNT)
157 NATIVE_TOPSRCDIR := $(subst /,\\,$(WIN_TOP_SRC))
158 else
159 NATIVE_TOPSRCDIR := $(topsrcdir)
160 endif
161 endif # CYGWIN_WRAPPER
163 testxpcsrcdir = $(topsrcdir)/testing/xpcshell
165 # Test execution
166 check::
167 @$(EXIT_ON_ERROR) \
168 for testdir in $(XPCSHELL_TESTS); do \
169 $(RUN_TEST_PROGRAM) \
170 $(testxpcsrcdir)/test_all.sh \
171 $(DIST)/bin/xpcshell \
172 $(FWDSLASH_TOPSRCDIR) \
173 $(NATIVE_TOPSRCDIR) \
174 $(testxpcobjdir)/$(MODULE)/$$testdir; \
175 done
177 # Test execution
178 check-interactive::
179 @$(EXIT_ON_ERROR) \
180 $(RUN_TEST_PROGRAM) \
181 $(testxpcsrcdir)/test_one.sh \
182 $(DIST)/bin/xpcshell \
183 $(FWDSLASH_TOPSRCDIR) \
184 $(NATIVE_TOPSRCDIR) \
185 $(testxpcobjdir)/$(MODULE)/$$testdir \
186 $(SOLO_FILE) 1;
188 # Test execution
189 check-one::
190 @$(EXIT_ON_ERROR) \
191 $(RUN_TEST_PROGRAM) \
192 $(testxpcsrcdir)/test_one.sh \
193 $(DIST)/bin/xpcshell \
194 $(FWDSLASH_TOPSRCDIR) \
195 $(NATIVE_TOPSRCDIR) \
196 $(testxpcobjdir)/$(MODULE)/$$testdir \
197 $(SOLO_FILE) 0;
199 endif # XPCSHELL_TESTS
201 ifdef CPP_UNIT_TESTS
203 # Compile the tests to $(DIST)/bin. Make lots of niceties available by default
204 # through TestHarness.h, by modifying the list of includes and the libs against
205 # which stuff links.
206 CPPSRCS += $(CPP_UNIT_TESTS)
207 SIMPLE_PROGRAMS += $(CPP_UNIT_TESTS:.cpp=$(BIN_SUFFIX))
208 REQUIRES += testing xpcom
209 LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS)
211 # ...and run them the usual way
212 check::
213 @$(EXIT_ON_ERROR) \
214 for f in $(subst .cpp,,$(CPP_UNIT_TESTS)); do \
215 XPCOM_DEBUG_BREAK=stack-and-abort $(RUN_TEST_PROGRAM) $(DIST)/bin/$$f; \
216 done
218 endif # CPP_UNIT_TESTS
220 endif # ENABLE_TESTS
224 # Library rules
226 # If BUILD_STATIC_LIBS or FORCE_STATIC_LIB is set, build a static library.
227 # Otherwise, build a shared library.
230 ifndef LIBRARY
231 ifdef STATIC_LIBRARY_NAME
232 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
233 ifdef SHORT_LIBNAME
234 STATIC_LIBRARY_NAME := $(SHORT_LIBNAME)
235 SHARED_LIBRARY_NAME := $(SHORT_LIBNAME)
236 endif
237 endif
238 LIBRARY := $(LIB_PREFIX)$(STATIC_LIBRARY_NAME).$(LIB_SUFFIX)
239 endif # STATIC_LIBRARY_NAME
240 endif # LIBRARY
242 ifndef HOST_LIBRARY
243 ifdef HOST_LIBRARY_NAME
244 HOST_LIBRARY := $(LIB_PREFIX)$(HOST_LIBRARY_NAME).$(LIB_SUFFIX)
245 endif
246 endif
248 ifdef LIBRARY
249 ifneq (_1,$(FORCE_SHARED_LIB)_$(BUILD_STATIC_LIBS))
250 ifdef MKSHLIB
252 ifdef LIB_IS_C_ONLY
253 MKSHLIB = $(MKCSHLIB)
254 endif
256 ifdef MAKE_FRAMEWORK
257 SHARED_LIBRARY := $(SHARED_LIBRARY_NAME)
258 else
259 SHARED_LIBRARY := $(DLL_PREFIX)$(SHARED_LIBRARY_NAME)$(DLL_SUFFIX)
260 endif
262 ifeq ($(OS_ARCH),OS2)
263 DEF_FILE := $(SHARED_LIBRARY:.dll=.def)
264 endif
266 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
267 IMPORT_LIBRARY := $(LIB_PREFIX)$(SHARED_LIBRARY_NAME).$(IMPORT_LIB_SUFFIX)
268 endif
270 ifdef MOZ_ENABLE_LIBXUL
271 EMBED_MANIFEST_AT=2
272 endif
274 endif # MKSHLIB
275 endif # FORCE_SHARED_LIB && !BUILD_STATIC_LIBS
276 endif # LIBRARY
278 ifeq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB))
279 LIBRARY := $(NULL)
280 endif
282 ifeq (_1,$(FORCE_SHARED_LIB)_$(BUILD_STATIC_LIBS))
283 SHARED_LIBRARY := $(NULL)
284 DEF_FILE := $(NULL)
285 IMPORT_LIBRARY := $(NULL)
286 endif
288 ifdef FORCE_STATIC_LIB
289 ifndef FORCE_SHARED_LIB
290 SHARED_LIBRARY := $(NULL)
291 DEF_FILE := $(NULL)
292 IMPORT_LIBRARY := $(NULL)
293 endif
294 endif
296 ifdef FORCE_SHARED_LIB
297 ifndef FORCE_STATIC_LIB
298 LIBRARY := $(NULL)
299 endif
300 endif
302 ifdef JAVA_LIBRARY_NAME
303 JAVA_LIBRARY := $(JAVA_LIBRARY_NAME).jar
304 endif
306 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
307 ifndef GNU_CC
310 # Unless we're building SIMPLE_PROGRAMS, all C++ files share a PDB file per
311 # directory. For parallel builds, this PDB file is shared and locked by
312 # MSPDBSRV.EXE, starting with MSVC8 SP1. If you're using MSVC 7.1 or MSVC8
313 # without SP1, don't do parallel builds.
315 # The final PDB for libraries and programs is created by the linker and uses
316 # a different name from the single PDB file created by the compiler. See
317 # bug 462740.
320 ifdef SIMPLE_PROGRAMS
321 COMPILE_PDBFILE = $(basename $(@F)).pdb
322 else
323 COMPILE_PDBFILE = generated.pdb
324 endif
326 LINK_PDBFILE = $(basename $(@F)).pdb
327 ifdef MOZ_DEBUG
328 CODFILE=$(basename $(@F)).cod
329 endif
331 ifdef MOZ_MAPINFO
332 ifdef SHARED_LIBRARY_NAME
333 MAPFILE=$(SHARED_LIBRARY_NAME).map
334 else
335 MAPFILE=$(basename $(@F)).map
336 endif # SHARED_LIBRARY_NAME
337 endif # MOZ_MAPINFO
339 ifdef DEFFILE
340 OS_LDFLAGS += -DEF:$(DEFFILE)
341 EXTRA_DEPS += $(DEFFILE)
342 endif
344 ifdef MAPFILE
345 OS_LDFLAGS += -MAP:$(MAPFILE)
346 endif
348 endif # !GNU_CC
350 ifdef ENABLE_CXX_EXCEPTIONS
351 ifdef GNU_CC
352 CXXFLAGS += -fexceptions
353 else
354 ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER)))
355 CXXFLAGS += -GX
356 else
357 CXXFLAGS += -EHsc
358 endif # _MSC_VER
359 endif # GNU_CC
360 endif # ENABLE_CXX_EXCEPTIONS
361 endif # WINNT
363 ifeq (,$(filter-out WINNT WINCE,$(HOST_OS_ARCH)))
364 HOST_PDBFILE=$(basename $(@F)).pdb
365 endif
367 ifndef TARGETS
368 TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
369 endif
371 ifndef OBJS
372 _OBJS = \
373 $(JRI_STUB_CFILES) \
374 $(addsuffix .$(OBJ_SUFFIX), $(JMC_GEN)) \
375 $(CSRCS:.c=.$(OBJ_SUFFIX)) \
376 $(patsubst %.cc,%.$(OBJ_SUFFIX),$(CPPSRCS:.cpp=.$(OBJ_SUFFIX))) \
377 $(CMSRCS:.m=.$(OBJ_SUFFIX)) \
378 $(CMMSRCS:.mm=.$(OBJ_SUFFIX)) \
379 $(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX))
380 OBJS = $(strip $(_OBJS))
381 endif
383 ifndef HOST_OBJS
384 _HOST_OBJS = \
385 $(addprefix host_,$(HOST_CSRCS:.c=.$(OBJ_SUFFIX))) \
386 $(addprefix host_,$(patsubst %.cc,%.$(OBJ_SUFFIX),$(HOST_CPPSRCS:.cpp=.$(OBJ_SUFFIX)))) \
387 $(addprefix host_,$(HOST_CMSRCS:.m=.$(OBJ_SUFFIX))) \
388 $(addprefix host_,$(HOST_CMMSRCS:.mm=.$(OBJ_SUFFIX)))
389 HOST_OBJS = $(strip $(_HOST_OBJS))
390 endif
392 LIBOBJS := $(addprefix \", $(OBJS))
393 LIBOBJS := $(addsuffix \", $(LIBOBJS))
395 ifndef MOZ_AUTO_DEPS
396 ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
397 MDDEPFILES = $(addprefix $(MDDEPDIR)/,$(OBJS:.$(OBJ_SUFFIX)=.pp))
398 ifndef NO_GEN_XPT
399 MDDEPFILES += $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.xpt)) \
400 $(addprefix $(MDDEPDIR)/,$(SDK_XPIDLSRCS:.idl=.xpt))
401 endif
402 endif
403 endif
405 ALL_TRASH = \
406 $(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
407 $(filter-out $(ASFILES),$(OBJS:.$(OBJ_SUFFIX)=.s)) $(OBJS:.$(OBJ_SUFFIX)=.ii) \
408 $(OBJS:.$(OBJ_SUFFIX)=.i) \
409 $(HOST_PROGOBJS) $(HOST_OBJS) $(IMPORT_LIBRARY) $(DEF_FILE)\
410 $(EXE_DEF_FILE) so_locations _gen _stubs $(wildcard *.res) $(wildcard *.RES) \
411 $(wildcard *.pdb) $(CODFILE) $(MAPFILE) $(IMPORT_LIBRARY) \
412 $(SHARED_LIBRARY:$(DLL_SUFFIX)=.exp) $(wildcard *.ilk) \
413 $(PROGRAM:$(BIN_SUFFIX)=.exp) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.exp) \
414 $(PROGRAM:$(BIN_SUFFIX)=.lib) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.lib) \
415 $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.$(OBJ_SUFFIX)) \
416 $(wildcard gts_tmp_*) $(LIBRARY:%.a=.%.timestamp)
417 ALL_TRASH_DIRS = \
418 $(GARBAGE_DIRS) /no-such-file
420 ifdef QTDIR
421 GARBAGE += $(MOCSRCS)
422 endif
424 ifdef SIMPLE_PROGRAMS
425 GARBAGE += $(SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX))
426 endif
428 ifdef HOST_SIMPLE_PROGRAMS
429 GARBAGE += $(HOST_SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX))
430 endif
433 # the Solaris WorkShop template repository cache. it occasionally can get
434 # out of sync, so targets like clobber should kill it.
436 ifeq ($(SOLARIS_SUNPRO_CXX),1)
437 GARBAGE_DIRS += SunWS_cache
438 endif
440 ifeq ($(OS_ARCH),OpenVMS)
441 GARBAGE += $(wildcard *.*_defines)
442 ifdef SHARED_LIBRARY
443 VMS_SYMVEC_FILE = $(SHARED_LIBRARY:$(DLL_SUFFIX)=_symvec.opt)
444 ifdef MOZ_DEBUG
445 VMS_SYMVEC_FILE_MODULE = $(topsrcdir)/build/unix/vms/$(notdir $(SHARED_LIBRARY:$(DLL_SUFFIX)=_dbg_symvec.opt))
446 else
447 VMS_SYMVEC_FILE_MODULE = $(topsrcdir)/build/unix/vms/$(notdir $(SHARED_LIBRARY:$(DLL_SUFFIX)=_symvec.opt))
448 endif
449 VMS_SYMVEC_FILE_COMP = $(topsrcdir)/build/unix/vms/component_symvec.opt
450 GARBAGE += $(VMS_SYMVEC_FILE)
451 ifdef IS_COMPONENT
452 DSO_LDOPTS := $(filter-out -auto_symvec,$(DSO_LDOPTS)) $(VMS_SYMVEC_FILE)
453 endif
454 endif
455 endif
457 XPIDL_GEN_DIR = _xpidlgen
459 ifdef MOZ_UPDATE_XTERM
460 # Its good not to have a newline at the end of the titlebar string because it
461 # makes the make -s output easier to read. Echo -n does not work on all
462 # platforms, but we can trick sed into doing it.
463 UPDATE_TITLE = sed -e "s!Y!$@ in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$(dir)!" $(MOZILLA_DIR)/config/xterm.str;
464 UPDATE_TITLE_export = sed -e "s!Y!export in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$*!" $(MOZILLA_DIR)/config/xterm.str;
465 UPDATE_TITLE_libs = sed -e "s!Y!libs in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$*!" $(MOZILLA_DIR)/config/xterm.str;
466 UPDATE_TITLE_tools = sed -e "s!Y!tools in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$*!" $(MOZILLA_DIR)/config/xterm.str;
467 endif
469 ifneq (,$(strip $(DIRS)))
470 LOOP_OVER_DIRS = \
471 @$(EXIT_ON_ERROR) \
472 $(foreach dir,$(DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; )
473 endif
475 # we only use this for the makefiles target and other stuff that doesn't matter
476 ifneq (,$(strip $(PARALLEL_DIRS)))
477 LOOP_OVER_PARALLEL_DIRS = \
478 @$(EXIT_ON_ERROR) \
479 $(foreach dir,$(PARALLEL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; )
480 endif
482 ifneq (,$(strip $(STATIC_DIRS)))
483 LOOP_OVER_STATIC_DIRS = \
484 @$(EXIT_ON_ERROR) \
485 $(foreach dir,$(STATIC_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; )
486 endif
488 ifneq (,$(strip $(TOOL_DIRS)))
489 LOOP_OVER_TOOL_DIRS = \
490 @$(EXIT_ON_ERROR) \
491 $(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; )
492 endif
494 ifdef PARALLEL_DIRS
495 # create a bunch of fake targets for order-only processing
496 PARALLEL_DIRS_export = $(addsuffix _export,$(PARALLEL_DIRS))
497 PARALLEL_DIRS_libs = $(addsuffix _libs,$(PARALLEL_DIRS))
498 PARALLEL_DIRS_tools = $(addsuffix _tools,$(PARALLEL_DIRS))
500 .PHONY: $(PARALLEL_DIRS_export) $(PARALLEL_DIRS_libs) $(PARALLEL_DIRS_tools)
501 endif
504 # Now we can differentiate between objects used to build a library, and
505 # objects used to build an executable in the same directory.
507 ifndef PROGOBJS
508 PROGOBJS = $(OBJS)
509 endif
511 ifndef HOST_PROGOBJS
512 HOST_PROGOBJS = $(HOST_OBJS)
513 endif
515 # MAKE_DIRS: List of directories to build while looping over directories.
516 # A Makefile that needs $(MDDEPDIR) created but doesn't set any of these
517 # variables we know to check can just set NEED_MDDEPDIR explicitly.
518 ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS)$(NEED_MDDEPDIR))
519 MAKE_DIRS += $(CURDIR)/$(MDDEPDIR)
520 GARBAGE_DIRS += $(MDDEPDIR)
521 endif
524 # Tags: emacs (etags), vi (ctags)
525 # TAG_PROGRAM := ctags -L -
527 TAG_PROGRAM = xargs etags -a
530 # Turn on C++ linking if we have any .cpp or .mm files
531 # (moved this from config.mk so that config.mk can be included
532 # before the CPPSRCS are defined)
534 ifneq ($(CPPSRCS)$(CMMSRCS),)
535 CPP_PROG_LINK = 1
536 endif
539 # Make sure to wrap static libs inside linker specific flags to turn on & off
540 # inclusion of all symbols inside the static libs
542 ifndef NO_LD_ARCHIVE_FLAGS
543 ifdef SHARED_LIBRARY_LIBS
544 EXTRA_DSO_LDOPTS := $(MKSHLIB_FORCE_ALL) $(SHARED_LIBRARY_LIBS) $(MKSHLIB_UNFORCE_ALL) $(EXTRA_DSO_LDOPTS)
545 endif
546 endif
549 # This will strip out symbols that the component should not be
550 # exporting from the .dynsym section.
552 ifdef IS_COMPONENT
553 EXTRA_DSO_LDOPTS += $(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
554 endif # IS_COMPONENT
557 # Enforce the requirement that MODULE_NAME must be set
558 # for components in static builds
560 ifdef IS_COMPONENT
561 ifdef EXPORT_LIBRARY
562 ifndef FORCE_SHARED_LIB
563 ifndef MODULE_NAME
564 $(error MODULE_NAME is required for components which may be used in static builds)
565 endif
566 endif
567 endif
568 endif
571 # MacOS X specific stuff
574 ifeq ($(OS_ARCH),Darwin)
575 ifdef SHARED_LIBRARY
576 ifdef IS_COMPONENT
577 EXTRA_DSO_LDOPTS += -bundle
578 else
579 EXTRA_DSO_LDOPTS += -dynamiclib -install_name @executable_path/$(SHARED_LIBRARY) -compatibility_version 1 -current_version 1 -single_module
580 endif
581 endif
582 endif
585 # On NetBSD a.out systems, use -Bsymbolic. This fixes what would otherwise be
586 # fatal symbol name clashes between components.
588 ifeq ($(OS_ARCH),NetBSD)
589 ifeq ($(DLL_SUFFIX),.so.1.0)
590 ifdef IS_COMPONENT
591 EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
592 endif
593 endif
594 endif
596 ifeq ($(OS_ARCH),FreeBSD)
597 ifdef IS_COMPONENT
598 EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
599 endif
600 endif
602 ifeq ($(OS_ARCH),NetBSD)
603 ifneq (,$(filter arc cobalt hpcmips mipsco newsmips pmax sgimips,$(OS_TEST)))
604 ifeq ($(MODULE),layout)
605 OS_CFLAGS += -Wa,-xgot
606 OS_CXXFLAGS += -Wa,-xgot
607 endif
608 endif
609 endif
611 ifeq ($(OS_ARCH),Linux)
612 ifneq (,$(filter mips mipsel,$(OS_TEST)))
613 ifeq ($(MODULE),layout)
614 OS_CFLAGS += -Wa,-xgot
615 OS_CXXFLAGS += -Wa,-xgot
616 endif
617 endif
618 endif
621 # HP-UXBeOS specific section: for COMPONENTS only, add -Bsymbolic flag
622 # which uses internal symbols first
624 ifeq ($(OS_ARCH),HP-UX)
625 ifdef IS_COMPONENT
626 ifeq ($(GNU_CC)$(GNU_CXX),)
627 EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
628 ifneq ($(HAS_EXTRAEXPORTS),1)
629 MKSHLIB += -Wl,+eNSGetModule -Wl,+eerrno
630 MKCSHLIB += +eNSGetModule +eerrno
631 ifneq ($(OS_TEST),ia64)
632 MKSHLIB += -Wl,+e_shlInit
633 MKCSHLIB += +e_shlInit
634 endif # !ia64
635 endif # !HAS_EXTRAEXPORTS
636 endif # non-gnu compilers
637 endif # IS_COMPONENT
638 endif # HP-UX
640 ifeq ($(OS_ARCH),AIX)
641 ifdef IS_COMPONENT
642 ifneq ($(HAS_EXTRAEXPORTS),1)
643 MKSHLIB += -bE:$(MOZILLA_DIR)/build/unix/aix.exp -bnoexpall
644 MKCSHLIB += -bE:$(MOZILLA_DIR)/build/unix/aix.exp -bnoexpall
645 endif # HAS_EXTRAEXPORTS
646 endif # IS_COMPONENT
647 endif # AIX
650 # OSF1: add -B symbolic flag for components
652 ifeq ($(OS_ARCH),OSF1)
653 ifdef IS_COMPONENT
654 ifeq ($(GNU_CC)$(GNU_CXX),)
655 EXTRA_DSO_LDOPTS += -B symbolic
656 endif
657 endif
658 endif
661 # Linux: add -Bsymbolic flag for components
663 ifeq ($(OS_ARCH),Linux)
664 ifdef IS_COMPONENT
665 EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
666 endif
667 endif
670 # MINGW32
672 ifeq ($(OS_ARCH),WINNT)
673 ifdef GNU_CC
674 ifndef IS_COMPONENT
675 DSO_LDOPTS += -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
676 endif
677 endif
678 endif
680 ifeq ($(USE_TVFS),1)
681 IFLAGS1 = -rb
682 IFLAGS2 = -rb
683 else
684 IFLAGS1 = -m 644
685 IFLAGS2 = -m 755
686 endif
688 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
689 OUTOPTION = -Fo# eol
690 else
691 OUTOPTION = -o # eol
692 endif # WINNT && !GNU_CC
693 ifneq (,$(filter WINCE,$(OS_ARCH)))
694 OUTOPTION = -Fo# eol
695 endif
697 ifeq ($(OS_TARGET), WINCE)
698 OUTOPTION = -Fo# eol
699 HOST_OUTOPTION = -Fo# eol
700 else
702 ifeq (,$(CROSS_COMPILE))
703 HOST_OUTOPTION = $(OUTOPTION)
704 else
705 HOST_OUTOPTION = -o # eol
706 endif
708 endif
709 ################################################################################
711 # SUBMAKEFILES: List of Makefiles for next level down.
712 # This is used to update or create the Makefiles before invoking them.
713 SUBMAKEFILES += $(addsuffix /Makefile, $(DIRS) $(TOOL_DIRS) $(PARALLEL_DIRS))
715 # The root makefile doesn't want to do a plain export/libs, because
716 # of the tiers and because of libxul. Suppress the default rules in favor
717 # of something else. Makefiles which use this var *must* provide a sensible
718 # default rule before including rules.mk
719 ifndef SUPPRESS_DEFAULT_RULES
720 ifdef TIERS
721 default all alldep::
722 $(EXIT_ON_ERROR) \
723 $(foreach tier,$(TIERS),$(MAKE) tier_$(tier); ) true
725 else
727 default all::
728 ifneq (,$(strip $(STATIC_DIRS)))
729 $(foreach dir,$(STATIC_DIRS),$(MAKE) -C $(dir); )
730 endif
731 $(MAKE) export
732 $(MAKE) libs
733 $(MAKE) tools
735 # Do depend as well
736 alldep::
737 $(MAKE) export
738 $(MAKE) depend
739 $(MAKE) libs
740 $(MAKE) tools
742 endif # TIERS
743 endif # SUPPRESS_DEFAULT_RULES
745 ifeq ($(filter s,$(MAKEFLAGS)),)
746 ECHO := echo
747 QUIET :=
748 else
749 ECHO := true
750 QUIET := -q
751 endif
753 MAKE_TIER_SUBMAKEFILES = +$(if $(tier_$*_dirs),$(MAKE) $(addsuffix /Makefile,$(tier_$*_dirs)))
755 export_tier_%:
756 @$(ECHO) "$@"
757 @$(MAKE_TIER_SUBMAKEFILES)
758 @$(EXIT_ON_ERROR) \
759 $(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) export; ) true
761 libs_tier_%:
762 @$(ECHO) "$@"
763 @$(MAKE_TIER_SUBMAKEFILES)
764 @$(EXIT_ON_ERROR) \
765 $(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) libs; ) true
767 tools_tier_%:
768 @$(ECHO) "$@"
769 @$(MAKE_TIER_SUBMAKEFILES)
770 @$(EXIT_ON_ERROR) \
771 $(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) tools; ) true
773 $(foreach tier,$(TIERS),tier_$(tier))::
774 @$(ECHO) "$@: $($@_staticdirs) $($@_dirs)"
775 @$(EXIT_ON_ERROR) \
776 $(foreach dir,$($@_staticdirs),$(MAKE) -C $(dir); ) true
777 $(MAKE) export_$@
778 $(MAKE) libs_$@
780 # Do everything from scratch
781 everything::
782 $(MAKE) clean
783 $(MAKE) alldep
785 # Add dummy depend target for tinderboxes
786 depend::
788 ifdef ALL_PLATFORMS
789 all_platforms:: $(NFSPWD)
790 @d=`$(NFSPWD)`; \
791 if test ! -d LOGS; then rm -rf LOGS; mkdir LOGS; else true; fi; \
792 for h in $(PLATFORM_HOSTS); do \
793 echo "On $$h: $(MAKE) $(ALL_PLATFORMS) >& LOGS/$$h.log";\
794 rsh $$h -n "(chdir $$d; \
795 $(MAKE) $(ALL_PLATFORMS) >& LOGS/$$h.log; \
796 echo DONE) &" 2>&1 > LOGS/$$h.pid & \
797 sleep 1; \
798 done
800 $(NFSPWD):
801 cd $(@D); $(MAKE) $(@F)
802 endif
804 # Target to only regenerate makefiles
805 makefiles: $(SUBMAKEFILES)
806 ifneq (,$(DIRS)$(TOOL_DIRS)$(PARALLEL_DIRS))
807 +$(LOOP_OVER_PARALLEL_DIRS)
808 +$(LOOP_OVER_DIRS)
809 +$(LOOP_OVER_TOOL_DIRS)
810 endif
812 ifdef PARALLEL_DIRS
813 export:: $(PARALLEL_DIRS_export)
815 $(PARALLEL_DIRS_export): %_export: %/Makefile
816 +@$(UPDATE_TITLE_export) $(MAKE) -C $* export
817 endif
819 export:: $(SUBMAKEFILES) $(MAKE_DIRS) $(if $(EXPORTS)$(XPIDLSRCS)$(SDK_HEADERS)$(SDK_XPIDLSRCS),$(PUBLIC)) $(if $(SDK_HEADERS)$(SDK_XPIDLSRCS),$(SDK_PUBLIC)) $(if $(XPIDLSRCS),$(IDL_DIR)) $(if $(SDK_XPIDLSRCS),$(SDK_IDL_DIR))
820 +$(LOOP_OVER_DIRS)
821 +$(LOOP_OVER_TOOL_DIRS)
823 ifdef PARALLEL_DIRS
824 tools:: $(PARALLEL_DIRS_tools)
826 $(PARALLEL_DIRS_tools): %_tools: %/Makefile
827 +@$(UPDATE_TITLE_tools) $(MAKE) -C $* tools
828 endif
830 tools:: $(SUBMAKEFILES) $(MAKE_DIRS)
831 +$(LOOP_OVER_DIRS)
832 ifneq (,$(strip $(TOOL_DIRS)))
833 @$(EXIT_ON_ERROR) \
834 $(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) libs; )
835 endif
838 # Rule to create list of libraries for final link
840 export::
841 ifdef LIBRARY_NAME
842 ifdef EXPORT_LIBRARY
843 ifdef IS_COMPONENT
844 ifdef BUILD_STATIC_LIBS
845 @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(STATIC_LIBRARY_NAME)
846 ifdef MODULE_NAME
847 @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMP_NAMES) $(MODULE_NAME)
848 endif
849 endif # BUILD_STATIC_LIBS
850 else # !IS_COMPONENT
851 $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(STATIC_LIBRARY_NAME)
852 endif # IS_COMPONENT
853 endif # EXPORT_LIBRARY
854 endif # LIBRARY_NAME
856 # Create dependencies on static (and shared EXTRA_DSO_LIBS) libraries
857 LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(LIBS))
858 HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(HOST_LIBS))
859 DSO_LDOPTS_DEPS = $(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS))
861 # Dependancies which, if modified, should cause everything to rebuild
862 GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(DEPTH)/config/config.mk
864 ##############################################
865 ifdef PARALLEL_DIRS
866 libs:: $(PARALLEL_DIRS_libs)
868 $(PARALLEL_DIRS_libs): %_libs: %/Makefile
869 +@$(UPDATE_TITLE_libs) $(MAKE) -C $* libs
870 endif
872 libs:: $(SUBMAKEFILES) $(MAKE_DIRS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(HOST_PROGRAM) $(PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
873 ifndef NO_DIST_INSTALL
874 ifdef LIBRARY
875 ifdef EXPORT_LIBRARY # Stage libs that will be linked into a static build
876 ifdef IS_COMPONENT
877 $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib/components
878 else
879 $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib
880 endif
881 endif # EXPORT_LIBRARY
882 ifdef DIST_INSTALL
883 ifdef IS_COMPONENT
884 $(error Shipping static component libs makes no sense.)
885 else
886 $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DIST)/lib
887 endif
888 endif # DIST_INSTALL
889 endif # LIBRARY
890 ifdef SHARED_LIBRARY
891 ifdef IS_COMPONENT
892 $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
893 $(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
894 ifdef BEOS_ADDON_WORKAROUND
895 ( cd $(FINAL_TARGET)/components && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
896 endif
897 else # ! IS_COMPONENT
898 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
899 $(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(DIST)/lib
900 else
901 $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DIST)/lib
902 endif
903 $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)
904 ifdef BEOS_ADDON_WORKAROUND
905 ( cd $(FINAL_TARGET) && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
906 endif
907 endif # IS_COMPONENT
908 endif # SHARED_LIBRARY
909 ifdef PROGRAM
910 $(INSTALL) $(IFLAGS2) $(PROGRAM) $(FINAL_TARGET)
911 endif
912 ifdef SIMPLE_PROGRAMS
913 $(INSTALL) $(IFLAGS2) $(SIMPLE_PROGRAMS) $(FINAL_TARGET)
914 endif
915 ifdef HOST_PROGRAM
916 $(INSTALL) $(IFLAGS2) $(HOST_PROGRAM) $(DIST)/host/bin
917 endif
918 ifdef HOST_SIMPLE_PROGRAMS
919 $(INSTALL) $(IFLAGS2) $(HOST_SIMPLE_PROGRAMS) $(DIST)/host/bin
920 endif
921 ifdef HOST_LIBRARY
922 $(INSTALL) $(IFLAGS1) $(HOST_LIBRARY) $(DIST)/host/lib
923 endif
924 ifdef JAVA_LIBRARY
925 ifdef IS_COMPONENT
926 $(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)/components
927 else
928 $(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)
929 endif
930 endif # JAVA_LIBRARY
931 endif # !NO_DIST_INSTALL
932 +$(LOOP_OVER_DIRS)
934 ##############################################
936 ifndef NO_PROFILE_GUIDED_OPTIMIZE
937 ifneq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
938 ifeq ($(OS_ARCH)_$(GNU_CC)$(INTERNAL_TOOLS), WINNT_)
939 # Force re-linking when building with PGO, since
940 # the MSVC linker does all the work. We force re-link
941 # in both stages so you can do depend builds with PGO.
942 ifdef SHARED_LIBRARY
943 $(SHARED_LIBRARY): FORCE
944 endif
945 ifdef PROGRAM
946 $(PROGRAM): FORCE
947 endif
949 ifdef MOZ_PROFILE_USE
950 # In the second pass, we need to merge the pgc files into the pgd file.
951 # The compiler would do this for us automatically if they were in the right
952 # place, but they're in dist/bin.
953 ifneq (,$(SHARED_LIBRARY)$(PROGRAM))
954 export::
955 ifdef PROGRAM
956 $(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
957 $(PROGRAM:$(BIN_SUFFIX)=) $(DIST)/bin
958 endif
959 ifdef SHARED_LIBRARY
960 $(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
961 $(SHARED_LIBRARY_NAME) $(DIST)/bin
962 endif
963 endif
964 endif # MOZ_PROFILE_USE
965 endif # WINNT_
966 endif # MOZ_PROFILE_GENERATE || MOZ_PROFILE_USE
967 endif # NO_PROFILE_GUIDED_OPTIMIZE
969 ##############################################
971 checkout:
972 $(MAKE) -C $(topsrcdir) -f client.mk checkout
974 run_viewer: $(FINAL_TARGET)/viewer
975 cd $(FINAL_TARGET); \
976 MOZILLA_FIVE_HOME=`pwd` \
977 LD_LIBRARY_PATH=".:$(LIBS_PATH):$$LD_LIBRARY_PATH" \
978 viewer
980 clean clobber realclean clobber_all:: $(SUBMAKEFILES)
981 -rm -f $(ALL_TRASH)
982 -rm -rf $(ALL_TRASH_DIRS)
983 +-$(LOOP_OVER_PARALLEL_DIRS)
984 +-$(LOOP_OVER_DIRS)
985 +-$(LOOP_OVER_STATIC_DIRS)
986 +-$(LOOP_OVER_TOOL_DIRS)
988 distclean:: $(SUBMAKEFILES)
989 +-$(LOOP_OVER_PARALLEL_DIRS)
990 +-$(LOOP_OVER_DIRS)
991 +-$(LOOP_OVER_STATIC_DIRS)
992 +-$(LOOP_OVER_TOOL_DIRS)
993 -rm -rf $(ALL_TRASH_DIRS)
994 -rm -f $(ALL_TRASH) \
995 Makefile .HSancillary \
996 $(wildcard *.$(OBJ_SUFFIX)) $(wildcard *.ho) $(wildcard host_*.o*) \
997 $(wildcard *.$(LIB_SUFFIX)) $(wildcard *$(DLL_SUFFIX)) \
998 $(wildcard *.$(IMPORT_LIB_SUFFIX))
999 ifeq ($(OS_ARCH),OS2)
1000 -rm -f $(PROGRAM:.exe=.map)
1001 endif
1003 alltags:
1004 rm -f TAGS
1005 find $(topsrcdir) -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' -o -name '*.idl' \) -print | $(TAG_PROGRAM)
1008 # PROGRAM = Foo
1009 # creates OBJS, links with LIBS to create Foo
1011 $(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) $(EXE_DEF_FILE) $(RESFILE) $(GLOBAL_DEPS)
1012 ifeq (WINCE,$(OS_ARCH))
1013 $(LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1014 else
1015 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
1016 $(LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1017 ifdef MSMANIFEST_TOOL
1018 @if test -f $@.manifest; then \
1019 if test -f "$(srcdir)/$@.manifest"; then \
1020 mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
1021 else \
1022 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
1023 fi; \
1024 rm -f $@.manifest; \
1026 endif # MSVC with manifest tool
1027 else
1028 ifeq ($(CPP_PROG_LINK),1)
1029 $(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(EXE_DEF_FILE)
1030 else # ! CPP_PROG_LINK
1031 $(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
1032 endif # CPP_PROG_LINK
1033 endif # WINNT && !GNU_CC
1034 endif # WINCE
1036 ifdef ENABLE_STRIP
1037 $(STRIP) $@
1038 endif
1039 ifdef MOZ_POST_PROGRAM_COMMAND
1040 $(MOZ_POST_PROGRAM_COMMAND) $@
1041 endif
1042 ifeq ($(OS_ARCH),BeOS)
1043 ifdef BEOS_PROGRAM_RESOURCE
1044 xres -o $@ $(BEOS_PROGRAM_RESOURCE)
1045 mimeset $@
1046 endif
1047 endif # BeOS
1049 $(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
1050 ifeq (WINCE,$(OS_ARCH))
1051 $(HOST_LD) -NOLOGO -OUT:$@ $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1052 else
1053 ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
1054 $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1055 ifdef MSMANIFEST_TOOL
1056 @if test -f $@.manifest; then \
1057 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
1058 rm -f $@.manifest; \
1060 endif # MSVC with manifest tool
1061 else
1062 ifeq ($(CPP_PROG_LINK),1)
1063 $(HOST_CXX) -o $@ $(HOST_CXXFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1064 else
1065 $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1066 endif # CPP_PROG_LINK
1067 endif
1068 endif
1071 # This is an attempt to support generation of multiple binaries
1072 # in one directory, it assumes everything to compile Foo is in
1073 # Foo.o (from either Foo.c or Foo.cpp).
1075 # SIMPLE_PROGRAMS = Foo Bar
1076 # creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
1078 $(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
1079 ifeq (WINCE,$(OS_ARCH))
1080 $(LD) -nologo -entry:main -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1081 else
1082 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
1083 $(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1084 ifdef MSMANIFEST_TOOL
1085 @if test -f $@.manifest; then \
1086 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
1087 rm -f $@.manifest; \
1089 endif # MSVC with manifest tool
1090 else
1091 ifeq ($(CPP_PROG_LINK),1)
1092 $(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS)
1093 else
1094 $(CC) $(WRAP_MALLOC_CFLAGS) $(CFLAGS) $(OUTOPTION)$@ $< $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS)
1095 endif # CPP_PROG_LINK
1096 endif # WINNT && !GNU_CC
1097 endif # WINCE
1099 ifdef ENABLE_STRIP
1100 $(STRIP) $@
1101 endif
1102 ifdef MOZ_POST_PROGRAM_COMMAND
1103 $(MOZ_POST_PROGRAM_COMMAND) $@
1104 endif
1106 $(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(OBJ_SUFFIX) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
1107 ifeq (WINCE,$(OS_ARCH))
1108 $(HOST_LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1109 else
1110 ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
1111 $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1112 else
1113 ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX))
1114 $(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXXFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1115 else
1116 $(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_CFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1117 endif
1118 endif
1119 endif
1122 # Purify target. Solaris/sparc only to start.
1123 # Purify does not recognize "egcs" or "c++" so we go with
1124 # "gcc" and "g++" for now.
1126 pure: $(PROGRAM)
1127 ifeq ($(CPP_PROG_LINK),1)
1128 $(PURIFY) $(CCC) -o $^.pure $(CXXFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1129 else
1130 $(PURIFY) $(CC) -o $^.pure $(CFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1131 endif
1132 ifndef NO_DIST_INSTALL
1133 $(INSTALL) $(IFLAGS2) $^.pure $(FINAL_TARGET)
1134 endif
1136 quantify: $(PROGRAM)
1137 ifeq ($(CPP_PROG_LINK),1)
1138 $(QUANTIFY) $(CCC) -o $^.quantify $(CXXFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1139 else
1140 $(QUANTIFY) $(CC) -o $^.quantify $(CFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1141 endif
1142 ifndef NO_DIST_INSTALL
1143 $(INSTALL) $(IFLAGS2) $^.quantify $(FINAL_TARGET)
1144 endif
1147 # This allows us to create static versions of the shared libraries
1148 # that are built using other static libraries. Confused...?
1150 ifdef SHARED_LIBRARY_LIBS
1151 ifeq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
1152 ifneq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB))
1153 LOBJS += $(SHARED_LIBRARY_LIBS)
1154 endif
1155 else
1156 ifneq (,$(filter OSF1 BSD_OS FreeBSD NetBSD OpenBSD SunOS Darwin,$(OS_ARCH)))
1157 CLEANUP1 := | egrep -v '(________64ELEL_|__.SYMDEF)'
1158 CLEANUP2 := rm -f ________64ELEL_ __.SYMDEF
1159 else
1160 CLEANUP2 := true
1161 endif
1162 SUB_LOBJS = $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
1163 endif
1164 endif
1165 ifdef MOZILLA_PROBE_LIBS
1166 PROBE_LOBJS = $(shell for lib in $(MOZILLA_PROBE_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
1167 endif
1168 ifdef DTRACE_PROBE_OBJ
1169 EXTRA_DEPS += $(DTRACE_PROBE_OBJ)
1170 endif
1172 $(LIBRARY): $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
1173 rm -f $@
1174 ifneq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
1175 ifdef SHARED_LIBRARY_LIBS
1176 @rm -f $(SUB_LOBJS)
1177 @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1178 endif
1179 endif
1180 $(AR) $(AR_FLAGS) $(OBJS) $(LOBJS) $(SUB_LOBJS)
1181 $(RANLIB) $@
1182 @rm -f foodummyfilefoo $(SUB_LOBJS)
1184 ifeq (,$(filter-out WINNT WINCE, $(OS_ARCH)))
1185 $(IMPORT_LIBRARY): $(SHARED_LIBRARY)
1186 endif
1188 ifeq ($(OS_ARCH),OS2)
1189 $(DEF_FILE): $(OBJS) $(SHARED_LIBRARY_LIBS)
1190 rm -f $@
1191 echo LIBRARY $(SHARED_LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@
1192 echo PROTMODE >> $@
1193 echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@
1194 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
1195 echo EXPORTS >> $@
1196 ifeq ($(IS_COMPONENT),1)
1197 ifeq ($(HAS_EXTRAEXPORTS),1)
1198 ifndef MOZ_OS2_USE_DECLSPEC
1199 $(FILTER) $(OBJS) $(SHARED_LIBRARY_LIBS) >> $@
1200 endif
1201 else
1202 echo _NSGetModule >> $@
1203 endif
1204 else
1205 ifndef MOZ_OS2_USE_DECLSPEC
1206 $(FILTER) $(OBJS) $(SHARED_LIBRARY_LIBS) >> $@
1207 endif
1208 endif
1209 $(ADD_TO_DEF_FILE)
1211 ifdef MOZ_OS2_USE_DECLSPEC
1212 $(IMPORT_LIBRARY): $(SHARED_LIBRARY)
1213 else
1214 $(IMPORT_LIBRARY): $(DEF_FILE)
1215 endif
1216 rm -f $@
1217 $(IMPLIB) $@ $^
1218 $(RANLIB) $@
1219 endif # OS/2
1221 $(HOST_LIBRARY): $(HOST_OBJS) Makefile
1222 rm -f $@
1223 $(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
1224 $(HOST_RANLIB) $@
1226 ifdef NO_LD_ARCHIVE_FLAGS
1227 SUB_SHLOBJS = $(SUB_LOBJS)
1228 endif
1230 ifdef HAVE_DTRACE
1231 ifndef XP_MACOSX
1232 ifdef DTRACE_PROBE_OBJ
1233 ifndef DTRACE_LIB_DEPENDENT
1234 $(DTRACE_PROBE_OBJ): $(OBJS)
1235 dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(OBJS)
1236 endif
1237 endif
1238 endif
1239 endif
1241 # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
1242 # so instead of deleting .o files after repacking them into a dylib, we make
1243 # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
1244 # so no need to conditionalize on OS version or debugging format.
1246 $(SHARED_LIBRARY): $(OBJS) $(LOBJS) $(DEF_FILE) $(RESFILE) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(DSO_LDOPTS_DEPS) $(GLOBAL_DEPS)
1247 ifndef INCREMENTAL_LINKER
1248 rm -f $@
1249 endif
1250 ifeq ($(OS_ARCH),OpenVMS)
1251 @if test ! -f $(VMS_SYMVEC_FILE); then \
1252 if test -f $(VMS_SYMVEC_FILE_MODULE); then \
1253 echo Creating specific component options file $(VMS_SYMVEC_FILE); \
1254 cp $(VMS_SYMVEC_FILE_MODULE) $(VMS_SYMVEC_FILE); \
1255 fi; \
1257 ifdef IS_COMPONENT
1258 @if test ! -f $(VMS_SYMVEC_FILE); then \
1259 echo Creating generic component options file $(VMS_SYMVEC_FILE); \
1260 cp $(VMS_SYMVEC_FILE_COMP) $(VMS_SYMVEC_FILE); \
1262 endif
1263 endif # OpenVMS
1264 ifdef NO_LD_ARCHIVE_FLAGS
1265 ifdef SHARED_LIBRARY_LIBS
1266 @rm -f $(SUB_SHLOBJS)
1267 @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1268 ifeq ($(OS_ARCH),Darwin)
1269 @echo Making symlinks to the original object files in the archive libraries $(SHARED_LIBRARY_LIBS)
1270 @for lib in $(SHARED_LIBRARY_LIBS); do \
1271 libdir=`echo $$lib|sed -e 's,/[^/]*\.a,,'`; \
1272 ofiles=`$(AR_LIST) $${lib}`; \
1273 for ofile in $$ofiles; do \
1274 if [ -f $$libdir/$$ofile ]; then \
1275 rm -f $$ofile; \
1276 ln -s $$libdir/$$ofile $$ofile; \
1277 fi; \
1278 done; \
1279 done
1280 endif
1281 endif # SHARED_LIBRARY_LIBS
1282 endif # NO_LD_ARCHIVE_FLAGS
1283 ifdef DTRACE_LIB_DEPENDENT
1284 @rm -f $(PROBE_LOBJS)
1285 @for lib in $(MOZILLA_PROBE_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1286 ifndef XP_MACOSX
1287 dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS)
1288 endif
1289 @for lib in $(MOZILLA_PROBE_LIBS); do \
1290 ofiles=`$(AR_LIST) $${lib}`; \
1291 $(AR_DELETE) $${lib} $$ofiles; \
1292 done
1293 $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
1294 @rm -f $(PROBE_LOBJS)
1295 @rm -f $(DTRACE_PROBE_OBJ)
1296 @for lib in $(MOZILLA_PROBE_LIBS); do \
1297 if [ -L $${lib} ]; then rm -f `readlink $${lib}`; fi; \
1298 done
1299 @rm -f $(MOZILLA_PROBE_LIBS)
1301 else # ! DTRACE_LIB_DEPENDENT
1302 $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
1303 endif # DTRACE_LIB_DEPENDENT
1305 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
1306 ifdef MSMANIFEST_TOOL
1307 ifdef EMBED_MANIFEST_AT
1308 @if test -f $@.manifest; then \
1309 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
1310 rm -f $@.manifest; \
1312 endif # EMBED_MANIFEST_AT
1313 endif # MSVC with manifest tool
1314 endif # WINNT && !GCC
1315 ifeq ($(OS_ARCH),Darwin)
1316 else # non-Darwin
1317 @rm -f $(SUB_SHLOBJS)
1318 endif # Darwin
1319 @rm -f foodummyfilefoo $(DELETE_AFTER_LINK)
1320 chmod +x $@
1321 ifdef ENABLE_STRIP
1322 $(STRIP) $@
1323 endif
1324 ifdef MOZ_POST_DSO_LIB_COMMAND
1325 $(MOZ_POST_DSO_LIB_COMMAND) $@
1326 endif
1328 ifdef MOZ_AUTO_DEPS
1329 ifdef COMPILER_DEPEND
1330 ifeq ($(SOLARIS_SUNPRO_CC),1)
1331 _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
1333 define MAKE_DEPS_AUTO_CC
1334 if test -d $(@D); then \
1335 echo "Building deps for $< using Sun Studio cc"; \
1336 $(CC) $(COMPILE_CFLAGS) -xM $< >$(_MDDEPFILE) ; \
1338 endef
1339 define MAKE_DEPS_AUTO_CXX
1340 if test -d $(@D); then \
1341 echo "Building deps for $< using Sun Studio CC"; \
1342 $(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \
1344 endef
1345 endif # Sun Studio on Solaris
1346 else # COMPILER_DEPEND
1348 # Generate dependencies on the fly
1350 _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
1352 define MAKE_DEPS_AUTO
1353 if test -d $(@D); then \
1354 echo "Building deps for $<"; \
1355 $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f- $(DEFINES) $(ACDEFINES) $(INCLUDES) $< 2>/dev/null | sed -e "s|^[^ ]*/||" > $(_MDDEPFILE) ; \
1357 endef
1359 MAKE_DEPS_AUTO_CC = $(MAKE_DEPS_AUTO)
1360 MAKE_DEPS_AUTO_CXX = $(MAKE_DEPS_AUTO)
1362 endif # COMPILER_DEPEND
1364 endif # MOZ_AUTO_DEPS
1366 ifdef MOZ_MEMORY
1367 ifeq ($(OS_ARCH),SunOS)
1368 SOLARIS_JEMALLOC_LDFLAGS = $(call EXPAND_LIBNAME_PATH,jemalloc,$(DIST)/lib)
1369 endif
1370 endif
1372 # Rules for building native targets must come first because of the host_ prefix
1373 host_%.$(OBJ_SUFFIX): %.c $(GLOBAL_DEPS)
1374 $(REPORT_BUILD)
1375 $(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1377 host_%.$(OBJ_SUFFIX): %.cpp $(GLOBAL_DEPS)
1378 $(REPORT_BUILD)
1379 $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1381 host_%.$(OBJ_SUFFIX): %.cc $(GLOBAL_DEPS)
1382 $(REPORT_BUILD)
1383 $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1385 host_%.$(OBJ_SUFFIX): %.m $(GLOBAL_DEPS)
1386 $(REPORT_BUILD)
1387 $(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1389 host_%.$(OBJ_SUFFIX): %.mm $(GLOBAL_DEPS)
1390 $(REPORT_BUILD)
1391 $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1393 %: %.c $(GLOBAL_DEPS)
1394 $(REPORT_BUILD)
1395 @$(MAKE_DEPS_AUTO_CC)
1396 $(ELOG) $(CC) $(CFLAGS) $(LDFLAGS) $(OUTOPTION)$@ $(_VPATH_SRCS)
1398 %.$(OBJ_SUFFIX): %.c $(GLOBAL_DEPS)
1399 $(REPORT_BUILD)
1400 @$(MAKE_DEPS_AUTO_CC)
1401 $(ELOG) $(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $(_VPATH_SRCS)
1403 moc_%.cpp: %.h $(GLOBAL_DEPS)
1404 $(MOC) $< $(OUTOPTION)$@
1406 ifdef ASFILES
1407 # The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
1408 # a '-c' flag.
1409 %.$(OBJ_SUFFIX): %.$(ASM_SUFFIX) $(GLOBAL_DEPS)
1410 $(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) $(_VPATH_SRCS)
1411 endif
1413 %.$(OBJ_SUFFIX): %.S $(GLOBAL_DEPS)
1414 $(AS) -o $@ $(ASFLAGS) -c $<
1416 %: %.cpp $(GLOBAL_DEPS)
1417 @$(MAKE_DEPS_AUTO_CXX)
1418 $(CCC) $(OUTOPTION)$@ $(CXXFLAGS) $(_VPATH_SRCS) $(LDFLAGS)
1421 # Please keep the next two rules in sync.
1423 %.$(OBJ_SUFFIX): %.cc $(GLOBAL_DEPS)
1424 $(REPORT_BUILD)
1425 @$(MAKE_DEPS_AUTO_CXX)
1426 $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1428 %.$(OBJ_SUFFIX): %.cpp $(GLOBAL_DEPS)
1429 $(REPORT_BUILD)
1430 @$(MAKE_DEPS_AUTO_CXX)
1431 ifdef STRICT_CPLUSPLUS_SUFFIX
1432 echo "#line 1 \"$*.cpp\"" | cat - $*.cpp > t_$*.cc
1433 $(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) t_$*.cc
1434 rm -f t_$*.cc
1435 else
1436 $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1437 endif #STRICT_CPLUSPLUS_SUFFIX
1439 $(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.mm $(GLOBAL_DEPS)
1440 $(REPORT_BUILD)
1441 @$(MAKE_DEPS_AUTO_CXX)
1442 $(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(_VPATH_SRCS)
1444 $(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.m $(GLOBAL_DEPS)
1445 $(REPORT_BUILD)
1446 @$(MAKE_DEPS_AUTO_CC)
1447 $(ELOG) $(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $(_VPATH_SRCS)
1449 %.s: %.cpp
1450 $(CCC) -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1452 %.s: %.cc
1453 $(CCC) -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1455 %.s: %.c
1456 $(CC) -S $(COMPILE_CFLAGS) $(_VPATH_SRCS)
1458 %.i: %.cpp
1459 $(CCC) -C -E $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) > $*.i
1461 %.i: %.cc
1462 $(CCC) -C -E $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) > $*.i
1464 %.i: %.c
1465 $(CC) -C -E $(COMPILE_CFLAGS) $(_VPATH_SRCS) > $*.i
1467 %.i: %.mm
1468 $(CCC) -C -E $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(_VPATH_SRCS) > $*.i
1470 %.res: %.rc
1471 @echo Creating Resource file: $@
1472 ifeq ($(OS_ARCH),OS2)
1473 $(RC) $(RCFLAGS:-D%=-d %) -i $(subst /,\,$(srcdir)) -r $< $@
1474 else
1475 ifdef GNU_CC
1476 $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) $(OUTOPTION)$@ $(_VPATH_SRCS)
1477 else
1478 $(RC) $(RCFLAGS) -r $(DEFINES) $(INCLUDES) $(OUTOPTION)$@ $(_VPATH_SRCS)
1479 endif
1480 endif
1482 # need 3 separate lines for OS/2
1483 %: %.pl
1484 rm -f $@
1485 cp $< $@
1486 chmod +x $@
1488 %: %.sh
1489 rm -f $@; cp $< $@; chmod +x $@
1491 # Cancel these implicit rules
1493 %: %,v
1495 %: RCS/%,v
1497 %: s.%
1499 %: SCCS/s.%
1501 ###############################################################################
1502 # Java rules
1503 ###############################################################################
1504 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
1505 SEP := ;
1506 else
1507 SEP := :
1508 endif
1510 EMPTY :=
1511 SPACE := $(EMPTY) $(EMPTY)
1513 # Cygwin and MSYS have their own special path form, but javac expects the source
1514 # and class paths to be in the DOS form (i.e. e:/builds/...). This function
1515 # does the appropriate conversion on Windows, but is a noop on other systems.
1516 ifeq (,$(filter-out WINNT WINCE, $(HOST_OS_ARCH)))
1517 ifdef CYGWIN_WRAPPER
1518 normalizepath = $(foreach p,$(1),$(shell cygpath -m $(p)))
1519 else
1520 # assume MSYS
1521 # We use 'pwd -W' to get DOS form of the path. However, since the given path
1522 # could be a file or a non-existent path, we cannot call 'pwd -W' directly
1523 # on the path. Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
1524 # on it, then merge with the rest of the path.
1525 root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\1|")
1526 non-root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\2|")
1527 normalizepath = $(foreach p,$(1),$(if $(filter /%,$(1)),$(shell cd $(call root-path,$(1)) && pwd -W)$(call non-root-path,$(1)),$(1)))
1528 endif
1529 else
1530 normalizepath = $(1)
1531 endif
1533 _srcdir = $(call normalizepath,$(srcdir))
1534 ifdef JAVA_SOURCEPATH
1535 SP = $(subst $(SPACE),$(SEP),$(call normalizepath,$(strip $(JAVA_SOURCEPATH))))
1536 _JAVA_SOURCEPATH = ".$(SEP)$(_srcdir)$(SEP)$(SP)"
1537 else
1538 _JAVA_SOURCEPATH = ".$(SEP)$(_srcdir)"
1539 endif
1541 ifdef JAVA_CLASSPATH
1542 CP = $(subst $(SPACE),$(SEP),$(call normalizepath,$(strip $(JAVA_CLASSPATH))))
1543 _JAVA_CLASSPATH = ".$(SEP)$(CP)"
1544 else
1545 _JAVA_CLASSPATH = .
1546 endif
1548 _JAVA_DIR = _java
1549 $(_JAVA_DIR)::
1550 $(NSINSTALL) -D $@
1552 $(_JAVA_DIR)/%.class: %.java $(GLOBAL_DEPS) $(_JAVA_DIR)
1553 $(CYGWIN_WRAPPER) $(JAVAC) $(JAVAC_FLAGS) -classpath $(_JAVA_CLASSPATH) \
1554 -sourcepath $(_JAVA_SOURCEPATH) -d $(_JAVA_DIR) $(_VPATH_SRCS)
1556 $(JAVA_LIBRARY): $(addprefix $(_JAVA_DIR)/,$(JAVA_SRCS:.java=.class)) $(GLOBAL_DEPS)
1557 $(JAR) cf $@ -C $(_JAVA_DIR) .
1559 GARBAGE_DIRS += $(_JAVA_DIR)
1561 ###############################################################################
1562 # Update Makefiles
1563 ###############################################################################
1565 # In GNU make 3.80, makefiles must use the /cygdrive syntax, even if we're
1566 # processing them with AS perl. See bug 232003
1567 ifdef AS_PERL
1568 CYGWIN_TOPSRCDIR = -nowrap -p $(topsrcdir) -wrap
1569 endif
1571 # Note: Passing depth to make-makefile is optional.
1572 # It saves the script some work, though.
1573 Makefile: Makefile.in
1574 @$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR)
1576 ifdef SUBMAKEFILES
1577 # VPATH does not work on some machines in this case, so add $(srcdir)
1578 $(SUBMAKEFILES): % : $(srcdir)/%.in
1579 $(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR) $@
1580 endif
1582 ifdef AUTOUPDATE_CONFIGURE
1583 $(topsrcdir)/configure: $(topsrcdir)/configure.in
1584 (cd $(topsrcdir) && $(AUTOCONF)) && (cd $(DEPTH) && ./config.status --recheck)
1585 endif
1587 ###############################################################################
1588 # Bunch of things that extend the 'export' rule (in order):
1589 ###############################################################################
1591 ################################################################################
1592 # Copy each element of EXPORTS to $(PUBLIC)
1594 ifneq ($(EXPORTS)$(XPIDLSRCS)$(SDK_HEADERS)$(SDK_XPIDLSRCS),)
1595 $(SDK_PUBLIC) $(PUBLIC):
1596 $(NSINSTALL) -D $@
1597 endif
1599 ifdef MOZ_JAVAXPCOM
1600 ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1601 $(JAVA_DIST_DIR)::
1602 $(NSINSTALL) -D $@
1603 endif
1604 endif
1606 ifneq ($(XPI_NAME),)
1607 $(FINAL_TARGET):
1608 $(NSINSTALL) -D $@
1610 export:: $(FINAL_TARGET)
1611 endif
1613 ifndef NO_DIST_INSTALL
1614 ifneq ($(EXPORTS),)
1615 export:: $(EXPORTS) $(PUBLIC)
1616 $(INSTALL) $(IFLAGS1) $^
1617 endif
1619 ifneq ($(SDK_HEADERS),)
1620 export:: $(SDK_HEADERS) $(SDK_PUBLIC)
1621 $(INSTALL) $(IFLAGS1) $^
1623 export:: $(SDK_HEADERS) $(PUBLIC)
1624 $(INSTALL) $(IFLAGS1) $^
1625 endif
1626 endif # NO_DIST_INSTALL
1628 ################################################################################
1629 # Copy each element of PREF_JS_EXPORTS
1631 ifdef GRE_MODULE
1632 PREF_DIR = greprefs
1633 else
1634 ifneq (,$(XPI_NAME)$(LIBXUL_SDK))
1635 PREF_DIR = defaults/preferences
1636 else
1637 PREF_DIR = defaults/pref
1638 endif
1639 endif
1641 ifneq ($(PREF_JS_EXPORTS),)
1642 # on win32, pref files need CRLF line endings... see bug 206029
1643 ifeq (WINNT,$(OS_ARCH))
1644 PREF_PPFLAGS = --line-endings=crlf
1645 endif
1647 ifndef NO_DIST_INSTALL
1648 $(FINAL_TARGET)/$(PREF_DIR):
1649 $(NSINSTALL) -D $@
1651 libs:: $(FINAL_TARGET)/$(PREF_DIR) $(PREF_JS_EXPORTS)
1652 $(EXIT_ON_ERROR) \
1653 for i in $(PREF_JS_EXPORTS); do \
1654 dest=$(FINAL_TARGET)/$(PREF_DIR)/`basename $$i`; \
1655 $(RM) -f $$dest; \
1656 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1657 done
1658 endif
1659 endif
1661 ################################################################################
1662 # Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
1664 ifneq ($(AUTOCFG_JS_EXPORTS),)
1665 $(FINAL_TARGET)/defaults/autoconfig::
1666 $(NSINSTALL) -D $@
1668 ifndef NO_DIST_INSTALL
1669 export:: $(AUTOCFG_JS_EXPORTS) $(FINAL_TARGET)/defaults/autoconfig
1670 $(INSTALL) $(IFLAGS1) $^
1671 endif
1673 endif
1674 ################################################################################
1675 # Export the elements of $(XPIDLSRCS) & $(SDK_XPIDLSRCS),
1676 # generating .h and .xpt files and moving them to the appropriate places.
1678 ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1680 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))
1682 ifndef XPIDL_MODULE
1683 XPIDL_MODULE = $(MODULE)
1684 endif
1686 ifeq ($(XPIDL_MODULE),) # we need $(XPIDL_MODULE) to make $(XPIDL_MODULE).xpt
1687 export:: FORCE
1688 @echo
1689 @echo "*** Error processing XPIDLSRCS:"
1690 @echo "Please define MODULE or XPIDL_MODULE when defining XPIDLSRCS,"
1691 @echo "so we have a module name to use when creating MODULE.xpt."
1692 @echo; sleep 2; false
1693 endif
1695 $(SDK_IDL_DIR) $(IDL_DIR)::
1696 $(NSINSTALL) -D $@
1698 # generate .h files from into $(XPIDL_GEN_DIR), then export to $(PUBLIC);
1699 # warn against overriding existing .h file.
1700 $(XPIDL_GEN_DIR)/.done:
1701 @if test ! -d $(XPIDL_GEN_DIR); then echo Creating $(XPIDL_GEN_DIR)/.done; rm -rf $(XPIDL_GEN_DIR); mkdir $(XPIDL_GEN_DIR); fi
1702 @touch $@
1704 # don't depend on $(XPIDL_GEN_DIR), because the modification date changes
1705 # with any addition to the directory, regenerating all .h files -> everything.
1707 $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
1708 $(REPORT_BUILD)
1709 $(ELOG) $(XPIDL_COMPILE) -m header -w $(XPIDL_FLAGS) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
1710 @if test -n "$(findstring $*.h, $(EXPORTS) $(SDK_HEADERS))"; \
1711 then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
1713 ifndef NO_GEN_XPT
1714 # generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link
1715 # into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
1716 $(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
1717 $(REPORT_BUILD)
1718 $(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$*.pp $(_VPATH_SRCS)
1720 # no need to link together if XPIDLSRCS contains only XPIDL_MODULE
1721 ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))
1722 $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS) $(SDK_XPIDLSRCS)) $(GLOBAL_DEPS) $(XPIDL_LINK)
1723 $(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS) $(SDK_XPIDLSRCS))
1724 endif # XPIDL_MODULE.xpt != XPIDLSRCS
1726 libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
1727 ifndef NO_DIST_INSTALL
1728 $(INSTALL) $(IFLAGS1) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(FINAL_TARGET)/components
1729 endif
1731 endif # NO_GEN_XPT
1733 GARBAGE_DIRS += $(XPIDL_GEN_DIR)
1735 endif # XPIDLSRCS || SDK_XPIDLSRCS
1737 ifneq ($(XPIDLSRCS),)
1738 # export .idl files to $(IDL_DIR)
1739 ifndef NO_DIST_INSTALL
1740 export:: $(XPIDLSRCS) $(IDL_DIR)
1741 $(INSTALL) $(IFLAGS1) $^
1743 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) $(PUBLIC)
1744 $(INSTALL) $(IFLAGS1) $^
1745 endif # NO_DIST_INSTALL
1747 endif # XPIDLSRCS
1752 # General rules for exporting idl files.
1754 # WORK-AROUND ONLY, for mozilla/tools/module-deps/bootstrap.pl build.
1755 # Bug to fix idl dependency problems w/o this extra build pass is
1756 # http://bugzilla.mozilla.org/show_bug.cgi?id=145777
1758 $(IDL_DIR)::
1759 $(NSINSTALL) -D $@
1761 export-idl:: $(SUBMAKEFILES) $(MAKE_DIRS)
1763 ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1764 ifndef NO_DIST_INSTALL
1765 export-idl:: $(XPIDLSRCS) $(SDK_XPIDLSRCS) $(IDL_DIR)
1766 $(INSTALL) $(IFLAGS1) $^
1767 endif
1768 endif
1769 +$(LOOP_OVER_PARALLEL_DIRS)
1770 +$(LOOP_OVER_DIRS)
1771 +$(LOOP_OVER_TOOL_DIRS)
1776 ifneq ($(SDK_XPIDLSRCS),)
1777 # export .idl files to $(IDL_DIR) & $(SDK_IDL_DIR)
1778 ifndef NO_DIST_INSTALL
1779 export:: $(SDK_XPIDLSRCS) $(IDL_DIR)
1780 $(INSTALL) $(IFLAGS1) $^
1782 export:: $(SDK_XPIDLSRCS) $(SDK_IDL_DIR)
1783 $(INSTALL) $(IFLAGS1) $^
1785 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(SDK_XPIDLSRCS)) $(PUBLIC)
1786 $(INSTALL) $(IFLAGS1) $^
1788 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(SDK_XPIDLSRCS)) $(SDK_PUBLIC)
1789 $(INSTALL) $(IFLAGS1) $^
1790 endif
1792 endif # SDK_XPIDLSRCS
1796 ifdef MOZ_JAVAXPCOM
1797 ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1799 JAVA_XPIDLSRCS = $(XPIDLSRCS) $(SDK_XPIDLSRCS)
1801 # A single IDL file can contain multiple interfaces, which result in multiple
1802 # Java interface files. So use hidden dependency files.
1803 JAVADEPFILES = $(addprefix $(JAVA_GEN_DIR)/.,$(JAVA_XPIDLSRCS:.idl=.java.pp))
1805 $(JAVA_GEN_DIR):
1806 $(NSINSTALL) -D $@
1807 GARBAGE_DIRS += $(JAVA_GEN_DIR)
1809 # generate .java files into _javagen/[package name dirs]
1810 _JAVA_GEN_DIR = $(JAVA_GEN_DIR)/$(JAVA_IFACES_PKG_NAME)
1811 $(_JAVA_GEN_DIR):
1812 $(NSINSTALL) -D $@
1814 $(JAVA_GEN_DIR)/.%.java.pp: %.idl $(XPIDL_COMPILE) $(_JAVA_GEN_DIR)
1815 $(REPORT_BUILD)
1816 $(ELOG) $(XPIDL_COMPILE) -m java -w -I$(srcdir) -I$(IDL_DIR) -o $(_JAVA_GEN_DIR)/$* $(_VPATH_SRCS)
1817 @touch $@
1819 # "Install" generated Java interfaces. We segregate them based on the XPI_NAME.
1820 # If XPI_NAME is not set, install into the "default" directory.
1821 ifneq ($(XPI_NAME),)
1822 JAVA_INSTALL_DIR = $(JAVA_DIST_DIR)/$(XPI_NAME)
1823 else
1824 JAVA_INSTALL_DIR = $(JAVA_DIST_DIR)/default
1825 endif
1827 $(JAVA_INSTALL_DIR):
1828 $(NSINSTALL) -D $@
1830 export:: $(JAVA_DIST_DIR) $(JAVADEPFILES) $(JAVA_INSTALL_DIR)
1831 (cd $(JAVA_GEN_DIR) && tar $(TAR_CREATE_FLAGS) - .) | (cd $(JAVA_INSTALL_DIR) && tar -xf -)
1833 endif # XPIDLSRCS || SDK_XPIDLSRCS
1834 endif # MOZ_JAVAXPCOM
1836 ################################################################################
1837 # Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
1838 ifdef EXTRA_COMPONENTS
1839 libs:: $(EXTRA_COMPONENTS)
1840 ifndef NO_DIST_INSTALL
1841 $(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/components
1842 endif
1844 endif
1846 ifdef EXTRA_PP_COMPONENTS
1847 libs:: $(EXTRA_PP_COMPONENTS)
1848 ifndef NO_DIST_INSTALL
1849 $(EXIT_ON_ERROR) \
1850 $(NSINSTALL) -D $(FINAL_TARGET)/components; \
1851 for i in $^; do \
1852 dest=$(FINAL_TARGET)/components/`basename $$i`; \
1853 $(RM) -f $$dest; \
1854 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1855 done
1856 endif
1858 endif
1860 ################################################################################
1861 # Copy each element of EXTRA_JS_MODULES to $(FINAL_TARGET)/modules
1862 ifdef EXTRA_JS_MODULES
1863 libs:: $(EXTRA_JS_MODULES)
1864 ifndef NO_DIST_INSTALL
1865 $(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/modules
1866 endif
1868 endif
1870 ifdef EXTRA_PP_JS_MODULES
1871 libs:: $(EXTRA_PP_JS_MODULES)
1872 ifndef NO_DIST_INSTALL
1873 $(EXIT_ON_ERROR) \
1874 $(NSINSTALL) -D $(FINAL_TARGET)/modules; \
1875 for i in $^; do \
1876 dest=$(FINAL_TARGET)/modules/`basename $$i`; \
1877 $(RM) -f $$dest; \
1878 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1879 done
1880 endif
1882 endif
1884 ################################################################################
1885 # SDK
1887 ifneq (,$(SDK_LIBRARY))
1888 $(SDK_LIB_DIR)::
1889 $(NSINSTALL) -D $@
1891 ifndef NO_DIST_INSTALL
1892 libs:: $(SDK_LIBRARY) $(SDK_LIB_DIR)
1893 $(INSTALL) $(IFLAGS2) $^
1894 endif
1896 endif # SDK_LIBRARY
1898 ifneq (,$(SDK_BINARY))
1899 $(SDK_BIN_DIR)::
1900 $(NSINSTALL) -D $@
1902 ifndef NO_DIST_INSTALL
1903 libs:: $(SDK_BINARY) $(SDK_BIN_DIR)
1904 $(INSTALL) $(IFLAGS2) $^
1905 endif
1907 endif # SDK_BINARY
1909 ################################################################################
1910 # CHROME PACKAGING
1912 JAR_MANIFEST := $(srcdir)/jar.mn
1914 chrome::
1915 $(MAKE) realchrome
1916 +$(LOOP_OVER_PARALLEL_DIRS)
1917 +$(LOOP_OVER_DIRS)
1918 +$(LOOP_OVER_TOOL_DIRS)
1920 $(FINAL_TARGET)/chrome:
1921 $(NSINSTALL) -D $@
1923 ifneq (,$(wildcard $(JAR_MANIFEST)))
1924 ifndef NO_DIST_INSTALL
1925 libs realchrome:: $(CHROME_DEPS) $(FINAL_TARGET)/chrome
1926 $(PYTHON) $(MOZILLA_DIR)/config/JarMaker.py \
1927 $(QUIET) -j $(FINAL_TARGET)/chrome \
1928 $(MAKE_JARS_FLAGS) $(XULPPFLAGS) $(DEFINES) $(ACDEFINES) \
1929 $(JAR_MANIFEST)
1930 endif
1931 endif
1933 ifneq ($(DIST_FILES),)
1934 $(DIST)/bin:
1935 $(NSINSTALL) -D $@
1937 libs:: $(DIST_FILES) $(DIST)/bin
1938 @$(EXIT_ON_ERROR) \
1939 for f in $(DIST_FILES); do \
1940 dest=$(FINAL_TARGET)/`basename $$f`; \
1941 $(RM) -f $$dest; \
1942 $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
1943 $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
1944 $(srcdir)/$$f > $$dest; \
1945 done
1946 endif
1948 ifneq ($(DIST_CHROME_FILES),)
1949 libs:: $(DIST_CHROME_FILES)
1950 @$(EXIT_ON_ERROR) \
1951 for f in $(DIST_CHROME_FILES); do \
1952 dest=$(FINAL_TARGET)/chrome/`basename $$f`; \
1953 $(RM) -f $$dest; \
1954 $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
1955 $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
1956 $(srcdir)/$$f > $$dest; \
1957 done
1958 endif
1960 ifneq ($(XPI_PKGNAME),)
1961 libs realchrome::
1962 ifdef STRIP_XPI
1963 ifndef MOZ_DEBUG
1964 @echo "Stripping $(XPI_PKGNAME) package directory..."
1965 @echo $(FINAL_TARGET)
1966 @cd $(FINAL_TARGET) && find . ! -type d \
1967 ! -name "*.js" \
1968 ! -name "*.xpt" \
1969 ! -name "*.gif" \
1970 ! -name "*.jpg" \
1971 ! -name "*.png" \
1972 ! -name "*.xpm" \
1973 ! -name "*.txt" \
1974 ! -name "*.rdf" \
1975 ! -name "*.sh" \
1976 ! -name "*.properties" \
1977 ! -name "*.dtd" \
1978 ! -name "*.html" \
1979 ! -name "*.xul" \
1980 ! -name "*.css" \
1981 ! -name "*.xml" \
1982 ! -name "*.jar" \
1983 ! -name "*.dat" \
1984 ! -name "*.tbl" \
1985 ! -name "*.src" \
1986 ! -name "*.reg" \
1987 $(PLATFORM_EXCLUDE_LIST) \
1988 -exec $(STRIP) $(STRIP_FLAGS) {} >/dev/null 2>&1 \;
1989 endif
1990 endif
1991 @echo "Packaging $(XPI_PKGNAME).xpi..."
1992 cd $(FINAL_TARGET) && $(ZIP) -qr ../$(XPI_PKGNAME).xpi *
1993 endif
1995 ifdef INSTALL_EXTENSION_ID
1996 ifndef XPI_NAME
1997 $(error XPI_NAME must be set for INSTALL_EXTENSION_ID)
1998 endif
2000 libs::
2001 $(RM) -rf "$(DIST)/bin/extensions/$(INSTALL_EXTENSION_ID)"
2002 $(NSINSTALL) -D "$(DIST)/bin/extensions/$(INSTALL_EXTENSION_ID)"
2003 cd $(FINAL_TARGET) && tar $(TAR_CREATE_FLAGS) - . | (cd "../../bin/extensions/$(INSTALL_EXTENSION_ID)" && tar -xf -)
2005 endif
2007 ifneq (,$(filter flat symlink,$(MOZ_CHROME_FILE_FORMAT)))
2008 _JAR_REGCHROME_DISABLE_JAR=1
2009 else
2010 _JAR_REGCHROME_DISABLE_JAR=0
2011 endif
2013 REGCHROME = $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/add-chrome.pl \
2014 $(if $(filter gtk2,$(MOZ_WIDGET_TOOLKIT)),-x) \
2015 $(if $(CROSS_COMPILE),-o $(OS_ARCH)) $(FINAL_TARGET)/chrome/installed-chrome.txt \
2016 $(_JAR_REGCHROME_DISABLE_JAR)
2018 REGCHROME_INSTALL = $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/add-chrome.pl \
2019 $(if $(filter gtk2,$(MOZ_WIDGET_TOOLKIT)),-x) \
2020 $(if $(CROSS_COMPILE),-o $(OS_ARCH)) $(DESTDIR)$(mozappdir)/chrome/installed-chrome.txt \
2021 $(_JAR_REGCHROME_DISABLE_JAR)
2024 #############################################################################
2025 # Dependency system
2026 #############################################################################
2027 ifdef COMPILER_DEPEND
2028 depend::
2029 @echo "$(MAKE): No need to run depend target.\
2030 Using compiler-based depend." 1>&2
2031 ifeq ($(GNU_CC)$(GNU_CXX),)
2032 # Non-GNU compilers
2033 @echo "`echo '$(MAKE):'|sed 's/./ /g'`"\
2034 '(Compiler-based depend was turned on by "--enable-md".)' 1>&2
2035 else
2036 # GNU compilers
2037 @space="`echo '$(MAKE): '|sed 's/./ /g'`";\
2038 echo "$$space"'Since you are using a GNU compiler,\
2039 it is on by default.' 1>&2; \
2040 echo "$$space"'To turn it off, pass --disable-md to configure.' 1>&2
2041 endif
2043 else # ! COMPILER_DEPEND
2045 ifndef MOZ_AUTO_DEPS
2047 define MAKE_DEPS_NOAUTO
2048 $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f- $(DEFINES) $(ACDEFINES) $(INCLUDES) $< 2>/dev/null | sed -e "s|^[^ ]*/||" > $@
2049 endef
2051 $(MDDEPDIR)/%.pp: %.c
2052 $(REPORT_BUILD)
2053 @$(MAKE_DEPS_NOAUTO)
2055 $(MDDEPDIR)/%.pp: %.cpp
2056 $(REPORT_BUILD)
2057 @$(MAKE_DEPS_NOAUTO)
2059 $(MDDEPDIR)/%.pp: %.s
2060 $(REPORT_BUILD)
2061 @$(MAKE_DEPS_NOAUTO)
2063 ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
2064 depend:: $(SUBMAKEFILES) $(MAKE_DIRS) $(MDDEPFILES)
2065 else
2066 depend:: $(SUBMAKEFILES)
2067 endif
2068 +$(LOOP_OVER_PARALLEL_DIRS)
2069 +$(LOOP_OVER_DIRS)
2070 +$(LOOP_OVER_TOOL_DIRS)
2072 dependclean:: $(SUBMAKEFILES)
2073 rm -f $(MDDEPFILES)
2074 +$(LOOP_OVER_PARALLEL_DIRS)
2075 +$(LOOP_OVER_DIRS)
2076 +$(LOOP_OVER_TOOL_DIRS)
2078 endif # MOZ_AUTO_DEPS
2080 endif # COMPILER_DEPEND
2083 #############################################################################
2084 # MDDEPDIR is the subdirectory where all the dependency files are placed.
2085 # This uses a make rule (instead of a macro) to support parallel
2086 # builds (-jN). If this were done in the LOOP_OVER_DIRS macro, two
2087 # processes could simultaneously try to create the same directory.
2089 # We use $(CURDIR) in the rule's target to ensure that we don't find
2090 # a dependency directory in the source tree via VPATH (perhaps from
2091 # a previous build in the source tree) and thus neglect to create a
2092 # dependency directory in the object directory, where we really need
2093 # it.
2095 $(CURDIR)/$(MDDEPDIR):
2096 @if test ! -d $@; then echo Creating $@; rm -rf $@; mkdir $@; else true; fi
2098 ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))
2099 ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
2100 MDDEPEND_FILES := $(strip $(wildcard $(MDDEPDIR)/*.pp))
2102 ifneq (,$(MDDEPEND_FILES))
2103 ifdef PERL
2104 # The script mddepend.pl checks the dependencies and writes to stdout
2105 # one rule to force out-of-date objects. For example,
2106 # foo.o boo.o: FORCE
2107 # The script has an advantage over including the *.pp files directly
2108 # because it handles the case when header files are removed from the build.
2109 # 'make' would complain that there is no way to build missing headers.
2110 ifeq (,$(MAKE_RESTARTS))
2111 $(MDDEPDIR)/.all.pp: FORCE
2112 @$(PERL) $(BUILD_TOOLS)/mddepend.pl $@ $(MDDEPEND_FILES)
2113 endif
2114 -include $(MDDEPDIR)/.all.pp
2115 else
2116 include $(MDDEPEND_FILES)
2117 endif
2118 endif
2120 endif
2121 endif
2122 #############################################################################
2124 -include $(topsrcdir)/$(MOZ_BUILD_APP)/app-rules.mk
2125 -include $(MY_RULES)
2128 # This speeds up gmake's processing if these files don't exist.
2130 $(MY_CONFIG) $(MY_RULES):
2131 @touch $@
2134 # Generate Emacs tags in a file named TAGS if ETAGS was set in $(MY_CONFIG)
2135 # or in $(MY_RULES)
2137 ifdef ETAGS
2138 ifneq ($(CSRCS)$(CPPSRCS)$(HEADERS),)
2139 all:: TAGS
2140 TAGS:: $(CSRCS) $(CPPSRCS) $(HEADERS)
2141 $(ETAGS) $(CSRCS) $(CPPSRCS) $(HEADERS)
2142 endif
2143 endif
2145 ################################################################################
2146 # Special gmake rules.
2147 ################################################################################
2151 # Disallow parallel builds with MSVC < 8
2153 ifneq (,$(filter 1200 1300 1310,$(_MSC_VER)))
2154 .NOTPARALLEL:
2155 endif
2158 # Re-define the list of default suffixes, so gmake won't have to churn through
2159 # hundreds of built-in suffix rules for stuff we don't need.
2161 .SUFFIXES:
2164 # Fake targets. Always run these rules, even if a file/directory with that
2165 # name already exists.
2167 .PHONY: all all_platforms alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_viewer run_apprunner tools $(DIRS) $(TOOL_DIRS) FORCE check check-interactive check-one
2169 # Used as a dependency to force targets to rebuild
2170 FORCE:
2172 # Delete target if error occurs when building target
2173 .DELETE_ON_ERROR:
2175 # Properly set LIBPATTERNS for the platform
2176 .LIBPATTERNS = $(if $(IMPORT_LIB_SUFFIX),$(LIB_PREFIX)%.$(IMPORT_LIB_SUFFIX)) $(LIB_PREFIX)%.$(LIB_SUFFIX) $(DLL_PREFIX)%$(DLL_SUFFIX)
2178 tags: TAGS
2180 TAGS: $(SUBMAKEFILES) $(CSRCS) $(CPPSRCS) $(wildcard *.h)
2181 -etags $(CSRCS) $(CPPSRCS) $(wildcard *.h)
2182 +$(LOOP_OVER_PARALLEL_DIRS)
2183 +$(LOOP_OVER_DIRS)
2185 echo-variable-%:
2186 @echo "$($*)"
2188 echo-tiers:
2189 @echo $(TIERS)
2191 echo-tier-dirs:
2192 @$(foreach tier,$(TIERS),echo '$(tier):'; echo ' dirs: $(tier_$(tier)_dirs)'; echo ' staticdirs: $(tier_$(tier)_staticdirs)'; )
2194 echo-dirs:
2195 @echo $(DIRS)
2197 echo-module:
2198 @echo $(MODULE)
2200 echo-requires:
2201 @echo $(REQUIRES)
2203 echo-requires-recursive::
2204 ifdef _REPORT_ALL_DIRS
2205 @echo $(subst $(topsrcdir)/,,$(srcdir)): $(MODULE): $(REQUIRES)
2206 else
2207 @$(if $(REQUIRES),echo $(subst $(topsrcdir)/,,$(srcdir)): $(MODULE): $(REQUIRES))
2208 endif
2209 +$(LOOP_OVER_PARALLEL_DIRS)
2210 +$(LOOP_OVER_DIRS)
2212 echo-depth-path:
2213 @$(topsrcdir)/build/unix/print-depth-path.sh
2215 echo-module-name:
2216 @$(topsrcdir)/build/package/rpm/print-module-name.sh
2218 echo-module-filelist:
2219 @$(topsrcdir)/build/package/rpm/print-module-filelist.sh
2221 showtargs:
2222 ifneq (,$(filter $(PROGRAM) $(HOST_PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS)))
2223 @echo --------------------------------------------------------------------------------
2224 @echo "PROGRAM = $(PROGRAM)"
2225 @echo "SIMPLE_PROGRAMS = $(SIMPLE_PROGRAMS)"
2226 @echo "LIBRARY = $(LIBRARY)"
2227 @echo "SHARED_LIBRARY = $(SHARED_LIBRARY)"
2228 @echo "SHARED_LIBRARY_LIBS = $(SHARED_LIBRARY_LIBS)"
2229 @echo "LIBS = $(LIBS)"
2230 @echo "DEF_FILE = $(DEF_FILE)"
2231 @echo "IMPORT_LIBRARY = $(IMPORT_LIBRARY)"
2232 @echo "STATIC_LIBS = $(STATIC_LIBS)"
2233 @echo "SHARED_LIBS = $(SHARED_LIBS)"
2234 @echo "EXTRA_DSO_LIBS = $(EXTRA_DSO_LIBS)"
2235 @echo "EXTRA_DSO_LDOPTS = $(EXTRA_DSO_LDOPTS)"
2236 @echo "DEPENDENT_LIBS = $(DEPENDENT_LIBS)"
2237 @echo --------------------------------------------------------------------------------
2238 endif
2239 +$(LOOP_OVER_PARALLEL_DIRS)
2240 +$(LOOP_OVER_DIRS)
2242 showbuild:
2243 @echo "MOZ_BUILD_ROOT = $(MOZ_BUILD_ROOT)"
2244 @echo "MOZ_WIDGET_TOOLKIT = $(MOZ_WIDGET_TOOLKIT)"
2245 @echo "CC = $(CC)"
2246 @echo "CXX = $(CXX)"
2247 @echo "CCC = $(CCC)"
2248 @echo "CPP = $(CPP)"
2249 @echo "LD = $(LD)"
2250 @echo "AR = $(AR)"
2251 @echo "IMPLIB = $(IMPLIB)"
2252 @echo "FILTER = $(FILTER)"
2253 @echo "MKSHLIB = $(MKSHLIB)"
2254 @echo "MKCSHLIB = $(MKCSHLIB)"
2255 @echo "RC = $(RC)"
2256 @echo "CFLAGS = $(CFLAGS)"
2257 @echo "OS_CFLAGS = $(OS_CFLAGS)"
2258 @echo "COMPILE_CFLAGS = $(COMPILE_CFLAGS)"
2259 @echo "CXXFLAGS = $(CXXFLAGS)"
2260 @echo "OS_CXXFLAGS = $(OS_CXXFLAGS)"
2261 @echo "COMPILE_CXXFLAGS = $(COMPILE_CXXFLAGS)"
2262 @echo "COMPILE_CMFLAGS = $(COMPILE_CMFLAGS)"
2263 @echo "COMPILE_CMMFLAGS = $(COMPILE_CMMFLAGS)"
2264 @echo "LDFLAGS = $(LDFLAGS)"
2265 @echo "OS_LDFLAGS = $(OS_LDFLAGS)"
2266 @echo "DSO_LDOPTS = $(DSO_LDOPTS)"
2267 @echo "OS_INCLUDES = $(OS_INCLUDES)"
2268 @echo "OS_LIBS = $(OS_LIBS)"
2269 @echo "EXTRA_LIBS = $(EXTRA_LIBS)"
2270 @echo "BIN_FLAGS = $(BIN_FLAGS)"
2271 @echo "INCLUDES = $(INCLUDES)"
2272 @echo "DEFINES = $(DEFINES)"
2273 @echo "ACDEFINES = $(ACDEFINES)"
2274 @echo "BIN_SUFFIX = $(BIN_SUFFIX)"
2275 @echo "LIB_SUFFIX = $(LIB_SUFFIX)"
2276 @echo "DLL_SUFFIX = $(DLL_SUFFIX)"
2277 @echo "IMPORT_LIB_SUFFIX = $(IMPORT_LIB_SUFFIX)"
2278 @echo "INSTALL = $(INSTALL)"
2280 showhost:
2281 @echo "HOST_CC = $(HOST_CC)"
2282 @echo "HOST_CXX = $(HOST_CXX)"
2283 @echo "HOST_CFLAGS = $(HOST_CFLAGS)"
2284 @echo "HOST_LDFLAGS = $(HOST_LDFLAGS)"
2285 @echo "HOST_LIBS = $(HOST_LIBS)"
2286 @echo "HOST_EXTRA_LIBS = $(HOST_EXTRA_LIBS)"
2287 @echo "HOST_EXTRA_DEPS = $(HOST_EXTRA_DEPS)"
2288 @echo "HOST_PROGRAM = $(HOST_PROGRAM)"
2289 @echo "HOST_OBJS = $(HOST_OBJS)"
2290 @echo "HOST_PROGOBJS = $(HOST_PROGOBJS)"
2291 @echo "HOST_LIBRARY = $(HOST_LIBRARY)"
2293 showbuildmods::
2294 @echo "Build Modules = $(BUILD_MODULES)"
2295 @echo "Module dirs = $(BUILD_MODULE_DIRS)"
2297 zipmakes:
2298 ifneq (,$(filter $(PROGRAM) $(SIMPLE_PROGRAMS) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS)))
2299 zip $(DEPTH)/makefiles $(subst $(topsrcdir),$(MOZ_SRC)/mozilla,$(srcdir)/Makefile.in)
2300 endif
2301 +$(LOOP_OVER_PARALLEL_DIRS)
2302 +$(LOOP_OVER_DIRS)
2304 documentation:
2305 @cd $(DEPTH)
2306 $(DOXYGEN) $(DEPTH)/config/doxygen.cfg
2308 check:: $(SUBMAKEFILES) $(MAKE_DIRS)
2309 +$(LOOP_OVER_PARALLEL_DIRS)
2310 +$(LOOP_OVER_DIRS)
2311 +$(LOOP_OVER_TOOL_DIRS)