Speed up canvas comparisons in bidi mochitests. No bug
[mozilla-central.git] / config / rules.mk
blob321d2c7fb0468cfc4e51a7a2990410cc0bb4199a
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 # Test file installation
133 libs::
134 @$(EXIT_ON_ERROR) \
135 for testdir in $(XPCSHELL_TESTS); do \
136 $(INSTALL) \
137 $(srcdir)/$$testdir/*.js \
138 $(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir; \
139 done
141 # Path formats on Windows are hard. We require a topsrcdir formatted so that
142 # it may be passed to nsILocalFile.initWithPath (in other words, an absolute
143 # path of the form X:\path\to\topsrcdir), which we store in NATIVE_TOPSRCDIR.
144 # We require a forward-slashed path to topsrcdir so that it may be combined
145 # with a relative forward-slashed path for loading scripts, both dynamically
146 # and statically for head/test/tail JS files. Of course, on non-Windows none
147 # of this matters, and things will work correctly because everything's
148 # forward-slashed, everywhere, always.
149 ifdef CYGWIN_WRAPPER
150 NATIVE_TOPSRCDIR := `cygpath -wa $(topsrcdir)`
151 FWDSLASH_TOPSRCDIR := `cygpath -ma $(topsrcdir)`
152 else
153 FWDSLASH_TOPSRCDIR := $(topsrcdir)
154 ifeq ($(HOST_OS_ARCH),WINNT)
155 NATIVE_TOPSRCDIR := $(subst /,\\,$(WIN_TOP_SRC))
156 else
157 NATIVE_TOPSRCDIR := $(topsrcdir)
158 endif
159 endif # CYGWIN_WRAPPER
161 testxpcdir = $(topsrcdir)/testing/xpcshell
163 # Test execution
164 check::
165 @$(EXIT_ON_ERROR) \
166 for testdir in $(XPCSHELL_TESTS); do \
167 $(RUN_TEST_PROGRAM) \
168 $(testxpcdir)/test_all.sh \
169 $(DIST)/bin/xpcshell \
170 $(FWDSLASH_TOPSRCDIR) \
171 $(NATIVE_TOPSRCDIR) \
172 $(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir; \
173 done
175 # Test execution
176 check-interactive::
177 @$(EXIT_ON_ERROR) \
178 $(RUN_TEST_PROGRAM) \
179 $(testxpcdir)/test_one.sh \
180 $(DIST)/bin/xpcshell \
181 $(FWDSLASH_TOPSRCDIR) \
182 $(NATIVE_TOPSRCDIR) \
183 $(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir \
184 $(SOLO_FILE) 1;
186 # Test execution
187 check-one::
188 @$(EXIT_ON_ERROR) \
189 $(RUN_TEST_PROGRAM) \
190 $(testxpcdir)/test_one.sh \
191 $(DIST)/bin/xpcshell \
192 $(FWDSLASH_TOPSRCDIR) \
193 $(NATIVE_TOPSRCDIR) \
194 $(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir \
195 $(SOLO_FILE) 0;
197 endif # XPCSHELL_TESTS
199 ifdef CPP_UNIT_TESTS
201 # Compile the tests to $(DIST)/bin. Make lots of niceties available by default
202 # through TestHarness.h, by modifying the list of includes and the libs against
203 # which stuff links.
204 CPPSRCS += $(CPP_UNIT_TESTS)
205 SIMPLE_PROGRAMS += $(CPP_UNIT_TESTS:.cpp=$(BIN_SUFFIX))
206 REQUIRES += testing xpcom
207 LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS)
209 # ...and run them the usual way
210 check::
211 @$(EXIT_ON_ERROR) \
212 for f in $(subst .cpp,,$(CPP_UNIT_TESTS)); do \
213 XPCOM_DEBUG_BREAK=stack-and-abort $(RUN_TEST_PROGRAM) $(DIST)/bin/$$f; \
214 done
216 endif # CPP_UNIT_TESTS
218 endif # ENABLE_TESTS
222 # Library rules
224 # If BUILD_STATIC_LIBS or FORCE_STATIC_LIB is set, build a static library.
225 # Otherwise, build a shared library.
228 ifndef LIBRARY
229 ifdef STATIC_LIBRARY_NAME
230 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
231 ifdef SHORT_LIBNAME
232 STATIC_LIBRARY_NAME := $(SHORT_LIBNAME)
233 SHARED_LIBRARY_NAME := $(SHORT_LIBNAME)
234 endif
235 endif
236 LIBRARY := $(LIB_PREFIX)$(STATIC_LIBRARY_NAME).$(LIB_SUFFIX)
237 endif # STATIC_LIBRARY_NAME
238 endif # LIBRARY
240 ifndef HOST_LIBRARY
241 ifdef HOST_LIBRARY_NAME
242 HOST_LIBRARY := $(LIB_PREFIX)$(HOST_LIBRARY_NAME).$(LIB_SUFFIX)
243 endif
244 endif
246 ifdef LIBRARY
247 ifneq (_1,$(FORCE_SHARED_LIB)_$(BUILD_STATIC_LIBS))
248 ifdef MKSHLIB
250 ifdef LIB_IS_C_ONLY
251 MKSHLIB = $(MKCSHLIB)
252 endif
254 ifdef MAKE_FRAMEWORK
255 SHARED_LIBRARY := $(SHARED_LIBRARY_NAME)
256 else
257 SHARED_LIBRARY := $(DLL_PREFIX)$(SHARED_LIBRARY_NAME)$(DLL_SUFFIX)
258 endif
260 ifeq ($(OS_ARCH),OS2)
261 DEF_FILE := $(SHARED_LIBRARY:.dll=.def)
262 endif
264 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
265 IMPORT_LIBRARY := $(LIB_PREFIX)$(SHARED_LIBRARY_NAME).$(IMPORT_LIB_SUFFIX)
266 endif
268 ifdef MOZ_ENABLE_LIBXUL
269 EMBED_MANIFEST_AT=2
270 endif
272 endif # MKSHLIB
273 endif # FORCE_SHARED_LIB && !BUILD_STATIC_LIBS
274 endif # LIBRARY
276 ifeq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB))
277 LIBRARY := $(NULL)
278 endif
280 ifeq (_1,$(FORCE_SHARED_LIB)_$(BUILD_STATIC_LIBS))
281 SHARED_LIBRARY := $(NULL)
282 DEF_FILE := $(NULL)
283 IMPORT_LIBRARY := $(NULL)
284 endif
286 ifdef FORCE_STATIC_LIB
287 ifndef FORCE_SHARED_LIB
288 SHARED_LIBRARY := $(NULL)
289 DEF_FILE := $(NULL)
290 IMPORT_LIBRARY := $(NULL)
291 endif
292 endif
294 ifdef FORCE_SHARED_LIB
295 ifndef FORCE_STATIC_LIB
296 LIBRARY := $(NULL)
297 endif
298 endif
300 ifdef JAVA_LIBRARY_NAME
301 JAVA_LIBRARY := $(JAVA_LIBRARY_NAME).jar
302 endif
304 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
305 ifndef GNU_CC
308 # Unless we're building SIMPLE_PROGRAMS, all C++ files share a PDB file per
309 # directory. For parallel builds, this PDB file is shared and locked by
310 # MSPDBSRV.EXE, starting with MSVC8 SP1. If you're using MSVC 7.1 or MSVC8
311 # without SP1, don't do parallel builds.
313 # The final PDB for libraries and programs is created by the linker and uses
314 # a different name from the single PDB file created by the compiler. See
315 # bug 462740.
318 ifdef SIMPLE_PROGRAMS
319 COMPILE_PDBFILE = $(basename $(@F)).pdb
320 else
321 COMPILE_PDBFILE = generated.pdb
322 endif
324 LINK_PDBFILE = $(basename $(@F)).pdb
325 ifdef MOZ_DEBUG
326 CODFILE=$(basename $(@F)).cod
327 endif
329 ifdef MOZ_MAPINFO
330 ifdef SHARED_LIBRARY_NAME
331 MAPFILE=$(SHARED_LIBRARY_NAME).map
332 else
333 MAPFILE=$(basename $(@F)).map
334 endif # SHARED_LIBRARY_NAME
335 endif # MOZ_MAPINFO
337 ifdef DEFFILE
338 OS_LDFLAGS += -DEF:$(DEFFILE)
339 EXTRA_DEPS += $(DEFFILE)
340 endif
342 ifdef MAPFILE
343 OS_LDFLAGS += -MAP:$(MAPFILE)
344 endif
346 endif # !GNU_CC
348 ifdef ENABLE_CXX_EXCEPTIONS
349 ifdef GNU_CC
350 CXXFLAGS += -fexceptions
351 else
352 ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER)))
353 CXXFLAGS += -GX
354 else
355 CXXFLAGS += -EHsc
356 endif # _MSC_VER
357 endif # GNU_CC
358 endif # ENABLE_CXX_EXCEPTIONS
359 endif # WINNT
361 ifeq (,$(filter-out WINNT WINCE,$(HOST_OS_ARCH)))
362 HOST_PDBFILE=$(basename $(@F)).pdb
363 endif
365 ifndef TARGETS
366 TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
367 endif
369 ifndef OBJS
370 _OBJS = \
371 $(JRI_STUB_CFILES) \
372 $(addsuffix .$(OBJ_SUFFIX), $(JMC_GEN)) \
373 $(CSRCS:.c=.$(OBJ_SUFFIX)) \
374 $(patsubst %.cc,%.$(OBJ_SUFFIX),$(CPPSRCS:.cpp=.$(OBJ_SUFFIX))) \
375 $(CMSRCS:.m=.$(OBJ_SUFFIX)) \
376 $(CMMSRCS:.mm=.$(OBJ_SUFFIX)) \
377 $(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX))
378 OBJS = $(strip $(_OBJS))
379 endif
381 ifndef HOST_OBJS
382 _HOST_OBJS = \
383 $(addprefix host_,$(HOST_CSRCS:.c=.$(OBJ_SUFFIX))) \
384 $(addprefix host_,$(patsubst %.cc,%.$(OBJ_SUFFIX),$(HOST_CPPSRCS:.cpp=.$(OBJ_SUFFIX)))) \
385 $(addprefix host_,$(HOST_CMSRCS:.m=.$(OBJ_SUFFIX))) \
386 $(addprefix host_,$(HOST_CMMSRCS:.mm=.$(OBJ_SUFFIX)))
387 HOST_OBJS = $(strip $(_HOST_OBJS))
388 endif
390 LIBOBJS := $(addprefix \", $(OBJS))
391 LIBOBJS := $(addsuffix \", $(LIBOBJS))
393 ifndef MOZ_AUTO_DEPS
394 ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
395 MDDEPFILES = $(addprefix $(MDDEPDIR)/,$(OBJS:.$(OBJ_SUFFIX)=.pp))
396 ifndef NO_GEN_XPT
397 MDDEPFILES += $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.xpt)) \
398 $(addprefix $(MDDEPDIR)/,$(SDK_XPIDLSRCS:.idl=.xpt))
399 endif
400 endif
401 endif
403 ALL_TRASH = \
404 $(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
405 $(filter-out $(ASFILES),$(OBJS:.$(OBJ_SUFFIX)=.s)) $(OBJS:.$(OBJ_SUFFIX)=.ii) \
406 $(OBJS:.$(OBJ_SUFFIX)=.i) \
407 $(HOST_PROGOBJS) $(HOST_OBJS) $(IMPORT_LIBRARY) $(DEF_FILE)\
408 $(EXE_DEF_FILE) so_locations _gen _stubs $(wildcard *.res) $(wildcard *.RES) \
409 $(wildcard *.pdb) $(CODFILE) $(MAPFILE) $(IMPORT_LIBRARY) \
410 $(SHARED_LIBRARY:$(DLL_SUFFIX)=.exp) $(wildcard *.ilk) \
411 $(PROGRAM:$(BIN_SUFFIX)=.exp) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.exp) \
412 $(PROGRAM:$(BIN_SUFFIX)=.lib) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.lib) \
413 $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.$(OBJ_SUFFIX)) \
414 $(wildcard gts_tmp_*) $(LIBRARY:%.a=.%.timestamp)
415 ALL_TRASH_DIRS = \
416 $(GARBAGE_DIRS) /no-such-file
418 ifdef QTDIR
419 GARBAGE += $(MOCSRCS)
420 endif
422 ifdef SIMPLE_PROGRAMS
423 GARBAGE += $(SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX))
424 endif
426 ifdef HOST_SIMPLE_PROGRAMS
427 GARBAGE += $(HOST_SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX))
428 endif
431 # the Solaris WorkShop template repository cache. it occasionally can get
432 # out of sync, so targets like clobber should kill it.
434 ifeq ($(SOLARIS_SUNPRO_CXX),1)
435 GARBAGE_DIRS += SunWS_cache
436 endif
438 ifeq ($(OS_ARCH),OpenVMS)
439 GARBAGE += $(wildcard *.*_defines)
440 ifdef SHARED_LIBRARY
441 VMS_SYMVEC_FILE = $(SHARED_LIBRARY:$(DLL_SUFFIX)=_symvec.opt)
442 ifdef MOZ_DEBUG
443 VMS_SYMVEC_FILE_MODULE = $(topsrcdir)/build/unix/vms/$(notdir $(SHARED_LIBRARY:$(DLL_SUFFIX)=_dbg_symvec.opt))
444 else
445 VMS_SYMVEC_FILE_MODULE = $(topsrcdir)/build/unix/vms/$(notdir $(SHARED_LIBRARY:$(DLL_SUFFIX)=_symvec.opt))
446 endif
447 VMS_SYMVEC_FILE_COMP = $(topsrcdir)/build/unix/vms/component_symvec.opt
448 GARBAGE += $(VMS_SYMVEC_FILE)
449 ifdef IS_COMPONENT
450 DSO_LDOPTS := $(filter-out -auto_symvec,$(DSO_LDOPTS)) $(VMS_SYMVEC_FILE)
451 endif
452 endif
453 endif
455 XPIDL_GEN_DIR = _xpidlgen
457 ifdef MOZ_UPDATE_XTERM
458 # Its good not to have a newline at the end of the titlebar string because it
459 # makes the make -s output easier to read. Echo -n does not work on all
460 # platforms, but we can trick sed into doing it.
461 UPDATE_TITLE = sed -e "s!Y!$@ in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$(dir)!" $(MOZILLA_DIR)/config/xterm.str;
462 UPDATE_TITLE_export = sed -e "s!Y!export in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$*!" $(MOZILLA_DIR)/config/xterm.str;
463 UPDATE_TITLE_libs = sed -e "s!Y!libs in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$*!" $(MOZILLA_DIR)/config/xterm.str;
464 UPDATE_TITLE_tools = sed -e "s!Y!tools in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$*!" $(MOZILLA_DIR)/config/xterm.str;
465 endif
467 ifneq (,$(strip $(DIRS)))
468 LOOP_OVER_DIRS = \
469 @$(EXIT_ON_ERROR) \
470 $(foreach dir,$(DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; )
471 endif
473 # we only use this for the makefiles target and other stuff that doesn't matter
474 ifneq (,$(strip $(PARALLEL_DIRS)))
475 LOOP_OVER_PARALLEL_DIRS = \
476 @$(EXIT_ON_ERROR) \
477 $(foreach dir,$(PARALLEL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; )
478 endif
480 ifneq (,$(strip $(STATIC_DIRS)))
481 LOOP_OVER_STATIC_DIRS = \
482 @$(EXIT_ON_ERROR) \
483 $(foreach dir,$(STATIC_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; )
484 endif
486 ifneq (,$(strip $(TOOL_DIRS)))
487 LOOP_OVER_TOOL_DIRS = \
488 @$(EXIT_ON_ERROR) \
489 $(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; )
490 endif
492 ifdef PARALLEL_DIRS
493 # create a bunch of fake targets for order-only processing
494 PARALLEL_DIRS_export = $(addsuffix _export,$(PARALLEL_DIRS))
495 PARALLEL_DIRS_libs = $(addsuffix _libs,$(PARALLEL_DIRS))
496 PARALLEL_DIRS_tools = $(addsuffix _tools,$(PARALLEL_DIRS))
498 .PHONY: $(PARALLEL_DIRS_export) $(PARALLEL_DIRS_libs) $(PARALLEL_DIRS_tools)
499 endif
502 # Now we can differentiate between objects used to build a library, and
503 # objects used to build an executable in the same directory.
505 ifndef PROGOBJS
506 PROGOBJS = $(OBJS)
507 endif
509 ifndef HOST_PROGOBJS
510 HOST_PROGOBJS = $(HOST_OBJS)
511 endif
513 # MAKE_DIRS: List of directories to build while looping over directories.
514 # A Makefile that needs $(MDDEPDIR) created but doesn't set any of these
515 # variables we know to check can just set NEED_MDDEPDIR explicitly.
516 ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS)$(NEED_MDDEPDIR))
517 MAKE_DIRS += $(CURDIR)/$(MDDEPDIR)
518 GARBAGE_DIRS += $(MDDEPDIR)
519 endif
522 # Tags: emacs (etags), vi (ctags)
523 # TAG_PROGRAM := ctags -L -
525 TAG_PROGRAM = xargs etags -a
528 # Turn on C++ linking if we have any .cpp or .mm files
529 # (moved this from config.mk so that config.mk can be included
530 # before the CPPSRCS are defined)
532 ifneq ($(CPPSRCS)$(CMMSRCS),)
533 CPP_PROG_LINK = 1
534 endif
537 # Make sure to wrap static libs inside linker specific flags to turn on & off
538 # inclusion of all symbols inside the static libs
540 ifndef NO_LD_ARCHIVE_FLAGS
541 ifdef SHARED_LIBRARY_LIBS
542 EXTRA_DSO_LDOPTS := $(MKSHLIB_FORCE_ALL) $(SHARED_LIBRARY_LIBS) $(MKSHLIB_UNFORCE_ALL) $(EXTRA_DSO_LDOPTS)
543 endif
544 endif
547 # This will strip out symbols that the component should not be
548 # exporting from the .dynsym section.
550 ifdef IS_COMPONENT
551 EXTRA_DSO_LDOPTS += $(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
552 endif # IS_COMPONENT
555 # Enforce the requirement that MODULE_NAME must be set
556 # for components in static builds
558 ifdef IS_COMPONENT
559 ifdef EXPORT_LIBRARY
560 ifndef FORCE_SHARED_LIB
561 ifndef MODULE_NAME
562 $(error MODULE_NAME is required for components which may be used in static builds)
563 endif
564 endif
565 endif
566 endif
569 # MacOS X specific stuff
572 ifeq ($(OS_ARCH),Darwin)
573 ifdef SHARED_LIBRARY
574 ifdef IS_COMPONENT
575 EXTRA_DSO_LDOPTS += -bundle
576 else
577 EXTRA_DSO_LDOPTS += -dynamiclib -install_name @executable_path/$(SHARED_LIBRARY) -compatibility_version 1 -current_version 1 -single_module
578 endif
579 endif
580 endif
583 # On NetBSD a.out systems, use -Bsymbolic. This fixes what would otherwise be
584 # fatal symbol name clashes between components.
586 ifeq ($(OS_ARCH),NetBSD)
587 ifeq ($(DLL_SUFFIX),.so.1.0)
588 ifdef IS_COMPONENT
589 EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
590 endif
591 endif
592 endif
594 ifeq ($(OS_ARCH),FreeBSD)
595 ifdef IS_COMPONENT
596 EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
597 endif
598 endif
600 ifeq ($(OS_ARCH),NetBSD)
601 ifneq (,$(filter arc cobalt hpcmips mipsco newsmips pmax sgimips,$(OS_TEST)))
602 ifeq ($(MODULE),layout)
603 OS_CFLAGS += -Wa,-xgot
604 OS_CXXFLAGS += -Wa,-xgot
605 endif
606 endif
607 endif
609 ifeq ($(OS_ARCH),Linux)
610 ifneq (,$(filter mips mipsel,$(OS_TEST)))
611 ifeq ($(MODULE),layout)
612 OS_CFLAGS += -Wa,-xgot
613 OS_CXXFLAGS += -Wa,-xgot
614 endif
615 endif
616 endif
619 # HP-UXBeOS specific section: for COMPONENTS only, add -Bsymbolic flag
620 # which uses internal symbols first
622 ifeq ($(OS_ARCH),HP-UX)
623 ifdef IS_COMPONENT
624 ifeq ($(GNU_CC)$(GNU_CXX),)
625 EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
626 ifneq ($(HAS_EXTRAEXPORTS),1)
627 MKSHLIB += -Wl,+eNSGetModule -Wl,+eerrno
628 MKCSHLIB += +eNSGetModule +eerrno
629 ifneq ($(OS_TEST),ia64)
630 MKSHLIB += -Wl,+e_shlInit
631 MKCSHLIB += +e_shlInit
632 endif # !ia64
633 endif # !HAS_EXTRAEXPORTS
634 endif # non-gnu compilers
635 endif # IS_COMPONENT
636 endif # HP-UX
638 ifeq ($(OS_ARCH),AIX)
639 ifdef IS_COMPONENT
640 ifneq ($(HAS_EXTRAEXPORTS),1)
641 MKSHLIB += -bE:$(MOZILLA_DIR)/build/unix/aix.exp -bnoexpall
642 MKCSHLIB += -bE:$(MOZILLA_DIR)/build/unix/aix.exp -bnoexpall
643 endif # HAS_EXTRAEXPORTS
644 endif # IS_COMPONENT
645 endif # AIX
648 # OSF1: add -B symbolic flag for components
650 ifeq ($(OS_ARCH),OSF1)
651 ifdef IS_COMPONENT
652 ifeq ($(GNU_CC)$(GNU_CXX),)
653 EXTRA_DSO_LDOPTS += -B symbolic
654 endif
655 endif
656 endif
659 # Linux: add -Bsymbolic flag for components
661 ifeq ($(OS_ARCH),Linux)
662 ifdef IS_COMPONENT
663 EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
664 endif
665 endif
668 # MINGW32
670 ifeq ($(OS_ARCH),WINNT)
671 ifdef GNU_CC
672 ifndef IS_COMPONENT
673 DSO_LDOPTS += -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
674 endif
675 endif
676 endif
678 ifeq ($(USE_TVFS),1)
679 IFLAGS1 = -rb
680 IFLAGS2 = -rb
681 else
682 IFLAGS1 = -m 644
683 IFLAGS2 = -m 755
684 endif
686 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
687 OUTOPTION = -Fo# eol
688 else
689 OUTOPTION = -o # eol
690 endif # WINNT && !GNU_CC
691 ifneq (,$(filter WINCE,$(OS_ARCH)))
692 OUTOPTION = -Fo# eol
693 endif
695 ifeq ($(OS_TARGET), WINCE)
696 OUTOPTION = -Fo# eol
697 HOST_OUTOPTION = -Fo# eol
698 else
700 ifeq (,$(CROSS_COMPILE))
701 HOST_OUTOPTION = $(OUTOPTION)
702 else
703 HOST_OUTOPTION = -o # eol
704 endif
706 endif
707 ################################################################################
709 # SUBMAKEFILES: List of Makefiles for next level down.
710 # This is used to update or create the Makefiles before invoking them.
711 SUBMAKEFILES += $(addsuffix /Makefile, $(DIRS) $(TOOL_DIRS) $(PARALLEL_DIRS))
713 # The root makefile doesn't want to do a plain export/libs, because
714 # of the tiers and because of libxul. Suppress the default rules in favor
715 # of something else. Makefiles which use this var *must* provide a sensible
716 # default rule before including rules.mk
717 ifndef SUPPRESS_DEFAULT_RULES
718 ifdef TIERS
719 default all alldep::
720 $(EXIT_ON_ERROR) \
721 $(foreach tier,$(TIERS),$(MAKE) tier_$(tier); ) true
723 else
725 default all::
726 ifneq (,$(strip $(STATIC_DIRS)))
727 $(foreach dir,$(STATIC_DIRS),$(MAKE) -C $(dir); )
728 endif
729 $(MAKE) export
730 $(MAKE) libs
731 $(MAKE) tools
733 # Do depend as well
734 alldep::
735 $(MAKE) export
736 $(MAKE) depend
737 $(MAKE) libs
738 $(MAKE) tools
740 endif # TIERS
741 endif # SUPPRESS_DEFAULT_RULES
743 ifeq ($(filter s,$(MAKEFLAGS)),)
744 ECHO := echo
745 QUIET :=
746 else
747 ECHO := true
748 QUIET := -q
749 endif
751 MAKE_TIER_SUBMAKEFILES = +$(if $(tier_$*_dirs),$(MAKE) $(addsuffix /Makefile,$(tier_$*_dirs)))
753 export_tier_%:
754 @$(ECHO) "$@"
755 @$(MAKE_TIER_SUBMAKEFILES)
756 @$(EXIT_ON_ERROR) \
757 $(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) export; ) true
759 libs_tier_%:
760 @$(ECHO) "$@"
761 @$(MAKE_TIER_SUBMAKEFILES)
762 @$(EXIT_ON_ERROR) \
763 $(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) libs; ) true
765 tools_tier_%:
766 @$(ECHO) "$@"
767 @$(MAKE_TIER_SUBMAKEFILES)
768 @$(EXIT_ON_ERROR) \
769 $(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) tools; ) true
771 $(foreach tier,$(TIERS),tier_$(tier))::
772 @$(ECHO) "$@: $($@_staticdirs) $($@_dirs)"
773 @$(EXIT_ON_ERROR) \
774 $(foreach dir,$($@_staticdirs),$(MAKE) -C $(dir); ) true
775 $(MAKE) export_$@
776 $(MAKE) libs_$@
778 # Do everything from scratch
779 everything::
780 $(MAKE) clean
781 $(MAKE) alldep
783 # Add dummy depend target for tinderboxes
784 depend::
786 ifdef ALL_PLATFORMS
787 all_platforms:: $(NFSPWD)
788 @d=`$(NFSPWD)`; \
789 if test ! -d LOGS; then rm -rf LOGS; mkdir LOGS; else true; fi; \
790 for h in $(PLATFORM_HOSTS); do \
791 echo "On $$h: $(MAKE) $(ALL_PLATFORMS) >& LOGS/$$h.log";\
792 rsh $$h -n "(chdir $$d; \
793 $(MAKE) $(ALL_PLATFORMS) >& LOGS/$$h.log; \
794 echo DONE) &" 2>&1 > LOGS/$$h.pid & \
795 sleep 1; \
796 done
798 $(NFSPWD):
799 cd $(@D); $(MAKE) $(@F)
800 endif
802 # Target to only regenerate makefiles
803 makefiles: $(SUBMAKEFILES)
804 ifneq (,$(DIRS)$(TOOL_DIRS)$(PARALLEL_DIRS))
805 +$(LOOP_OVER_PARALLEL_DIRS)
806 +$(LOOP_OVER_DIRS)
807 +$(LOOP_OVER_TOOL_DIRS)
808 endif
810 ifdef PARALLEL_DIRS
811 export:: $(PARALLEL_DIRS_export)
813 $(PARALLEL_DIRS_export): %_export: %/Makefile
814 +@$(UPDATE_TITLE_export) $(MAKE) -C $* export
815 endif
817 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))
818 +$(LOOP_OVER_DIRS)
819 +$(LOOP_OVER_TOOL_DIRS)
821 ifdef PARALLEL_DIRS
822 tools:: $(PARALLEL_DIRS_tools)
824 $(PARALLEL_DIRS_tools): %_tools: %/Makefile
825 +@$(UPDATE_TITLE_tools) $(MAKE) -C $* tools
826 endif
828 tools:: $(SUBMAKEFILES) $(MAKE_DIRS)
829 +$(LOOP_OVER_DIRS)
830 ifneq (,$(strip $(TOOL_DIRS)))
831 @$(EXIT_ON_ERROR) \
832 $(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) libs; )
833 endif
836 # Rule to create list of libraries for final link
838 export::
839 ifdef LIBRARY_NAME
840 ifdef EXPORT_LIBRARY
841 ifdef IS_COMPONENT
842 ifdef BUILD_STATIC_LIBS
843 @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(STATIC_LIBRARY_NAME)
844 ifdef MODULE_NAME
845 @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMP_NAMES) $(MODULE_NAME)
846 endif
847 endif # BUILD_STATIC_LIBS
848 else # !IS_COMPONENT
849 $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(STATIC_LIBRARY_NAME)
850 endif # IS_COMPONENT
851 endif # EXPORT_LIBRARY
852 endif # LIBRARY_NAME
854 # Create dependencies on static (and shared EXTRA_DSO_LIBS) libraries
855 LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(LIBS))
856 HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(HOST_LIBS))
857 DSO_LDOPTS_DEPS = $(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS))
859 # Dependancies which, if modified, should cause everything to rebuild
860 GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(DEPTH)/config/config.mk
862 ##############################################
863 ifdef PARALLEL_DIRS
864 libs:: $(PARALLEL_DIRS_libs)
866 $(PARALLEL_DIRS_libs): %_libs: %/Makefile
867 +@$(UPDATE_TITLE_libs) $(MAKE) -C $* libs
868 endif
870 libs:: $(SUBMAKEFILES) $(MAKE_DIRS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(HOST_PROGRAM) $(PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
871 ifndef NO_DIST_INSTALL
872 ifdef LIBRARY
873 ifdef EXPORT_LIBRARY # Stage libs that will be linked into a static build
874 ifdef IS_COMPONENT
875 $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib/components
876 else
877 $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib
878 endif
879 endif # EXPORT_LIBRARY
880 ifdef DIST_INSTALL
881 ifdef IS_COMPONENT
882 $(error Shipping static component libs makes no sense.)
883 else
884 $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DIST)/lib
885 endif
886 endif # DIST_INSTALL
887 endif # LIBRARY
888 ifdef SHARED_LIBRARY
889 ifdef IS_COMPONENT
890 $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
891 $(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
892 ifdef BEOS_ADDON_WORKAROUND
893 ( cd $(FINAL_TARGET)/components && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
894 endif
895 else # ! IS_COMPONENT
896 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
897 $(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(DIST)/lib
898 else
899 $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DIST)/lib
900 endif
901 $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)
902 ifdef BEOS_ADDON_WORKAROUND
903 ( cd $(FINAL_TARGET) && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
904 endif
905 endif # IS_COMPONENT
906 endif # SHARED_LIBRARY
907 ifdef PROGRAM
908 $(INSTALL) $(IFLAGS2) $(PROGRAM) $(FINAL_TARGET)
909 endif
910 ifdef SIMPLE_PROGRAMS
911 $(INSTALL) $(IFLAGS2) $(SIMPLE_PROGRAMS) $(FINAL_TARGET)
912 endif
913 ifdef HOST_PROGRAM
914 $(INSTALL) $(IFLAGS2) $(HOST_PROGRAM) $(DIST)/host/bin
915 endif
916 ifdef HOST_SIMPLE_PROGRAMS
917 $(INSTALL) $(IFLAGS2) $(HOST_SIMPLE_PROGRAMS) $(DIST)/host/bin
918 endif
919 ifdef HOST_LIBRARY
920 $(INSTALL) $(IFLAGS1) $(HOST_LIBRARY) $(DIST)/host/lib
921 endif
922 ifdef JAVA_LIBRARY
923 ifdef IS_COMPONENT
924 $(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)/components
925 else
926 $(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)
927 endif
928 endif # JAVA_LIBRARY
929 endif # !NO_DIST_INSTALL
930 +$(LOOP_OVER_DIRS)
932 ##############################################
934 ifndef NO_PROFILE_GUIDED_OPTIMIZE
935 ifneq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
936 ifeq ($(OS_ARCH)_$(GNU_CC)$(INTERNAL_TOOLS), WINNT_)
937 # Force re-linking when building with PGO, since
938 # the MSVC linker does all the work. We force re-link
939 # in both stages so you can do depend builds with PGO.
940 ifdef SHARED_LIBRARY
941 $(SHARED_LIBRARY): FORCE
942 endif
943 ifdef PROGRAM
944 $(PROGRAM): FORCE
945 endif
947 ifdef MOZ_PROFILE_USE
948 # In the second pass, we need to merge the pgc files into the pgd file.
949 # The compiler would do this for us automatically if they were in the right
950 # place, but they're in dist/bin.
951 ifneq (,$(SHARED_LIBRARY)$(PROGRAM))
952 export::
953 ifdef PROGRAM
954 $(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
955 $(PROGRAM:$(BIN_SUFFIX)=) $(DIST)/bin
956 endif
957 ifdef SHARED_LIBRARY
958 $(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
959 $(SHARED_LIBRARY_NAME) $(DIST)/bin
960 endif
961 endif
962 endif # MOZ_PROFILE_USE
963 endif # WINNT_
964 endif # MOZ_PROFILE_GENERATE || MOZ_PROFILE_USE
965 endif # NO_PROFILE_GUIDED_OPTIMIZE
967 ##############################################
969 checkout:
970 $(MAKE) -C $(topsrcdir) -f client.mk checkout
972 run_viewer: $(FINAL_TARGET)/viewer
973 cd $(FINAL_TARGET); \
974 MOZILLA_FIVE_HOME=`pwd` \
975 LD_LIBRARY_PATH=".:$(LIBS_PATH):$$LD_LIBRARY_PATH" \
976 viewer
978 clean clobber realclean clobber_all:: $(SUBMAKEFILES)
979 -rm -f $(ALL_TRASH)
980 -rm -rf $(ALL_TRASH_DIRS)
981 +-$(LOOP_OVER_PARALLEL_DIRS)
982 +-$(LOOP_OVER_DIRS)
983 +-$(LOOP_OVER_STATIC_DIRS)
984 +-$(LOOP_OVER_TOOL_DIRS)
986 distclean:: $(SUBMAKEFILES)
987 +-$(LOOP_OVER_PARALLEL_DIRS)
988 +-$(LOOP_OVER_DIRS)
989 +-$(LOOP_OVER_STATIC_DIRS)
990 +-$(LOOP_OVER_TOOL_DIRS)
991 -rm -rf $(ALL_TRASH_DIRS)
992 -rm -f $(ALL_TRASH) \
993 Makefile .HSancillary \
994 $(wildcard *.$(OBJ_SUFFIX)) $(wildcard *.ho) $(wildcard host_*.o*) \
995 $(wildcard *.$(LIB_SUFFIX)) $(wildcard *$(DLL_SUFFIX)) \
996 $(wildcard *.$(IMPORT_LIB_SUFFIX))
997 ifeq ($(OS_ARCH),OS2)
998 -rm -f $(PROGRAM:.exe=.map)
999 endif
1001 alltags:
1002 rm -f TAGS
1003 find $(topsrcdir) -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' -o -name '*.idl' \) -print | $(TAG_PROGRAM)
1006 # PROGRAM = Foo
1007 # creates OBJS, links with LIBS to create Foo
1009 $(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) $(EXE_DEF_FILE) $(RESFILE) $(GLOBAL_DEPS)
1010 ifeq (WINCE,$(OS_ARCH))
1011 $(LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1012 else
1013 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
1014 $(LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1015 ifdef MSMANIFEST_TOOL
1016 @if test -f $@.manifest; then \
1017 if test -f "$(srcdir)/$@.manifest"; then \
1018 mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
1019 else \
1020 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
1021 fi; \
1022 rm -f $@.manifest; \
1024 endif # MSVC with manifest tool
1025 else
1026 ifeq ($(CPP_PROG_LINK),1)
1027 $(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)
1028 else # ! CPP_PROG_LINK
1029 $(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
1030 endif # CPP_PROG_LINK
1031 endif # WINNT && !GNU_CC
1032 endif # WINCE
1034 ifdef ENABLE_STRIP
1035 $(STRIP) $@
1036 endif
1037 ifdef MOZ_POST_PROGRAM_COMMAND
1038 $(MOZ_POST_PROGRAM_COMMAND) $@
1039 endif
1040 ifeq ($(OS_ARCH),BeOS)
1041 ifdef BEOS_PROGRAM_RESOURCE
1042 xres -o $@ $(BEOS_PROGRAM_RESOURCE)
1043 mimeset $@
1044 endif
1045 endif # BeOS
1047 $(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
1048 ifeq (WINCE,$(OS_ARCH))
1049 $(HOST_LD) -NOLOGO -OUT:$@ $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1050 else
1051 ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
1052 $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1053 ifdef MSMANIFEST_TOOL
1054 @if test -f $@.manifest; then \
1055 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
1056 rm -f $@.manifest; \
1058 endif # MSVC with manifest tool
1059 else
1060 ifeq ($(CPP_PROG_LINK),1)
1061 $(HOST_CXX) -o $@ $(HOST_CXXFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1062 else
1063 $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1064 endif # CPP_PROG_LINK
1065 endif
1066 endif
1069 # This is an attempt to support generation of multiple binaries
1070 # in one directory, it assumes everything to compile Foo is in
1071 # Foo.o (from either Foo.c or Foo.cpp).
1073 # SIMPLE_PROGRAMS = Foo Bar
1074 # creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
1076 $(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
1077 ifeq (WINCE,$(OS_ARCH))
1078 $(LD) -nologo -entry:main -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1079 else
1080 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
1081 $(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1082 ifdef MSMANIFEST_TOOL
1083 @if test -f $@.manifest; then \
1084 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
1085 rm -f $@.manifest; \
1087 endif # MSVC with manifest tool
1088 else
1089 ifeq ($(CPP_PROG_LINK),1)
1090 $(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)
1091 else
1092 $(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)
1093 endif # CPP_PROG_LINK
1094 endif # WINNT && !GNU_CC
1095 endif # WINCE
1097 ifdef ENABLE_STRIP
1098 $(STRIP) $@
1099 endif
1100 ifdef MOZ_POST_PROGRAM_COMMAND
1101 $(MOZ_POST_PROGRAM_COMMAND) $@
1102 endif
1104 $(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(OBJ_SUFFIX) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
1105 ifeq (WINCE,$(OS_ARCH))
1106 $(HOST_LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1107 else
1108 ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
1109 $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1110 else
1111 ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX))
1112 $(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXXFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1113 else
1114 $(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_CFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1115 endif
1116 endif
1117 endif
1120 # Purify target. Solaris/sparc only to start.
1121 # Purify does not recognize "egcs" or "c++" so we go with
1122 # "gcc" and "g++" for now.
1124 pure: $(PROGRAM)
1125 ifeq ($(CPP_PROG_LINK),1)
1126 $(PURIFY) $(CCC) -o $^.pure $(CXXFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1127 else
1128 $(PURIFY) $(CC) -o $^.pure $(CFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1129 endif
1130 ifndef NO_DIST_INSTALL
1131 $(INSTALL) $(IFLAGS2) $^.pure $(FINAL_TARGET)
1132 endif
1134 quantify: $(PROGRAM)
1135 ifeq ($(CPP_PROG_LINK),1)
1136 $(QUANTIFY) $(CCC) -o $^.quantify $(CXXFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1137 else
1138 $(QUANTIFY) $(CC) -o $^.quantify $(CFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1139 endif
1140 ifndef NO_DIST_INSTALL
1141 $(INSTALL) $(IFLAGS2) $^.quantify $(FINAL_TARGET)
1142 endif
1145 # This allows us to create static versions of the shared libraries
1146 # that are built using other static libraries. Confused...?
1148 ifdef SHARED_LIBRARY_LIBS
1149 ifeq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
1150 ifneq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB))
1151 LOBJS += $(SHARED_LIBRARY_LIBS)
1152 endif
1153 else
1154 ifneq (,$(filter OSF1 BSD_OS FreeBSD NetBSD OpenBSD SunOS Darwin,$(OS_ARCH)))
1155 CLEANUP1 := | egrep -v '(________64ELEL_|__.SYMDEF)'
1156 CLEANUP2 := rm -f ________64ELEL_ __.SYMDEF
1157 else
1158 CLEANUP2 := true
1159 endif
1160 SUB_LOBJS = $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
1161 endif
1162 endif
1163 ifdef MOZILLA_PROBE_LIBS
1164 PROBE_LOBJS = $(shell for lib in $(MOZILLA_PROBE_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
1165 endif
1166 ifdef DTRACE_PROBE_OBJ
1167 EXTRA_DEPS += $(DTRACE_PROBE_OBJ)
1168 endif
1170 $(LIBRARY): $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
1171 rm -f $@
1172 ifneq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
1173 ifdef SHARED_LIBRARY_LIBS
1174 @rm -f $(SUB_LOBJS)
1175 @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1176 endif
1177 endif
1178 $(AR) $(AR_FLAGS) $(OBJS) $(LOBJS) $(SUB_LOBJS)
1179 $(RANLIB) $@
1180 @rm -f foodummyfilefoo $(SUB_LOBJS)
1182 ifeq (,$(filter-out WINNT WINCE, $(OS_ARCH)))
1183 $(IMPORT_LIBRARY): $(SHARED_LIBRARY)
1184 endif
1186 ifeq ($(OS_ARCH),OS2)
1187 $(DEF_FILE): $(OBJS) $(SHARED_LIBRARY_LIBS)
1188 rm -f $@
1189 echo LIBRARY $(SHARED_LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@
1190 echo PROTMODE >> $@
1191 echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@
1192 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
1193 echo EXPORTS >> $@
1194 ifeq ($(IS_COMPONENT),1)
1195 ifeq ($(HAS_EXTRAEXPORTS),1)
1196 ifndef MOZ_OS2_USE_DECLSPEC
1197 $(FILTER) $(OBJS) $(SHARED_LIBRARY_LIBS) >> $@
1198 endif
1199 else
1200 echo _NSGetModule >> $@
1201 endif
1202 else
1203 ifndef MOZ_OS2_USE_DECLSPEC
1204 $(FILTER) $(OBJS) $(SHARED_LIBRARY_LIBS) >> $@
1205 endif
1206 endif
1207 $(ADD_TO_DEF_FILE)
1209 ifdef MOZ_OS2_USE_DECLSPEC
1210 $(IMPORT_LIBRARY): $(SHARED_LIBRARY)
1211 else
1212 $(IMPORT_LIBRARY): $(DEF_FILE)
1213 endif
1214 rm -f $@
1215 $(IMPLIB) $@ $^
1216 $(RANLIB) $@
1217 endif # OS/2
1219 $(HOST_LIBRARY): $(HOST_OBJS) Makefile
1220 rm -f $@
1221 $(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
1222 $(HOST_RANLIB) $@
1224 ifdef NO_LD_ARCHIVE_FLAGS
1225 SUB_SHLOBJS = $(SUB_LOBJS)
1226 endif
1228 ifdef HAVE_DTRACE
1229 ifndef XP_MACOSX
1230 ifdef DTRACE_PROBE_OBJ
1231 ifndef DTRACE_LIB_DEPENDENT
1232 $(DTRACE_PROBE_OBJ): $(OBJS)
1233 dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(OBJS)
1234 endif
1235 endif
1236 endif
1237 endif
1239 # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
1240 # so instead of deleting .o files after repacking them into a dylib, we make
1241 # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
1242 # so no need to conditionalize on OS version or debugging format.
1244 $(SHARED_LIBRARY): $(OBJS) $(LOBJS) $(DEF_FILE) $(RESFILE) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(DSO_LDOPTS_DEPS) $(GLOBAL_DEPS)
1245 ifndef INCREMENTAL_LINKER
1246 rm -f $@
1247 endif
1248 ifeq ($(OS_ARCH),OpenVMS)
1249 @if test ! -f $(VMS_SYMVEC_FILE); then \
1250 if test -f $(VMS_SYMVEC_FILE_MODULE); then \
1251 echo Creating specific component options file $(VMS_SYMVEC_FILE); \
1252 cp $(VMS_SYMVEC_FILE_MODULE) $(VMS_SYMVEC_FILE); \
1253 fi; \
1255 ifdef IS_COMPONENT
1256 @if test ! -f $(VMS_SYMVEC_FILE); then \
1257 echo Creating generic component options file $(VMS_SYMVEC_FILE); \
1258 cp $(VMS_SYMVEC_FILE_COMP) $(VMS_SYMVEC_FILE); \
1260 endif
1261 endif # OpenVMS
1262 ifdef NO_LD_ARCHIVE_FLAGS
1263 ifdef SHARED_LIBRARY_LIBS
1264 @rm -f $(SUB_SHLOBJS)
1265 @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1266 ifeq ($(OS_ARCH),Darwin)
1267 @echo Making symlinks to the original object files in the archive libraries $(SHARED_LIBRARY_LIBS)
1268 @for lib in $(SHARED_LIBRARY_LIBS); do \
1269 libdir=`echo $$lib|sed -e 's,/[^/]*\.a,,'`; \
1270 ofiles=`$(AR_LIST) $${lib}`; \
1271 for ofile in $$ofiles; do \
1272 if [ -f $$libdir/$$ofile ]; then \
1273 rm -f $$ofile; \
1274 ln -s $$libdir/$$ofile $$ofile; \
1275 fi; \
1276 done; \
1277 done
1278 endif
1279 endif # SHARED_LIBRARY_LIBS
1280 endif # NO_LD_ARCHIVE_FLAGS
1281 ifdef DTRACE_LIB_DEPENDENT
1282 @rm -f $(PROBE_LOBJS)
1283 @for lib in $(MOZILLA_PROBE_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1284 ifndef XP_MACOSX
1285 dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS)
1286 endif
1287 @for lib in $(MOZILLA_PROBE_LIBS); do \
1288 ofiles=`$(AR_LIST) $${lib}`; \
1289 $(AR_DELETE) $${lib} $$ofiles; \
1290 done
1291 $(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)
1292 @rm -f $(PROBE_LOBJS)
1293 @rm -f $(DTRACE_PROBE_OBJ)
1294 @for lib in $(MOZILLA_PROBE_LIBS); do \
1295 if [ -L $${lib} ]; then rm -f `readlink $${lib}`; fi; \
1296 done
1297 @rm -f $(MOZILLA_PROBE_LIBS)
1299 else # ! DTRACE_LIB_DEPENDENT
1300 $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
1301 endif # DTRACE_LIB_DEPENDENT
1303 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
1304 ifdef MSMANIFEST_TOOL
1305 ifdef EMBED_MANIFEST_AT
1306 @if test -f $@.manifest; then \
1307 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
1308 rm -f $@.manifest; \
1310 endif # EMBED_MANIFEST_AT
1311 endif # MSVC with manifest tool
1312 endif # WINNT && !GCC
1313 ifeq ($(OS_ARCH),Darwin)
1314 else # non-Darwin
1315 @rm -f $(SUB_SHLOBJS)
1316 endif # Darwin
1317 @rm -f foodummyfilefoo $(DELETE_AFTER_LINK)
1318 chmod +x $@
1319 ifdef ENABLE_STRIP
1320 $(STRIP) $@
1321 endif
1322 ifdef MOZ_POST_DSO_LIB_COMMAND
1323 $(MOZ_POST_DSO_LIB_COMMAND) $@
1324 endif
1326 ifdef MOZ_AUTO_DEPS
1327 ifdef COMPILER_DEPEND
1328 ifeq ($(SOLARIS_SUNPRO_CC),1)
1329 _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
1331 define MAKE_DEPS_AUTO_CC
1332 if test -d $(@D); then \
1333 echo "Building deps for $< using Sun Studio cc"; \
1334 $(CC) $(COMPILE_CFLAGS) -xM $< >$(_MDDEPFILE) ; \
1336 endef
1337 define MAKE_DEPS_AUTO_CXX
1338 if test -d $(@D); then \
1339 echo "Building deps for $< using Sun Studio CC"; \
1340 $(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \
1342 endef
1343 endif # Sun Studio on Solaris
1344 else # COMPILER_DEPEND
1346 # Generate dependencies on the fly
1348 _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
1350 define MAKE_DEPS_AUTO
1351 if test -d $(@D); then \
1352 echo "Building deps for $<"; \
1353 $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f- $(DEFINES) $(ACDEFINES) $(INCLUDES) $< 2>/dev/null | sed -e "s|^[^ ]*/||" > $(_MDDEPFILE) ; \
1355 endef
1357 MAKE_DEPS_AUTO_CC = $(MAKE_DEPS_AUTO)
1358 MAKE_DEPS_AUTO_CXX = $(MAKE_DEPS_AUTO)
1360 endif # COMPILER_DEPEND
1362 endif # MOZ_AUTO_DEPS
1364 ifdef MOZ_MEMORY
1365 ifeq ($(OS_ARCH),SunOS)
1366 SOLARIS_JEMALLOC_LDFLAGS = $(call EXPAND_LIBNAME_PATH,jemalloc,$(DIST)/lib)
1367 endif
1368 endif
1370 # Rules for building native targets must come first because of the host_ prefix
1371 host_%.$(OBJ_SUFFIX): %.c $(GLOBAL_DEPS)
1372 $(REPORT_BUILD)
1373 $(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1375 host_%.$(OBJ_SUFFIX): %.cpp $(GLOBAL_DEPS)
1376 $(REPORT_BUILD)
1377 $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1379 host_%.$(OBJ_SUFFIX): %.cc $(GLOBAL_DEPS)
1380 $(REPORT_BUILD)
1381 $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1383 host_%.$(OBJ_SUFFIX): %.m $(GLOBAL_DEPS)
1384 $(REPORT_BUILD)
1385 $(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1387 host_%.$(OBJ_SUFFIX): %.mm $(GLOBAL_DEPS)
1388 $(REPORT_BUILD)
1389 $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1391 %: %.c $(GLOBAL_DEPS)
1392 $(REPORT_BUILD)
1393 @$(MAKE_DEPS_AUTO_CC)
1394 $(ELOG) $(CC) $(CFLAGS) $(LDFLAGS) $(OUTOPTION)$@ $(_VPATH_SRCS)
1396 %.$(OBJ_SUFFIX): %.c $(GLOBAL_DEPS)
1397 $(REPORT_BUILD)
1398 @$(MAKE_DEPS_AUTO_CC)
1399 $(ELOG) $(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $(_VPATH_SRCS)
1401 moc_%.cpp: %.h $(GLOBAL_DEPS)
1402 $(MOC) $< $(OUTOPTION)$@
1404 ifdef ASFILES
1405 # The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
1406 # a '-c' flag.
1407 %.$(OBJ_SUFFIX): %.$(ASM_SUFFIX) $(GLOBAL_DEPS)
1408 $(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) $(_VPATH_SRCS)
1409 endif
1411 %.$(OBJ_SUFFIX): %.S $(GLOBAL_DEPS)
1412 $(AS) -o $@ $(ASFLAGS) -c $<
1414 %: %.cpp $(GLOBAL_DEPS)
1415 @$(MAKE_DEPS_AUTO_CXX)
1416 $(CCC) $(OUTOPTION)$@ $(CXXFLAGS) $(_VPATH_SRCS) $(LDFLAGS)
1419 # Please keep the next two rules in sync.
1421 %.$(OBJ_SUFFIX): %.cc $(GLOBAL_DEPS)
1422 $(REPORT_BUILD)
1423 @$(MAKE_DEPS_AUTO_CXX)
1424 $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1426 %.$(OBJ_SUFFIX): %.cpp $(GLOBAL_DEPS)
1427 $(REPORT_BUILD)
1428 @$(MAKE_DEPS_AUTO_CXX)
1429 ifdef STRICT_CPLUSPLUS_SUFFIX
1430 echo "#line 1 \"$*.cpp\"" | cat - $*.cpp > t_$*.cc
1431 $(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) t_$*.cc
1432 rm -f t_$*.cc
1433 else
1434 $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1435 endif #STRICT_CPLUSPLUS_SUFFIX
1437 $(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.mm $(GLOBAL_DEPS)
1438 $(REPORT_BUILD)
1439 @$(MAKE_DEPS_AUTO_CXX)
1440 $(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(_VPATH_SRCS)
1442 $(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.m $(GLOBAL_DEPS)
1443 $(REPORT_BUILD)
1444 @$(MAKE_DEPS_AUTO_CC)
1445 $(ELOG) $(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $(_VPATH_SRCS)
1447 %.s: %.cpp
1448 $(CCC) -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1450 %.s: %.cc
1451 $(CCC) -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1453 %.s: %.c
1454 $(CC) -S $(COMPILE_CFLAGS) $(_VPATH_SRCS)
1456 %.i: %.cpp
1457 $(CCC) -C -E $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) > $*.i
1459 %.i: %.cc
1460 $(CCC) -C -E $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) > $*.i
1462 %.i: %.c
1463 $(CC) -C -E $(COMPILE_CFLAGS) $(_VPATH_SRCS) > $*.i
1465 %.i: %.mm
1466 $(CCC) -C -E $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(_VPATH_SRCS) > $*.i
1468 %.res: %.rc
1469 @echo Creating Resource file: $@
1470 ifeq ($(OS_ARCH),OS2)
1471 $(RC) $(RCFLAGS:-D%=-d %) -i $(subst /,\,$(srcdir)) -r $< $@
1472 else
1473 ifdef GNU_CC
1474 $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) $(OUTOPTION)$@ $(_VPATH_SRCS)
1475 else
1476 $(RC) $(RCFLAGS) -r $(DEFINES) $(INCLUDES) $(OUTOPTION)$@ $(_VPATH_SRCS)
1477 endif
1478 endif
1480 # need 3 separate lines for OS/2
1481 %: %.pl
1482 rm -f $@
1483 cp $< $@
1484 chmod +x $@
1486 %: %.sh
1487 rm -f $@; cp $< $@; chmod +x $@
1489 # Cancel these implicit rules
1491 %: %,v
1493 %: RCS/%,v
1495 %: s.%
1497 %: SCCS/s.%
1499 ###############################################################################
1500 # Java rules
1501 ###############################################################################
1502 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
1503 SEP := ;
1504 else
1505 SEP := :
1506 endif
1508 EMPTY :=
1509 SPACE := $(EMPTY) $(EMPTY)
1511 # Cygwin and MSYS have their own special path form, but javac expects the source
1512 # and class paths to be in the DOS form (i.e. e:/builds/...). This function
1513 # does the appropriate conversion on Windows, but is a noop on other systems.
1514 ifeq (,$(filter-out WINNT WINCE, $(HOST_OS_ARCH)))
1515 ifdef CYGWIN_WRAPPER
1516 normalizepath = $(foreach p,$(1),$(shell cygpath -m $(p)))
1517 else
1518 # assume MSYS
1519 # We use 'pwd -W' to get DOS form of the path. However, since the given path
1520 # could be a file or a non-existent path, we cannot call 'pwd -W' directly
1521 # on the path. Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
1522 # on it, then merge with the rest of the path.
1523 root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\1|")
1524 non-root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\2|")
1525 normalizepath = $(foreach p,$(1),$(if $(filter /%,$(1)),$(shell cd $(call root-path,$(1)) && pwd -W)$(call non-root-path,$(1)),$(1)))
1526 endif
1527 else
1528 normalizepath = $(1)
1529 endif
1531 _srcdir = $(call normalizepath,$(srcdir))
1532 ifdef JAVA_SOURCEPATH
1533 SP = $(subst $(SPACE),$(SEP),$(call normalizepath,$(strip $(JAVA_SOURCEPATH))))
1534 _JAVA_SOURCEPATH = ".$(SEP)$(_srcdir)$(SEP)$(SP)"
1535 else
1536 _JAVA_SOURCEPATH = ".$(SEP)$(_srcdir)"
1537 endif
1539 ifdef JAVA_CLASSPATH
1540 CP = $(subst $(SPACE),$(SEP),$(call normalizepath,$(strip $(JAVA_CLASSPATH))))
1541 _JAVA_CLASSPATH = ".$(SEP)$(CP)"
1542 else
1543 _JAVA_CLASSPATH = .
1544 endif
1546 _JAVA_DIR = _java
1547 $(_JAVA_DIR)::
1548 $(NSINSTALL) -D $@
1550 $(_JAVA_DIR)/%.class: %.java $(GLOBAL_DEPS) $(_JAVA_DIR)
1551 $(CYGWIN_WRAPPER) $(JAVAC) $(JAVAC_FLAGS) -classpath $(_JAVA_CLASSPATH) \
1552 -sourcepath $(_JAVA_SOURCEPATH) -d $(_JAVA_DIR) $(_VPATH_SRCS)
1554 $(JAVA_LIBRARY): $(addprefix $(_JAVA_DIR)/,$(JAVA_SRCS:.java=.class)) $(GLOBAL_DEPS)
1555 $(JAR) cf $@ -C $(_JAVA_DIR) .
1557 GARBAGE_DIRS += $(_JAVA_DIR)
1559 ###############################################################################
1560 # Update Makefiles
1561 ###############################################################################
1563 # In GNU make 3.80, makefiles must use the /cygdrive syntax, even if we're
1564 # processing them with AS perl. See bug 232003
1565 ifdef AS_PERL
1566 CYGWIN_TOPSRCDIR = -nowrap -p $(topsrcdir) -wrap
1567 endif
1569 # Note: Passing depth to make-makefile is optional.
1570 # It saves the script some work, though.
1571 Makefile: Makefile.in
1572 @$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR)
1574 ifdef SUBMAKEFILES
1575 # VPATH does not work on some machines in this case, so add $(srcdir)
1576 $(SUBMAKEFILES): % : $(srcdir)/%.in
1577 $(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR) $@
1578 endif
1580 ifdef AUTOUPDATE_CONFIGURE
1581 $(topsrcdir)/configure: $(topsrcdir)/configure.in
1582 (cd $(topsrcdir) && $(AUTOCONF)) && (cd $(DEPTH) && ./config.status --recheck)
1583 endif
1585 ###############################################################################
1586 # Bunch of things that extend the 'export' rule (in order):
1587 ###############################################################################
1589 ################################################################################
1590 # Copy each element of EXPORTS to $(PUBLIC)
1592 ifneq ($(EXPORTS)$(XPIDLSRCS)$(SDK_HEADERS)$(SDK_XPIDLSRCS),)
1593 $(SDK_PUBLIC) $(PUBLIC):
1594 $(NSINSTALL) -D $@
1595 endif
1597 ifdef MOZ_JAVAXPCOM
1598 ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1599 $(JAVA_DIST_DIR)::
1600 $(NSINSTALL) -D $@
1601 endif
1602 endif
1604 ifneq ($(XPI_NAME),)
1605 $(FINAL_TARGET):
1606 $(NSINSTALL) -D $@
1608 export:: $(FINAL_TARGET)
1609 endif
1611 ifndef NO_DIST_INSTALL
1612 ifneq ($(EXPORTS),)
1613 export:: $(EXPORTS) $(PUBLIC)
1614 $(INSTALL) $(IFLAGS1) $^
1615 endif
1617 ifneq ($(SDK_HEADERS),)
1618 export:: $(SDK_HEADERS) $(SDK_PUBLIC)
1619 $(INSTALL) $(IFLAGS1) $^
1621 export:: $(SDK_HEADERS) $(PUBLIC)
1622 $(INSTALL) $(IFLAGS1) $^
1623 endif
1624 endif # NO_DIST_INSTALL
1626 ################################################################################
1627 # Copy each element of PREF_JS_EXPORTS
1629 ifdef GRE_MODULE
1630 PREF_DIR = greprefs
1631 else
1632 ifneq (,$(XPI_NAME)$(LIBXUL_SDK))
1633 PREF_DIR = defaults/preferences
1634 else
1635 PREF_DIR = defaults/pref
1636 endif
1637 endif
1639 ifneq ($(PREF_JS_EXPORTS),)
1640 # on win32, pref files need CRLF line endings... see bug 206029
1641 ifeq (WINNT,$(OS_ARCH))
1642 PREF_PPFLAGS = --line-endings=crlf
1643 endif
1645 ifndef NO_DIST_INSTALL
1646 $(FINAL_TARGET)/$(PREF_DIR):
1647 $(NSINSTALL) -D $@
1649 libs:: $(FINAL_TARGET)/$(PREF_DIR) $(PREF_JS_EXPORTS)
1650 $(EXIT_ON_ERROR) \
1651 for i in $(PREF_JS_EXPORTS); do \
1652 dest=$(FINAL_TARGET)/$(PREF_DIR)/`basename $$i`; \
1653 $(RM) -f $$dest; \
1654 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1655 done
1656 endif
1657 endif
1659 ################################################################################
1660 # Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
1662 ifneq ($(AUTOCFG_JS_EXPORTS),)
1663 $(FINAL_TARGET)/defaults/autoconfig::
1664 $(NSINSTALL) -D $@
1666 ifndef NO_DIST_INSTALL
1667 export:: $(AUTOCFG_JS_EXPORTS) $(FINAL_TARGET)/defaults/autoconfig
1668 $(INSTALL) $(IFLAGS1) $^
1669 endif
1671 endif
1672 ################################################################################
1673 # Export the elements of $(XPIDLSRCS) & $(SDK_XPIDLSRCS),
1674 # generating .h and .xpt files and moving them to the appropriate places.
1676 ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1678 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))
1680 ifndef XPIDL_MODULE
1681 XPIDL_MODULE = $(MODULE)
1682 endif
1684 ifeq ($(XPIDL_MODULE),) # we need $(XPIDL_MODULE) to make $(XPIDL_MODULE).xpt
1685 export:: FORCE
1686 @echo
1687 @echo "*** Error processing XPIDLSRCS:"
1688 @echo "Please define MODULE or XPIDL_MODULE when defining XPIDLSRCS,"
1689 @echo "so we have a module name to use when creating MODULE.xpt."
1690 @echo; sleep 2; false
1691 endif
1693 $(SDK_IDL_DIR) $(IDL_DIR)::
1694 $(NSINSTALL) -D $@
1696 # generate .h files from into $(XPIDL_GEN_DIR), then export to $(PUBLIC);
1697 # warn against overriding existing .h file.
1698 $(XPIDL_GEN_DIR)/.done:
1699 @if test ! -d $(XPIDL_GEN_DIR); then echo Creating $(XPIDL_GEN_DIR)/.done; rm -rf $(XPIDL_GEN_DIR); mkdir $(XPIDL_GEN_DIR); fi
1700 @touch $@
1702 # don't depend on $(XPIDL_GEN_DIR), because the modification date changes
1703 # with any addition to the directory, regenerating all .h files -> everything.
1705 $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
1706 $(REPORT_BUILD)
1707 $(ELOG) $(XPIDL_COMPILE) -m header -w $(XPIDL_FLAGS) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
1708 @if test -n "$(findstring $*.h, $(EXPORTS) $(SDK_HEADERS))"; \
1709 then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
1711 ifndef NO_GEN_XPT
1712 # generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link
1713 # into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
1714 $(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
1715 $(REPORT_BUILD)
1716 $(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$*.pp $(_VPATH_SRCS)
1718 # no need to link together if XPIDLSRCS contains only XPIDL_MODULE
1719 ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))
1720 $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS) $(SDK_XPIDLSRCS)) $(GLOBAL_DEPS) $(XPIDL_LINK)
1721 $(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS) $(SDK_XPIDLSRCS))
1722 endif # XPIDL_MODULE.xpt != XPIDLSRCS
1724 libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
1725 ifndef NO_DIST_INSTALL
1726 $(INSTALL) $(IFLAGS1) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(FINAL_TARGET)/components
1727 endif
1729 endif # NO_GEN_XPT
1731 GARBAGE_DIRS += $(XPIDL_GEN_DIR)
1733 endif # XPIDLSRCS || SDK_XPIDLSRCS
1735 ifneq ($(XPIDLSRCS),)
1736 # export .idl files to $(IDL_DIR)
1737 ifndef NO_DIST_INSTALL
1738 export:: $(XPIDLSRCS) $(IDL_DIR)
1739 $(INSTALL) $(IFLAGS1) $^
1741 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) $(PUBLIC)
1742 $(INSTALL) $(IFLAGS1) $^
1743 endif # NO_DIST_INSTALL
1745 endif # XPIDLSRCS
1750 # General rules for exporting idl files.
1752 # WORK-AROUND ONLY, for mozilla/tools/module-deps/bootstrap.pl build.
1753 # Bug to fix idl dependency problems w/o this extra build pass is
1754 # http://bugzilla.mozilla.org/show_bug.cgi?id=145777
1756 $(IDL_DIR)::
1757 $(NSINSTALL) -D $@
1759 export-idl:: $(SUBMAKEFILES) $(MAKE_DIRS)
1761 ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1762 ifndef NO_DIST_INSTALL
1763 export-idl:: $(XPIDLSRCS) $(SDK_XPIDLSRCS) $(IDL_DIR)
1764 $(INSTALL) $(IFLAGS1) $^
1765 endif
1766 endif
1767 +$(LOOP_OVER_PARALLEL_DIRS)
1768 +$(LOOP_OVER_DIRS)
1769 +$(LOOP_OVER_TOOL_DIRS)
1774 ifneq ($(SDK_XPIDLSRCS),)
1775 # export .idl files to $(IDL_DIR) & $(SDK_IDL_DIR)
1776 ifndef NO_DIST_INSTALL
1777 export:: $(SDK_XPIDLSRCS) $(IDL_DIR)
1778 $(INSTALL) $(IFLAGS1) $^
1780 export:: $(SDK_XPIDLSRCS) $(SDK_IDL_DIR)
1781 $(INSTALL) $(IFLAGS1) $^
1783 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(SDK_XPIDLSRCS)) $(PUBLIC)
1784 $(INSTALL) $(IFLAGS1) $^
1786 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(SDK_XPIDLSRCS)) $(SDK_PUBLIC)
1787 $(INSTALL) $(IFLAGS1) $^
1788 endif
1790 endif # SDK_XPIDLSRCS
1794 ifdef MOZ_JAVAXPCOM
1795 ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1797 JAVA_XPIDLSRCS = $(XPIDLSRCS) $(SDK_XPIDLSRCS)
1799 # A single IDL file can contain multiple interfaces, which result in multiple
1800 # Java interface files. So use hidden dependency files.
1801 JAVADEPFILES = $(addprefix $(JAVA_GEN_DIR)/.,$(JAVA_XPIDLSRCS:.idl=.java.pp))
1803 $(JAVA_GEN_DIR):
1804 $(NSINSTALL) -D $@
1805 GARBAGE_DIRS += $(JAVA_GEN_DIR)
1807 # generate .java files into _javagen/[package name dirs]
1808 _JAVA_GEN_DIR = $(JAVA_GEN_DIR)/$(JAVA_IFACES_PKG_NAME)
1809 $(_JAVA_GEN_DIR):
1810 $(NSINSTALL) -D $@
1812 $(JAVA_GEN_DIR)/.%.java.pp: %.idl $(XPIDL_COMPILE) $(_JAVA_GEN_DIR)
1813 $(REPORT_BUILD)
1814 $(ELOG) $(XPIDL_COMPILE) -m java -w -I$(srcdir) -I$(IDL_DIR) -o $(_JAVA_GEN_DIR)/$* $(_VPATH_SRCS)
1815 @touch $@
1817 # "Install" generated Java interfaces. We segregate them based on the XPI_NAME.
1818 # If XPI_NAME is not set, install into the "default" directory.
1819 ifneq ($(XPI_NAME),)
1820 JAVA_INSTALL_DIR = $(JAVA_DIST_DIR)/$(XPI_NAME)
1821 else
1822 JAVA_INSTALL_DIR = $(JAVA_DIST_DIR)/default
1823 endif
1825 $(JAVA_INSTALL_DIR):
1826 $(NSINSTALL) -D $@
1828 export:: $(JAVA_DIST_DIR) $(JAVADEPFILES) $(JAVA_INSTALL_DIR)
1829 (cd $(JAVA_GEN_DIR) && tar $(TAR_CREATE_FLAGS) - .) | (cd $(JAVA_INSTALL_DIR) && tar -xf -)
1831 endif # XPIDLSRCS || SDK_XPIDLSRCS
1832 endif # MOZ_JAVAXPCOM
1834 ################################################################################
1835 # Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
1836 ifdef EXTRA_COMPONENTS
1837 libs:: $(EXTRA_COMPONENTS)
1838 ifndef NO_DIST_INSTALL
1839 $(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/components
1840 endif
1842 endif
1844 ifdef EXTRA_PP_COMPONENTS
1845 libs:: $(EXTRA_PP_COMPONENTS)
1846 ifndef NO_DIST_INSTALL
1847 $(EXIT_ON_ERROR) \
1848 $(NSINSTALL) -D $(FINAL_TARGET)/components; \
1849 for i in $^; do \
1850 dest=$(FINAL_TARGET)/components/`basename $$i`; \
1851 $(RM) -f $$dest; \
1852 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1853 done
1854 endif
1856 endif
1858 ################################################################################
1859 # Copy each element of EXTRA_JS_MODULES to $(FINAL_TARGET)/modules
1860 ifdef EXTRA_JS_MODULES
1861 libs:: $(EXTRA_JS_MODULES)
1862 ifndef NO_DIST_INSTALL
1863 $(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/modules
1864 endif
1866 endif
1868 ifdef EXTRA_PP_JS_MODULES
1869 libs:: $(EXTRA_PP_JS_MODULES)
1870 ifndef NO_DIST_INSTALL
1871 $(EXIT_ON_ERROR) \
1872 $(NSINSTALL) -D $(FINAL_TARGET)/modules; \
1873 for i in $^; do \
1874 dest=$(FINAL_TARGET)/modules/`basename $$i`; \
1875 $(RM) -f $$dest; \
1876 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1877 done
1878 endif
1880 endif
1882 ################################################################################
1883 # SDK
1885 ifneq (,$(SDK_LIBRARY))
1886 $(SDK_LIB_DIR)::
1887 $(NSINSTALL) -D $@
1889 ifndef NO_DIST_INSTALL
1890 libs:: $(SDK_LIBRARY) $(SDK_LIB_DIR)
1891 $(INSTALL) $(IFLAGS2) $^
1892 endif
1894 endif # SDK_LIBRARY
1896 ifneq (,$(SDK_BINARY))
1897 $(SDK_BIN_DIR)::
1898 $(NSINSTALL) -D $@
1900 ifndef NO_DIST_INSTALL
1901 libs:: $(SDK_BINARY) $(SDK_BIN_DIR)
1902 $(INSTALL) $(IFLAGS2) $^
1903 endif
1905 endif # SDK_BINARY
1907 ################################################################################
1908 # CHROME PACKAGING
1910 JAR_MANIFEST := $(srcdir)/jar.mn
1912 chrome::
1913 $(MAKE) realchrome
1914 +$(LOOP_OVER_PARALLEL_DIRS)
1915 +$(LOOP_OVER_DIRS)
1916 +$(LOOP_OVER_TOOL_DIRS)
1918 $(FINAL_TARGET)/chrome:
1919 $(NSINSTALL) -D $@
1921 ifneq (,$(wildcard $(JAR_MANIFEST)))
1922 ifndef NO_DIST_INSTALL
1923 libs realchrome:: $(CHROME_DEPS) $(FINAL_TARGET)/chrome
1924 $(PYTHON) $(MOZILLA_DIR)/config/JarMaker.py \
1925 $(QUIET) -j $(FINAL_TARGET)/chrome \
1926 $(MAKE_JARS_FLAGS) $(XULPPFLAGS) $(DEFINES) $(ACDEFINES) \
1927 $(JAR_MANIFEST)
1928 endif
1929 endif
1931 ifneq ($(DIST_FILES),)
1932 $(DIST)/bin:
1933 $(NSINSTALL) -D $@
1935 libs:: $(DIST_FILES) $(DIST)/bin
1936 @$(EXIT_ON_ERROR) \
1937 for f in $(DIST_FILES); do \
1938 dest=$(FINAL_TARGET)/`basename $$f`; \
1939 $(RM) -f $$dest; \
1940 $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
1941 $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
1942 $(srcdir)/$$f > $$dest; \
1943 done
1944 endif
1946 ifneq ($(DIST_CHROME_FILES),)
1947 libs:: $(DIST_CHROME_FILES)
1948 @$(EXIT_ON_ERROR) \
1949 for f in $(DIST_CHROME_FILES); do \
1950 dest=$(FINAL_TARGET)/chrome/`basename $$f`; \
1951 $(RM) -f $$dest; \
1952 $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
1953 $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
1954 $(srcdir)/$$f > $$dest; \
1955 done
1956 endif
1958 ifneq ($(XPI_PKGNAME),)
1959 libs realchrome::
1960 ifdef STRIP_XPI
1961 ifndef MOZ_DEBUG
1962 @echo "Stripping $(XPI_PKGNAME) package directory..."
1963 @echo $(FINAL_TARGET)
1964 @cd $(FINAL_TARGET) && find . ! -type d \
1965 ! -name "*.js" \
1966 ! -name "*.xpt" \
1967 ! -name "*.gif" \
1968 ! -name "*.jpg" \
1969 ! -name "*.png" \
1970 ! -name "*.xpm" \
1971 ! -name "*.txt" \
1972 ! -name "*.rdf" \
1973 ! -name "*.sh" \
1974 ! -name "*.properties" \
1975 ! -name "*.dtd" \
1976 ! -name "*.html" \
1977 ! -name "*.xul" \
1978 ! -name "*.css" \
1979 ! -name "*.xml" \
1980 ! -name "*.jar" \
1981 ! -name "*.dat" \
1982 ! -name "*.tbl" \
1983 ! -name "*.src" \
1984 ! -name "*.reg" \
1985 $(PLATFORM_EXCLUDE_LIST) \
1986 -exec $(STRIP) $(STRIP_FLAGS) {} >/dev/null 2>&1 \;
1987 endif
1988 endif
1989 @echo "Packaging $(XPI_PKGNAME).xpi..."
1990 cd $(FINAL_TARGET) && $(ZIP) -qr ../$(XPI_PKGNAME).xpi *
1991 endif
1993 ifdef INSTALL_EXTENSION_ID
1994 ifndef XPI_NAME
1995 $(error XPI_NAME must be set for INSTALL_EXTENSION_ID)
1996 endif
1998 libs::
1999 $(RM) -rf "$(DIST)/bin/extensions/$(INSTALL_EXTENSION_ID)"
2000 $(NSINSTALL) -D "$(DIST)/bin/extensions/$(INSTALL_EXTENSION_ID)"
2001 cd $(FINAL_TARGET) && tar $(TAR_CREATE_FLAGS) - . | (cd "../../bin/extensions/$(INSTALL_EXTENSION_ID)" && tar -xf -)
2003 endif
2005 ifneq (,$(filter flat symlink,$(MOZ_CHROME_FILE_FORMAT)))
2006 _JAR_REGCHROME_DISABLE_JAR=1
2007 else
2008 _JAR_REGCHROME_DISABLE_JAR=0
2009 endif
2011 REGCHROME = $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/add-chrome.pl \
2012 $(if $(filter gtk2,$(MOZ_WIDGET_TOOLKIT)),-x) \
2013 $(if $(CROSS_COMPILE),-o $(OS_ARCH)) $(FINAL_TARGET)/chrome/installed-chrome.txt \
2014 $(_JAR_REGCHROME_DISABLE_JAR)
2016 REGCHROME_INSTALL = $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/add-chrome.pl \
2017 $(if $(filter gtk2,$(MOZ_WIDGET_TOOLKIT)),-x) \
2018 $(if $(CROSS_COMPILE),-o $(OS_ARCH)) $(DESTDIR)$(mozappdir)/chrome/installed-chrome.txt \
2019 $(_JAR_REGCHROME_DISABLE_JAR)
2022 #############################################################################
2023 # Dependency system
2024 #############################################################################
2025 ifdef COMPILER_DEPEND
2026 depend::
2027 @echo "$(MAKE): No need to run depend target.\
2028 Using compiler-based depend." 1>&2
2029 ifeq ($(GNU_CC)$(GNU_CXX),)
2030 # Non-GNU compilers
2031 @echo "`echo '$(MAKE):'|sed 's/./ /g'`"\
2032 '(Compiler-based depend was turned on by "--enable-md".)' 1>&2
2033 else
2034 # GNU compilers
2035 @space="`echo '$(MAKE): '|sed 's/./ /g'`";\
2036 echo "$$space"'Since you are using a GNU compiler,\
2037 it is on by default.' 1>&2; \
2038 echo "$$space"'To turn it off, pass --disable-md to configure.' 1>&2
2039 endif
2041 else # ! COMPILER_DEPEND
2043 ifndef MOZ_AUTO_DEPS
2045 define MAKE_DEPS_NOAUTO
2046 $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f- $(DEFINES) $(ACDEFINES) $(INCLUDES) $< 2>/dev/null | sed -e "s|^[^ ]*/||" > $@
2047 endef
2049 $(MDDEPDIR)/%.pp: %.c
2050 $(REPORT_BUILD)
2051 @$(MAKE_DEPS_NOAUTO)
2053 $(MDDEPDIR)/%.pp: %.cpp
2054 $(REPORT_BUILD)
2055 @$(MAKE_DEPS_NOAUTO)
2057 $(MDDEPDIR)/%.pp: %.s
2058 $(REPORT_BUILD)
2059 @$(MAKE_DEPS_NOAUTO)
2061 ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
2062 depend:: $(SUBMAKEFILES) $(MAKE_DIRS) $(MDDEPFILES)
2063 else
2064 depend:: $(SUBMAKEFILES)
2065 endif
2066 +$(LOOP_OVER_PARALLEL_DIRS)
2067 +$(LOOP_OVER_DIRS)
2068 +$(LOOP_OVER_TOOL_DIRS)
2070 dependclean:: $(SUBMAKEFILES)
2071 rm -f $(MDDEPFILES)
2072 +$(LOOP_OVER_PARALLEL_DIRS)
2073 +$(LOOP_OVER_DIRS)
2074 +$(LOOP_OVER_TOOL_DIRS)
2076 endif # MOZ_AUTO_DEPS
2078 endif # COMPILER_DEPEND
2081 #############################################################################
2082 # MDDEPDIR is the subdirectory where all the dependency files are placed.
2083 # This uses a make rule (instead of a macro) to support parallel
2084 # builds (-jN). If this were done in the LOOP_OVER_DIRS macro, two
2085 # processes could simultaneously try to create the same directory.
2087 # We use $(CURDIR) in the rule's target to ensure that we don't find
2088 # a dependency directory in the source tree via VPATH (perhaps from
2089 # a previous build in the source tree) and thus neglect to create a
2090 # dependency directory in the object directory, where we really need
2091 # it.
2093 $(CURDIR)/$(MDDEPDIR):
2094 @if test ! -d $@; then echo Creating $@; rm -rf $@; mkdir $@; else true; fi
2096 ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))
2097 ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
2098 MDDEPEND_FILES := $(strip $(wildcard $(MDDEPDIR)/*.pp))
2100 ifneq (,$(MDDEPEND_FILES))
2101 ifdef PERL
2102 # The script mddepend.pl checks the dependencies and writes to stdout
2103 # one rule to force out-of-date objects. For example,
2104 # foo.o boo.o: FORCE
2105 # The script has an advantage over including the *.pp files directly
2106 # because it handles the case when header files are removed from the build.
2107 # 'make' would complain that there is no way to build missing headers.
2108 ifeq (,$(MAKE_RESTARTS))
2109 $(MDDEPDIR)/.all.pp: FORCE
2110 @$(PERL) $(BUILD_TOOLS)/mddepend.pl $@ $(MDDEPEND_FILES)
2111 endif
2112 -include $(MDDEPDIR)/.all.pp
2113 else
2114 include $(MDDEPEND_FILES)
2115 endif
2116 endif
2118 endif
2119 endif
2120 #############################################################################
2122 -include $(topsrcdir)/$(MOZ_BUILD_APP)/app-rules.mk
2123 -include $(MY_RULES)
2126 # This speeds up gmake's processing if these files don't exist.
2128 $(MY_CONFIG) $(MY_RULES):
2129 @touch $@
2132 # Generate Emacs tags in a file named TAGS if ETAGS was set in $(MY_CONFIG)
2133 # or in $(MY_RULES)
2135 ifdef ETAGS
2136 ifneq ($(CSRCS)$(CPPSRCS)$(HEADERS),)
2137 all:: TAGS
2138 TAGS:: $(CSRCS) $(CPPSRCS) $(HEADERS)
2139 $(ETAGS) $(CSRCS) $(CPPSRCS) $(HEADERS)
2140 endif
2141 endif
2143 ################################################################################
2144 # Special gmake rules.
2145 ################################################################################
2149 # Disallow parallel builds with MSVC < 8
2151 ifneq (,$(filter 1200 1300 1310,$(_MSC_VER)))
2152 .NOTPARALLEL:
2153 endif
2156 # Re-define the list of default suffixes, so gmake won't have to churn through
2157 # hundreds of built-in suffix rules for stuff we don't need.
2159 .SUFFIXES:
2162 # Fake targets. Always run these rules, even if a file/directory with that
2163 # name already exists.
2165 .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
2167 # Used as a dependency to force targets to rebuild
2168 FORCE:
2170 # Delete target if error occurs when building target
2171 .DELETE_ON_ERROR:
2173 # Properly set LIBPATTERNS for the platform
2174 .LIBPATTERNS = $(if $(IMPORT_LIB_SUFFIX),$(LIB_PREFIX)%.$(IMPORT_LIB_SUFFIX)) $(LIB_PREFIX)%.$(LIB_SUFFIX) $(DLL_PREFIX)%$(DLL_SUFFIX)
2176 tags: TAGS
2178 TAGS: $(SUBMAKEFILES) $(CSRCS) $(CPPSRCS) $(wildcard *.h)
2179 -etags $(CSRCS) $(CPPSRCS) $(wildcard *.h)
2180 +$(LOOP_OVER_PARALLEL_DIRS)
2181 +$(LOOP_OVER_DIRS)
2183 echo-variable-%:
2184 @echo "$($*)"
2186 echo-tiers:
2187 @echo $(TIERS)
2189 echo-tier-dirs:
2190 @$(foreach tier,$(TIERS),echo '$(tier):'; echo ' dirs: $(tier_$(tier)_dirs)'; echo ' staticdirs: $(tier_$(tier)_staticdirs)'; )
2192 echo-dirs:
2193 @echo $(DIRS)
2195 echo-module:
2196 @echo $(MODULE)
2198 echo-requires:
2199 @echo $(REQUIRES)
2201 echo-requires-recursive::
2202 ifdef _REPORT_ALL_DIRS
2203 @echo $(subst $(topsrcdir)/,,$(srcdir)): $(MODULE): $(REQUIRES)
2204 else
2205 @$(if $(REQUIRES),echo $(subst $(topsrcdir)/,,$(srcdir)): $(MODULE): $(REQUIRES))
2206 endif
2207 +$(LOOP_OVER_PARALLEL_DIRS)
2208 +$(LOOP_OVER_DIRS)
2210 echo-depth-path:
2211 @$(topsrcdir)/build/unix/print-depth-path.sh
2213 echo-module-name:
2214 @$(topsrcdir)/build/package/rpm/print-module-name.sh
2216 echo-module-filelist:
2217 @$(topsrcdir)/build/package/rpm/print-module-filelist.sh
2219 showtargs:
2220 ifneq (,$(filter $(PROGRAM) $(HOST_PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS)))
2221 @echo --------------------------------------------------------------------------------
2222 @echo "PROGRAM = $(PROGRAM)"
2223 @echo "SIMPLE_PROGRAMS = $(SIMPLE_PROGRAMS)"
2224 @echo "LIBRARY = $(LIBRARY)"
2225 @echo "SHARED_LIBRARY = $(SHARED_LIBRARY)"
2226 @echo "SHARED_LIBRARY_LIBS = $(SHARED_LIBRARY_LIBS)"
2227 @echo "LIBS = $(LIBS)"
2228 @echo "DEF_FILE = $(DEF_FILE)"
2229 @echo "IMPORT_LIBRARY = $(IMPORT_LIBRARY)"
2230 @echo "STATIC_LIBS = $(STATIC_LIBS)"
2231 @echo "SHARED_LIBS = $(SHARED_LIBS)"
2232 @echo "EXTRA_DSO_LIBS = $(EXTRA_DSO_LIBS)"
2233 @echo "EXTRA_DSO_LDOPTS = $(EXTRA_DSO_LDOPTS)"
2234 @echo "DEPENDENT_LIBS = $(DEPENDENT_LIBS)"
2235 @echo --------------------------------------------------------------------------------
2236 endif
2237 +$(LOOP_OVER_PARALLEL_DIRS)
2238 +$(LOOP_OVER_DIRS)
2240 showbuild:
2241 @echo "MOZ_BUILD_ROOT = $(MOZ_BUILD_ROOT)"
2242 @echo "MOZ_WIDGET_TOOLKIT = $(MOZ_WIDGET_TOOLKIT)"
2243 @echo "CC = $(CC)"
2244 @echo "CXX = $(CXX)"
2245 @echo "CCC = $(CCC)"
2246 @echo "CPP = $(CPP)"
2247 @echo "LD = $(LD)"
2248 @echo "AR = $(AR)"
2249 @echo "IMPLIB = $(IMPLIB)"
2250 @echo "FILTER = $(FILTER)"
2251 @echo "MKSHLIB = $(MKSHLIB)"
2252 @echo "MKCSHLIB = $(MKCSHLIB)"
2253 @echo "RC = $(RC)"
2254 @echo "CFLAGS = $(CFLAGS)"
2255 @echo "OS_CFLAGS = $(OS_CFLAGS)"
2256 @echo "COMPILE_CFLAGS = $(COMPILE_CFLAGS)"
2257 @echo "CXXFLAGS = $(CXXFLAGS)"
2258 @echo "OS_CXXFLAGS = $(OS_CXXFLAGS)"
2259 @echo "COMPILE_CXXFLAGS = $(COMPILE_CXXFLAGS)"
2260 @echo "COMPILE_CMFLAGS = $(COMPILE_CMFLAGS)"
2261 @echo "COMPILE_CMMFLAGS = $(COMPILE_CMMFLAGS)"
2262 @echo "LDFLAGS = $(LDFLAGS)"
2263 @echo "OS_LDFLAGS = $(OS_LDFLAGS)"
2264 @echo "DSO_LDOPTS = $(DSO_LDOPTS)"
2265 @echo "OS_INCLUDES = $(OS_INCLUDES)"
2266 @echo "OS_LIBS = $(OS_LIBS)"
2267 @echo "EXTRA_LIBS = $(EXTRA_LIBS)"
2268 @echo "BIN_FLAGS = $(BIN_FLAGS)"
2269 @echo "INCLUDES = $(INCLUDES)"
2270 @echo "DEFINES = $(DEFINES)"
2271 @echo "ACDEFINES = $(ACDEFINES)"
2272 @echo "BIN_SUFFIX = $(BIN_SUFFIX)"
2273 @echo "LIB_SUFFIX = $(LIB_SUFFIX)"
2274 @echo "DLL_SUFFIX = $(DLL_SUFFIX)"
2275 @echo "IMPORT_LIB_SUFFIX = $(IMPORT_LIB_SUFFIX)"
2276 @echo "INSTALL = $(INSTALL)"
2278 showhost:
2279 @echo "HOST_CC = $(HOST_CC)"
2280 @echo "HOST_CXX = $(HOST_CXX)"
2281 @echo "HOST_CFLAGS = $(HOST_CFLAGS)"
2282 @echo "HOST_LDFLAGS = $(HOST_LDFLAGS)"
2283 @echo "HOST_LIBS = $(HOST_LIBS)"
2284 @echo "HOST_EXTRA_LIBS = $(HOST_EXTRA_LIBS)"
2285 @echo "HOST_EXTRA_DEPS = $(HOST_EXTRA_DEPS)"
2286 @echo "HOST_PROGRAM = $(HOST_PROGRAM)"
2287 @echo "HOST_OBJS = $(HOST_OBJS)"
2288 @echo "HOST_PROGOBJS = $(HOST_PROGOBJS)"
2289 @echo "HOST_LIBRARY = $(HOST_LIBRARY)"
2291 showbuildmods::
2292 @echo "Build Modules = $(BUILD_MODULES)"
2293 @echo "Module dirs = $(BUILD_MODULE_DIRS)"
2295 zipmakes:
2296 ifneq (,$(filter $(PROGRAM) $(SIMPLE_PROGRAMS) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS)))
2297 zip $(DEPTH)/makefiles $(subst $(topsrcdir),$(MOZ_SRC)/mozilla,$(srcdir)/Makefile.in)
2298 endif
2299 +$(LOOP_OVER_PARALLEL_DIRS)
2300 +$(LOOP_OVER_DIRS)
2302 documentation:
2303 @cd $(DEPTH)
2304 $(DOXYGEN) $(DEPTH)/config/doxygen.cfg
2306 check:: $(SUBMAKEFILES) $(MAKE_DIRS)
2307 +$(LOOP_OVER_PARALLEL_DIRS)
2308 +$(LOOP_OVER_DIRS)
2309 +$(LOOP_OVER_TOOL_DIRS)