Bug 463982 - Drop configure support for cairo-mac widget toolkit, r=ted
[wine-gecko.git] / config / rules.mk
blob054cfe19e8a94c9dc55d570b89c7e3157689c6e4
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 # ELOG prints out failed command when building silently (gmake -s).
66 ifneq (,$(findstring -s,$(MAKEFLAGS)))
67 ELOG := $(EXEC) sh $(BUILD_TOOLS)/print-failed-commands.sh
68 else
69 ELOG :=
70 endif
72 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
73 ifndef GNU_CC
74 _LIBNAME_RELATIVE_PATHS=1
75 endif
76 endif
78 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
79 PWD := $(shell pwd)
80 _VPATH_SRCS = $(if $(filter /%,$<),$<,$(PWD)/$<)
81 else
82 _VPATH_SRCS = $<
83 endif
85 # Add $(DIST)/lib to VPATH so that -lfoo dependencies are followed
86 VPATH += $(DIST)/lib
87 ifdef LIBXUL_SDK
88 VPATH += $(LIBXUL_SDK)/lib
89 endif
91 # EXPAND_LIBNAME - $(call EXPAND_LIBNAME,foo)
92 # expands to foo.lib on platforms with import libs and -lfoo otherwise
94 # EXPAND_LIBNAME_PATH - $(call EXPAND_LIBNAME_PATH,foo,dir)
95 # expands to dir/foo.lib on platforms with import libs and
96 # -Ldir -lfoo otherwise
98 # EXPAND_MOZLIBNAME - $(call EXPAND_MOZLIBNAME,foo)
99 # expands to $(DIST)/lib/foo.lib on platforms with import libs and
100 # -lfoo otherwise
102 ifdef _LIBNAME_RELATIVE_PATHS
103 EXPAND_LIBNAME = $(foreach lib,$(1),$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
104 EXPAND_LIBNAME_PATH = $(foreach lib,$(1),$(2)/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
105 EXPAND_MOZLIBNAME = $(foreach lib,$(1),$(DIST)/lib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
106 else
107 EXPAND_LIBNAME = $(addprefix -l,$(1))
108 EXPAND_LIBNAME_PATH = -L$(2) $(addprefix -l,$(1))
109 EXPAND_MOZLIBNAME = $(addprefix -l,$(1))
110 endif
112 ifdef EXTRA_DSO_LIBS
113 EXTRA_DSO_LIBS := $(call EXPAND_MOZLIBNAME,$(EXTRA_DSO_LIBS))
114 endif
116 ################################################################################
117 # Testing frameworks support
118 ################################################################################
120 ifdef ENABLE_TESTS
122 ifdef XPCSHELL_TESTS
123 ifndef MODULE
124 $(error Must define MODULE when defining XPCSHELL_TESTS.)
125 endif
127 # Test file installation
128 libs::
129 @$(EXIT_ON_ERROR) \
130 for testdir in $(XPCSHELL_TESTS); do \
131 $(INSTALL) \
132 $(srcdir)/$$testdir/*.js \
133 $(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir; \
134 done
136 # Path formats on Windows are hard. We require a topsrcdir formatted so that
137 # it may be passed to nsILocalFile.initWithPath (in other words, an absolute
138 # path of the form X:\path\to\topsrcdir), which we store in NATIVE_TOPSRCDIR.
139 # We require a forward-slashed path to topsrcdir so that it may be combined
140 # with a relative forward-slashed path for loading scripts, both dynamically
141 # and statically for head/test/tail JS files. Of course, on non-Windows none
142 # of this matters, and things will work correctly because everything's
143 # forward-slashed, everywhere, always.
144 ifdef CYGWIN_WRAPPER
145 NATIVE_TOPSRCDIR := `cygpath -wa $(topsrcdir)`
146 FWDSLASH_TOPSRCDIR := `cygpath -ma $(topsrcdir)`
147 else
148 FWDSLASH_TOPSRCDIR := $(topsrcdir)
149 ifeq ($(HOST_OS_ARCH),WINNT)
150 NATIVE_TOPSRCDIR := $(subst /,\\,$(WIN_TOP_SRC))
151 else
152 NATIVE_TOPSRCDIR := $(topsrcdir)
153 endif
154 endif # CYGWIN_WRAPPER
156 # Test execution
157 check::
158 @$(EXIT_ON_ERROR) \
159 for testdir in $(XPCSHELL_TESTS); do \
160 $(RUN_TEST_PROGRAM) \
161 $(topsrcdir)/tools/test-harness/xpcshell-simple/test_all.sh \
162 $(DIST)/bin/xpcshell \
163 $(FWDSLASH_TOPSRCDIR) \
164 $(NATIVE_TOPSRCDIR) \
165 $(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir; \
166 done
168 # Test execution
169 check-interactive::
170 @$(EXIT_ON_ERROR) \
171 $(RUN_TEST_PROGRAM) \
172 $(topsrcdir)/tools/test-harness/xpcshell-simple/test_one.sh \
173 $(DIST)/bin/xpcshell \
174 $(FWDSLASH_TOPSRCDIR) \
175 $(NATIVE_TOPSRCDIR) \
176 $(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir \
177 $(SOLO_FILE) 1;
179 # Test execution
180 check-one::
181 @$(EXIT_ON_ERROR) \
182 $(RUN_TEST_PROGRAM) \
183 $(topsrcdir)/tools/test-harness/xpcshell-simple/test_one.sh \
184 $(DIST)/bin/xpcshell \
185 $(FWDSLASH_TOPSRCDIR) \
186 $(NATIVE_TOPSRCDIR) \
187 $(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir \
188 $(SOLO_FILE) 0;
190 endif # XPCSHELL_TESTS
192 ifdef CPP_UNIT_TESTS
194 # Compile the tests to $(DIST)/bin. Make lots of niceties available by default
195 # through TestHarness.h, by modifying the list of includes and the libs against
196 # which stuff links.
197 CPPSRCS += $(CPP_UNIT_TESTS)
198 SIMPLE_PROGRAMS += $(CPP_UNIT_TESTS:.cpp=$(BIN_SUFFIX))
199 REQUIRES += testing xpcom
200 LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS)
202 # ...and run them the usual way
203 check::
204 @$(EXIT_ON_ERROR) \
205 for f in $(subst .cpp,,$(CPP_UNIT_TESTS)); do \
206 XPCOM_DEBUG_BREAK=stack-and-abort $(RUN_TEST_PROGRAM) $(DIST)/bin/$$f; \
207 done
209 endif # CPP_UNIT_TESTS
211 endif # ENABLE_TESTS
215 # Library rules
217 # If BUILD_STATIC_LIBS or FORCE_STATIC_LIB is set, build a static library.
218 # Otherwise, build a shared library.
221 ifndef LIBRARY
222 ifdef LIBRARY_NAME
223 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
224 ifdef SHORT_LIBNAME
225 LIBRARY_NAME := $(SHORT_LIBNAME)
226 endif
227 endif
228 LIBRARY := $(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX)
229 endif
230 endif
232 ifndef HOST_LIBRARY
233 ifdef HOST_LIBRARY_NAME
234 HOST_LIBRARY := $(LIB_PREFIX)$(HOST_LIBRARY_NAME).$(LIB_SUFFIX)
235 endif
236 endif
238 ifdef LIBRARY
239 ifneq (_1,$(FORCE_SHARED_LIB)_$(BUILD_STATIC_LIBS))
240 ifdef MKSHLIB
242 ifdef LIB_IS_C_ONLY
243 MKSHLIB = $(MKCSHLIB)
244 endif
246 ifdef MAKE_FRAMEWORK
247 SHARED_LIBRARY := $(LIBRARY_NAME)
248 else
249 SHARED_LIBRARY := $(DLL_PREFIX)$(LIBRARY_NAME)$(DLL_SUFFIX)
250 endif
252 ifeq ($(OS_ARCH),OS2)
253 DEF_FILE := $(SHARED_LIBRARY:.dll=.def)
254 endif
256 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
257 IMPORT_LIBRARY := $(LIB_PREFIX)$(LIBRARY_NAME).$(IMPORT_LIB_SUFFIX)
258 endif
260 ifdef MOZ_ENABLE_LIBXUL
261 EMBED_MANIFEST_AT=2
262 endif
264 endif # MKSHLIB
265 endif # FORCE_SHARED_LIB && !BUILD_STATIC_LIBS
266 endif # LIBRARY
268 ifeq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB))
269 LIBRARY := $(NULL)
270 endif
272 ifeq (_1,$(FORCE_SHARED_LIB)_$(BUILD_STATIC_LIBS))
273 SHARED_LIBRARY := $(NULL)
274 DEF_FILE := $(NULL)
275 IMPORT_LIBRARY := $(NULL)
276 endif
278 ifdef FORCE_STATIC_LIB
279 ifndef FORCE_SHARED_LIB
280 SHARED_LIBRARY := $(NULL)
281 DEF_FILE := $(NULL)
282 IMPORT_LIBRARY := $(NULL)
283 endif
284 endif
286 ifdef FORCE_SHARED_LIB
287 ifndef FORCE_STATIC_LIB
288 LIBRARY := $(NULL)
289 endif
290 endif
292 ifdef JAVA_LIBRARY_NAME
293 JAVA_LIBRARY := $(JAVA_LIBRARY_NAME).jar
294 endif
296 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
297 ifndef GNU_CC
300 # Unless we're building SIMPLE_PROGRAMS, all C++ files share a PDB file per
301 # directory. For parallel builds, this PDB file is shared and locked by
302 # MSPDBSRV.EXE, starting with MSVC8 SP1. If you're using MSVC 7.1 or MSVC8
303 # without SP1, don't do parallel builds.
305 # The final PDB for libraries and programs is created by the linker and uses
306 # a different name from the single PDB file created by the compiler. See
307 # bug 462740.
310 ifdef SIMPLE_PROGRAMS
311 COMPILE_PDBFILE = $(basename $(@F)).pdb
312 else
313 COMPILE_PDBFILE = generated.pdb
314 endif
316 LINK_PDBFILE = $(basename $(@F)).pdb
317 ifdef MOZ_DEBUG
318 CODFILE=$(basename $(@F)).cod
319 endif
321 ifdef MOZ_MAPINFO
322 ifdef LIBRARY_NAME
323 MAPFILE=$(LIBRARY_NAME).map
324 else
325 MAPFILE=$(basename $(@F)).map
326 endif # LIBRARY_NAME
327 endif # MOZ_MAPINFO
329 ifdef DEFFILE
330 OS_LDFLAGS += -DEF:$(DEFFILE)
331 EXTRA_DEPS += $(DEFFILE)
332 endif
334 ifdef MAPFILE
335 OS_LDFLAGS += -MAP:$(MAPFILE)
336 #CFLAGS += -Fm$(MAPFILE)
337 #CXXFLAGS += -Fm$(MAPFILE)
338 endif
340 #ifdef CODFILE
341 #CFLAGS += -Fa$(CODFILE) -FAsc
342 #CFLAGS += -Fa$(CODFILE) -FAsc
343 #endif
345 endif # !GNU_CC
347 ifdef ENABLE_CXX_EXCEPTIONS
348 ifdef GNU_CC
349 CXXFLAGS += -fexceptions
350 else
351 ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER)))
352 CXXFLAGS += -GX
353 else
354 CXXFLAGS += -EHsc
355 endif # _MSC_VER
356 endif # GNU_CC
357 endif # ENABLE_CXX_EXCEPTIONS
358 endif # WINNT
360 ifeq (,$(filter-out WINNT WINCE,$(HOST_OS_ARCH)))
361 HOST_PDBFILE=$(basename $(@F)).pdb
362 endif
364 ifndef TARGETS
365 TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
366 endif
368 ifndef OBJS
369 _OBJS = \
370 $(JRI_STUB_CFILES) \
371 $(addsuffix .$(OBJ_SUFFIX), $(JMC_GEN)) \
372 $(CSRCS:.c=.$(OBJ_SUFFIX)) \
373 $(patsubst %.cc,%.$(OBJ_SUFFIX),$(CPPSRCS:.cpp=.$(OBJ_SUFFIX))) \
374 $(CMSRCS:.m=.$(OBJ_SUFFIX)) \
375 $(CMMSRCS:.mm=.$(OBJ_SUFFIX)) \
376 $(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX))
377 OBJS = $(strip $(_OBJS))
378 endif
380 ifndef HOST_OBJS
381 _HOST_OBJS = \
382 $(addprefix host_,$(HOST_CSRCS:.c=.$(OBJ_SUFFIX))) \
383 $(addprefix host_,$(patsubst %.cc,%.$(OBJ_SUFFIX),$(HOST_CPPSRCS:.cpp=.$(OBJ_SUFFIX)))) \
384 $(addprefix host_,$(HOST_CMSRCS:.m=.$(OBJ_SUFFIX))) \
385 $(addprefix host_,$(HOST_CMMSRCS:.mm=.$(OBJ_SUFFIX)))
386 HOST_OBJS = $(strip $(_HOST_OBJS))
387 endif
389 LIBOBJS := $(addprefix \", $(OBJS))
390 LIBOBJS := $(addsuffix \", $(LIBOBJS))
392 ifndef MOZ_AUTO_DEPS
393 ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
394 MDDEPFILES = $(addprefix $(MDDEPDIR)/,$(OBJS:.$(OBJ_SUFFIX)=.pp))
395 ifndef NO_GEN_XPT
396 MDDEPFILES += $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.xpt)) \
397 $(addprefix $(MDDEPDIR)/,$(SDK_XPIDLSRCS:.idl=.xpt))
398 endif
399 endif
400 endif
402 ALL_TRASH = \
403 $(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
404 $(filter-out $(ASFILES),$(OBJS:.$(OBJ_SUFFIX)=.s)) $(OBJS:.$(OBJ_SUFFIX)=.ii) \
405 $(OBJS:.$(OBJ_SUFFIX)=.i) \
406 $(HOST_PROGOBJS) $(HOST_OBJS) $(IMPORT_LIBRARY) $(DEF_FILE)\
407 $(EXE_DEF_FILE) so_locations _gen _stubs $(wildcard *.res) $(wildcard *.RES) \
408 $(wildcard *.pdb) $(CODFILE) $(MAPFILE) $(IMPORT_LIBRARY) \
409 $(SHARED_LIBRARY:$(DLL_SUFFIX)=.exp) $(wildcard *.ilk) \
410 $(PROGRAM:$(BIN_SUFFIX)=.exp) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.exp) \
411 $(PROGRAM:$(BIN_SUFFIX)=.lib) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.lib) \
412 $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.$(OBJ_SUFFIX)) \
413 $(wildcard gts_tmp_*) $(LIBRARY:%.a=.%.timestamp)
414 ALL_TRASH_DIRS = \
415 $(GARBAGE_DIRS) /no-such-file
417 ifdef QTDIR
418 GARBAGE += $(MOCSRCS)
419 endif
421 ifdef SIMPLE_PROGRAMS
422 GARBAGE += $(SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX))
423 endif
425 ifdef HOST_SIMPLE_PROGRAMS
426 GARBAGE += $(HOST_SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX))
427 endif
430 # the Solaris WorkShop template repository cache. it occasionally can get
431 # out of sync, so targets like clobber should kill it.
433 ifeq ($(OS_ARCH),SunOS)
434 ifeq ($(GNU_CXX),)
435 GARBAGE_DIRS += SunWS_cache
436 endif
437 endif
439 ifeq ($(OS_ARCH),OpenVMS)
440 GARBAGE += $(wildcard *.*_defines)
441 ifdef SHARED_LIBRARY
442 VMS_SYMVEC_FILE = $(SHARED_LIBRARY:$(DLL_SUFFIX)=_symvec.opt)
443 ifdef MOZ_DEBUG
444 VMS_SYMVEC_FILE_MODULE = $(topsrcdir)/build/unix/vms/$(notdir $(SHARED_LIBRARY:$(DLL_SUFFIX)=_dbg_symvec.opt))
445 else
446 VMS_SYMVEC_FILE_MODULE = $(topsrcdir)/build/unix/vms/$(notdir $(SHARED_LIBRARY:$(DLL_SUFFIX)=_symvec.opt))
447 endif
448 VMS_SYMVEC_FILE_COMP = $(topsrcdir)/build/unix/vms/component_symvec.opt
449 GARBAGE += $(VMS_SYMVEC_FILE)
450 ifdef IS_COMPONENT
451 DSO_LDOPTS := $(filter-out -auto_symvec,$(DSO_LDOPTS)) $(VMS_SYMVEC_FILE)
452 endif
453 endif
454 endif
456 XPIDL_GEN_DIR = _xpidlgen
458 ifdef MOZ_UPDATE_XTERM
459 # Its good not to have a newline at the end of the titlebar string because it
460 # makes the make -s output easier to read. Echo -n does not work on all
461 # platforms, but we can trick sed into doing it.
462 UPDATE_TITLE = sed -e "s!Y!$@ in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$(dir)!" $(MOZILLA_DIR)/config/xterm.str;
463 UPDATE_TITLE_export = sed -e "s!Y!export in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$*!" $(MOZILLA_DIR)/config/xterm.str;
464 UPDATE_TITLE_libs = sed -e "s!Y!libs in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$*!" $(MOZILLA_DIR)/config/xterm.str;
465 UPDATE_TITLE_tools = sed -e "s!Y!tools in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$*!" $(MOZILLA_DIR)/config/xterm.str;
466 endif
468 LOOP_OVER_DIRS = \
469 @$(EXIT_ON_ERROR) \
470 $(foreach dir,$(DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true
472 # we only use this for the makefiles target and other stuff that doesn't matter
473 LOOP_OVER_PARALLEL_DIRS = \
474 @$(EXIT_ON_ERROR) \
475 $(foreach dir,$(PARALLEL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true
477 LOOP_OVER_STATIC_DIRS = \
478 @$(EXIT_ON_ERROR) \
479 $(foreach dir,$(STATIC_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true
481 LOOP_OVER_TOOL_DIRS = \
482 @$(EXIT_ON_ERROR) \
483 $(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true
485 ifdef PARALLEL_DIRS
486 # create a bunch of fake targets for order-only processing
487 PARALLEL_DIRS_export = $(addsuffix _export,$(PARALLEL_DIRS))
488 PARALLEL_DIRS_libs = $(addsuffix _libs,$(PARALLEL_DIRS))
489 PARALLEL_DIRS_tools = $(addsuffix _tools,$(PARALLEL_DIRS))
491 .PHONY: $(PARALLEL_DIRS_export) $(PARALLEL_DIRS_libs) $(PARALLEL_DIRS_tools)
492 endif
495 # Now we can differentiate between objects used to build a library, and
496 # objects used to build an executable in the same directory.
498 ifndef PROGOBJS
499 PROGOBJS = $(OBJS)
500 endif
502 ifndef HOST_PROGOBJS
503 HOST_PROGOBJS = $(HOST_OBJS)
504 endif
506 # MAKE_DIRS: List of directories to build while looping over directories.
507 # A Makefile that needs $(MDDEPDIR) created but doesn't set any of these
508 # variables we know to check can just set NEED_MDDEPDIR explicitly.
509 ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS)$(NEED_MDDEPDIR))
510 MAKE_DIRS += $(CURDIR)/$(MDDEPDIR)
511 GARBAGE_DIRS += $(MDDEPDIR)
512 endif
515 # Tags: emacs (etags), vi (ctags)
516 # TAG_PROGRAM := ctags -L -
518 TAG_PROGRAM = xargs etags -a
521 # Turn on C++ linking if we have any .cpp or .mm files
522 # (moved this from config.mk so that config.mk can be included
523 # before the CPPSRCS are defined)
525 ifneq ($(CPPSRCS)$(CMMSRCS),)
526 CPP_PROG_LINK = 1
527 endif
530 # Make sure to wrap static libs inside linker specific flags to turn on & off
531 # inclusion of all symbols inside the static libs
533 ifndef NO_LD_ARCHIVE_FLAGS
534 ifdef SHARED_LIBRARY_LIBS
535 EXTRA_DSO_LDOPTS := $(MKSHLIB_FORCE_ALL) $(SHARED_LIBRARY_LIBS) $(MKSHLIB_UNFORCE_ALL) $(EXTRA_DSO_LDOPTS)
536 endif
537 endif
540 # This will strip out symbols that the component should not be
541 # exporting from the .dynsym section.
543 ifdef IS_COMPONENT
544 EXTRA_DSO_LDOPTS += $(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
545 endif # IS_COMPONENT
548 # Enforce the requirement that MODULE_NAME must be set
549 # for components in static builds
551 ifdef IS_COMPONENT
552 ifdef EXPORT_LIBRARY
553 ifndef FORCE_SHARED_LIB
554 ifndef MODULE_NAME
555 $(error MODULE_NAME is required for components which may be used in static builds)
556 endif
557 endif
558 endif
559 endif
562 # MacOS X specific stuff
565 ifeq ($(OS_ARCH),Darwin)
566 ifdef SHARED_LIBRARY
567 ifdef IS_COMPONENT
568 EXTRA_DSO_LDOPTS += -bundle
569 else
570 EXTRA_DSO_LDOPTS += -dynamiclib -install_name @executable_path/$(SHARED_LIBRARY) -compatibility_version 1 -current_version 1 -single_module
571 endif
572 endif
573 endif
576 # On NetBSD a.out systems, use -Bsymbolic. This fixes what would otherwise be
577 # fatal symbol name clashes between components.
579 ifeq ($(OS_ARCH),NetBSD)
580 ifeq ($(DLL_SUFFIX),.so.1.0)
581 ifdef IS_COMPONENT
582 EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
583 endif
584 endif
585 endif
587 ifeq ($(OS_ARCH),FreeBSD)
588 ifdef IS_COMPONENT
589 EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
590 endif
591 endif
593 ifeq ($(OS_ARCH),NetBSD)
594 ifneq (,$(filter arc cobalt hpcmips mipsco newsmips pmax sgimips,$(OS_TEST)))
595 ifeq ($(MODULE),layout)
596 OS_CFLAGS += -Wa,-xgot
597 OS_CXXFLAGS += -Wa,-xgot
598 endif
599 endif
600 endif
602 ifeq ($(OS_ARCH),Linux)
603 ifneq (,$(filter mips mipsel,$(OS_TEST)))
604 ifeq ($(MODULE),layout)
605 OS_CFLAGS += -Wa,-xgot
606 OS_CXXFLAGS += -Wa,-xgot
607 endif
608 endif
609 endif
612 # HP-UXBeOS specific section: for COMPONENTS only, add -Bsymbolic flag
613 # which uses internal symbols first
615 ifeq ($(OS_ARCH),HP-UX)
616 ifdef IS_COMPONENT
617 ifeq ($(GNU_CC)$(GNU_CXX),)
618 EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
619 ifneq ($(HAS_EXTRAEXPORTS),1)
620 MKSHLIB += -Wl,+eNSGetModule -Wl,+eerrno
621 MKCSHLIB += +eNSGetModule +eerrno
622 ifneq ($(OS_TEST),ia64)
623 MKSHLIB += -Wl,+e_shlInit
624 MKCSHLIB += +e_shlInit
625 endif # !ia64
626 endif # !HAS_EXTRAEXPORTS
627 endif # non-gnu compilers
628 endif # IS_COMPONENT
629 endif # HP-UX
631 ifeq ($(OS_ARCH),AIX)
632 ifdef IS_COMPONENT
633 ifneq ($(HAS_EXTRAEXPORTS),1)
634 MKSHLIB += -bE:$(MOZILLA_DIR)/build/unix/aix.exp -bnoexpall
635 MKCSHLIB += -bE:$(MOZILLA_DIR)/build/unix/aix.exp -bnoexpall
636 endif # HAS_EXTRAEXPORTS
637 endif # IS_COMPONENT
638 endif # AIX
641 # OSF1: add -B symbolic flag for components
643 ifeq ($(OS_ARCH),OSF1)
644 ifdef IS_COMPONENT
645 ifeq ($(GNU_CC)$(GNU_CXX),)
646 EXTRA_DSO_LDOPTS += -B symbolic
647 endif
648 endif
649 endif
652 # Linux: add -Bsymbolic flag for components
654 ifeq ($(OS_ARCH),Linux)
655 ifdef IS_COMPONENT
656 EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
657 endif
658 endif
661 # MINGW32
663 ifeq ($(OS_ARCH),WINNT)
664 ifdef GNU_CC
665 ifndef IS_COMPONENT
666 DSO_LDOPTS += -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
667 endif
668 endif
669 endif
671 ifeq ($(USE_TVFS),1)
672 IFLAGS1 = -rb
673 IFLAGS2 = -rb
674 else
675 IFLAGS1 = -m 644
676 IFLAGS2 = -m 755
677 endif
679 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
680 OUTOPTION = -Fo# eol
681 else
682 OUTOPTION = -o # eol
683 endif # WINNT && !GNU_CC
684 ifneq (,$(filter WINCE,$(OS_ARCH)))
685 OUTOPTION = -Fo# eol
686 endif
688 ifeq ($(OS_TARGET), WINCE)
689 OUTOPTION = -Fo# eol
690 HOST_OUTOPTION = -Fo# eol
691 else
693 ifeq (,$(CROSS_COMPILE))
694 HOST_OUTOPTION = $(OUTOPTION)
695 else
696 HOST_OUTOPTION = -o # eol
697 endif
699 endif
700 ################################################################################
702 # SUBMAKEFILES: List of Makefiles for next level down.
703 # This is used to update or create the Makefiles before invoking them.
704 SUBMAKEFILES += $(addsuffix /Makefile, $(DIRS) $(TOOL_DIRS) $(PARALLEL_DIRS))
706 # The root makefile doesn't want to do a plain export/libs, because
707 # of the tiers and because of libxul. Suppress the default rules in favor
708 # of something else. Makefiles which use this var *must* provide a sensible
709 # default rule before including rules.mk
710 ifndef SUPPRESS_DEFAULT_RULES
711 ifdef TIERS
713 DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_dirs))
714 STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs))
716 default all alldep::
717 $(EXIT_ON_ERROR) \
718 $(foreach tier,$(TIERS),$(MAKE) tier_$(tier); ) true
720 else
722 default all::
723 @$(EXIT_ON_ERROR) \
724 $(foreach dir,$(STATIC_DIRS),$(MAKE) -C $(dir); ) true
725 $(MAKE) export
726 $(MAKE) libs
727 $(MAKE) tools
729 # Do depend as well
730 alldep::
731 $(MAKE) export
732 $(MAKE) depend
733 $(MAKE) libs
734 $(MAKE) tools
736 endif # TIERS
737 endif # SUPPRESS_DEFAULT_RULES
739 ifeq ($(filter s,$(MAKEFLAGS)),)
740 ECHO := echo
741 QUIET :=
742 else
743 ECHO := true
744 QUIET := -q
745 endif
747 MAKE_TIER_SUBMAKEFILES = +$(if $(tier_$*_dirs),$(MAKE) $(addsuffix /Makefile,$(tier_$*_dirs)))
749 export_tier_%:
750 @$(ECHO) "$@"
751 @$(MAKE_TIER_SUBMAKEFILES)
752 @$(EXIT_ON_ERROR) \
753 $(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) export; ) true
755 libs_tier_%:
756 @$(ECHO) "$@"
757 @$(MAKE_TIER_SUBMAKEFILES)
758 @$(EXIT_ON_ERROR) \
759 $(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) libs; ) true
761 tools_tier_%:
762 @$(ECHO) "$@"
763 @$(MAKE_TIER_SUBMAKEFILES)
764 @$(EXIT_ON_ERROR) \
765 $(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) tools; ) true
767 $(foreach tier,$(TIERS),tier_$(tier))::
768 @$(ECHO) "$@: $($@_staticdirs) $($@_dirs)"
769 @$(EXIT_ON_ERROR) \
770 $(foreach dir,$($@_staticdirs),$(MAKE) -C $(dir); ) true
771 $(MAKE) export_$@
772 $(MAKE) libs_$@
774 # Do everything from scratch
775 everything::
776 $(MAKE) clean
777 $(MAKE) alldep
779 # Add dummy depend target for tinderboxes
780 depend::
782 ifdef ALL_PLATFORMS
783 all_platforms:: $(NFSPWD)
784 @d=`$(NFSPWD)`; \
785 if test ! -d LOGS; then rm -rf LOGS; mkdir LOGS; else true; fi; \
786 for h in $(PLATFORM_HOSTS); do \
787 echo "On $$h: $(MAKE) $(ALL_PLATFORMS) >& LOGS/$$h.log";\
788 rsh $$h -n "(chdir $$d; \
789 $(MAKE) $(ALL_PLATFORMS) >& LOGS/$$h.log; \
790 echo DONE) &" 2>&1 > LOGS/$$h.pid & \
791 sleep 1; \
792 done
794 $(NFSPWD):
795 cd $(@D); $(MAKE) $(@F)
796 endif
798 # Target to only regenerate makefiles
799 makefiles: $(SUBMAKEFILES)
800 ifneq (,$(DIRS)$(TOOL_DIRS)$(PARALLEL_DIRS))
801 +$(LOOP_OVER_PARALLEL_DIRS)
802 +$(LOOP_OVER_DIRS)
803 +$(LOOP_OVER_TOOL_DIRS)
804 endif
806 ifdef PARALLEL_DIRS
807 export:: $(PARALLEL_DIRS_export)
809 $(PARALLEL_DIRS_export): %_export: %/Makefile
810 +@$(UPDATE_TITLE_export) $(MAKE) -C $* export
811 endif
813 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))
814 +$(LOOP_OVER_DIRS)
815 +$(LOOP_OVER_TOOL_DIRS)
817 ifdef PARALLEL_DIRS
818 tools:: $(PARALLEL_DIRS_tools)
820 $(PARALLEL_DIRS_tools): %_tools: %/Makefile
821 +@$(UPDATE_TITLE_tools) $(MAKE) -C $* tools
822 endif
824 tools:: $(SUBMAKEFILES) $(MAKE_DIRS)
825 +$(LOOP_OVER_DIRS)
826 ifdef TOOL_DIRS
827 @$(EXIT_ON_ERROR) \
828 $(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) libs; ) true
829 endif
832 # Rule to create list of libraries for final link
834 export::
835 ifdef LIBRARY_NAME
836 ifdef EXPORT_LIBRARY
837 ifdef IS_COMPONENT
838 ifdef BUILD_STATIC_LIBS
839 @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(LIBRARY_NAME)
840 ifdef MODULE_NAME
841 @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMP_NAMES) $(MODULE_NAME)
842 endif
843 endif
844 else
845 $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(LIBRARY_NAME)
846 endif # IS_COMPONENT
847 endif # EXPORT_LIBRARY
848 endif # LIBRARY_NAME
850 # Create dependencies on static (and shared EXTRA_DSO_LIBS) libraries
851 LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(LIBS))
852 HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(HOST_LIBS))
853 DSO_LDOPTS_DEPS = $(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS))
855 # Dependancies which, if modified, should cause everything to rebuild
856 GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(DEPTH)/config/config.mk
858 ##############################################
859 ifdef PARALLEL_DIRS
860 libs:: $(PARALLEL_DIRS_libs)
862 $(PARALLEL_DIRS_libs): %_libs: %/Makefile
863 +@$(UPDATE_TITLE_libs) $(MAKE) -C $* libs
864 endif
866 libs:: $(SUBMAKEFILES) $(MAKE_DIRS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(HOST_PROGRAM) $(PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
867 ifndef NO_DIST_INSTALL
868 ifdef LIBRARY
869 ifdef EXPORT_LIBRARY # Stage libs that will be linked into a static build
870 ifdef IS_COMPONENT
871 $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib/components
872 else
873 $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib
874 endif
875 endif # EXPORT_LIBRARY
876 ifdef DIST_INSTALL
877 ifdef IS_COMPONENT
878 $(error Shipping static component libs makes no sense.)
879 else
880 $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DIST)/lib
881 endif
882 endif # DIST_INSTALL
883 endif # LIBRARY
884 ifdef SHARED_LIBRARY
885 ifdef IS_COMPONENT
886 $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
887 $(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
888 ifdef BEOS_ADDON_WORKAROUND
889 ( cd $(FINAL_TARGET)/components && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
890 endif
891 else # ! IS_COMPONENT
892 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
893 $(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(DIST)/lib
894 else
895 $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DIST)/lib
896 endif
897 $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)
898 ifdef BEOS_ADDON_WORKAROUND
899 ( cd $(FINAL_TARGET) && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
900 endif
901 endif # IS_COMPONENT
902 endif # SHARED_LIBRARY
903 ifdef PROGRAM
904 $(INSTALL) $(IFLAGS2) $(PROGRAM) $(FINAL_TARGET)
905 endif
906 ifdef SIMPLE_PROGRAMS
907 $(INSTALL) $(IFLAGS2) $(SIMPLE_PROGRAMS) $(FINAL_TARGET)
908 endif
909 ifdef HOST_PROGRAM
910 $(INSTALL) $(IFLAGS2) $(HOST_PROGRAM) $(DIST)/host/bin
911 endif
912 ifdef HOST_SIMPLE_PROGRAMS
913 $(INSTALL) $(IFLAGS2) $(HOST_SIMPLE_PROGRAMS) $(DIST)/host/bin
914 endif
915 ifdef HOST_LIBRARY
916 $(INSTALL) $(IFLAGS1) $(HOST_LIBRARY) $(DIST)/host/lib
917 endif
918 ifdef JAVA_LIBRARY
919 ifdef IS_COMPONENT
920 $(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)/components
921 else
922 $(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)
923 endif
924 endif # JAVA_LIBRARY
925 endif # !NO_DIST_INSTALL
926 +$(LOOP_OVER_DIRS)
928 ##############################################
930 ifndef NO_PROFILE_GUIDED_OPTIMIZE
931 ifneq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
932 ifeq ($(OS_ARCH)_$(GNU_CC)$(INTERNAL_TOOLS), WINNT_)
933 # Force re-linking when building with PGO, since
934 # the MSVC linker does all the work. We force re-link
935 # in both stages so you can do depend builds with PGO.
936 ifdef SHARED_LIBRARY
937 $(SHARED_LIBRARY): FORCE
938 BINARY_BASENAME = $(SHARED_LIBRARY:$(DLL_SUFFIX)=)
939 endif
940 ifdef PROGRAM
941 $(PROGRAM): FORCE
942 BINARY_BASENAME = $(PROGRAM:$(BIN_SUFFIX)=)
943 endif
945 ifdef MOZ_PROFILE_USE
946 # In the second pass, we need to merge the pgc files into the pgd file.
947 # The compiler would do this for us automatically if they were in the right
948 # place, but they're in dist/bin.
949 ifdef BINARY_BASENAME
950 export::
951 $(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
952 $(BINARY_BASENAME) $(DIST)/bin
953 endif
954 endif # MOZ_PROFILE_USE
955 endif # WINNT_
956 endif # MOZ_PROFILE_GENERATE || MOZ_PROFILE_USE
957 endif # NO_PROFILE_GUIDED_OPTIMIZE
959 ##############################################
961 checkout:
962 $(MAKE) -C $(topsrcdir) -f client.mk checkout
964 run_viewer: $(FINAL_TARGET)/viewer
965 cd $(FINAL_TARGET); \
966 MOZILLA_FIVE_HOME=`pwd` \
967 LD_LIBRARY_PATH=".:$(LIBS_PATH):$$LD_LIBRARY_PATH" \
968 viewer
970 clean clobber realclean clobber_all:: $(SUBMAKEFILES)
971 -rm -f $(ALL_TRASH)
972 -rm -rf $(ALL_TRASH_DIRS)
973 +-$(LOOP_OVER_PARALLEL_DIRS)
974 +-$(LOOP_OVER_DIRS)
975 +-$(LOOP_OVER_STATIC_DIRS)
976 +-$(LOOP_OVER_TOOL_DIRS)
978 distclean:: $(SUBMAKEFILES)
979 +-$(LOOP_OVER_PARALLEL_DIRS)
980 +-$(LOOP_OVER_DIRS)
981 +-$(LOOP_OVER_STATIC_DIRS)
982 +-$(LOOP_OVER_TOOL_DIRS)
983 -rm -rf $(ALL_TRASH_DIRS)
984 -rm -f $(ALL_TRASH) \
985 Makefile .HSancillary \
986 $(wildcard *.$(OBJ_SUFFIX)) $(wildcard *.ho) $(wildcard host_*.o*) \
987 $(wildcard *.$(LIB_SUFFIX)) $(wildcard *$(DLL_SUFFIX)) \
988 $(wildcard *.$(IMPORT_LIB_SUFFIX))
989 ifeq ($(OS_ARCH),OS2)
990 -rm -f $(PROGRAM:.exe=.map)
991 endif
993 alltags:
994 rm -f TAGS
995 find $(topsrcdir) -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' -o -name '*.idl' \) -print | $(TAG_PROGRAM)
998 # PROGRAM = Foo
999 # creates OBJS, links with LIBS to create Foo
1001 $(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) $(EXE_DEF_FILE) $(RESFILE) $(GLOBAL_DEPS)
1002 ifeq (WINCE,$(OS_ARCH))
1003 $(LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1004 else
1005 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
1006 $(LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1007 ifdef MSMANIFEST_TOOL
1008 @if test -f $@.manifest; then \
1009 if test -f "$(srcdir)/$@.manifest"; then \
1010 mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
1011 else \
1012 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
1013 fi; \
1014 rm -f $@.manifest; \
1016 endif # MSVC with manifest tool
1017 else
1018 ifeq ($(CPP_PROG_LINK),1)
1019 $(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)
1020 else # ! CPP_PROG_LINK
1021 $(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
1022 endif # CPP_PROG_LINK
1023 endif # WINNT && !GNU_CC
1024 endif # WINCE
1026 ifdef ENABLE_STRIP
1027 $(STRIP) $@
1028 endif
1029 ifdef MOZ_POST_PROGRAM_COMMAND
1030 $(MOZ_POST_PROGRAM_COMMAND) $@
1031 endif
1032 ifeq ($(OS_ARCH),BeOS)
1033 ifdef BEOS_PROGRAM_RESOURCE
1034 xres -o $@ $(BEOS_PROGRAM_RESOURCE)
1035 mimeset $@
1036 endif
1037 endif # BeOS
1039 $(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
1040 ifeq (WINCE,$(OS_ARCH))
1041 $(HOST_LD) -NOLOGO -OUT:$@ $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1042 else
1043 ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
1044 $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1045 ifdef MSMANIFEST_TOOL
1046 @if test -f $@.manifest; then \
1047 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
1048 rm -f $@.manifest; \
1050 endif # MSVC with manifest tool
1051 else
1052 ifeq ($(CPP_PROG_LINK),1)
1053 $(HOST_CXX) -o $@ $(HOST_CXXFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1054 else
1055 $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1056 endif # CPP_PROG_LINK
1057 endif
1058 endif
1061 # This is an attempt to support generation of multiple binaries
1062 # in one directory, it assumes everything to compile Foo is in
1063 # Foo.o (from either Foo.c or Foo.cpp).
1065 # SIMPLE_PROGRAMS = Foo Bar
1066 # creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
1068 $(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
1069 ifeq (WINCE,$(OS_ARCH))
1070 $(LD) -nologo -entry:main -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1071 else
1072 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
1073 $(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1074 ifdef MSMANIFEST_TOOL
1075 @if test -f $@.manifest; then \
1076 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
1077 rm -f $@.manifest; \
1079 endif # MSVC with manifest tool
1080 else
1081 ifeq ($(CPP_PROG_LINK),1)
1082 $(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)
1083 else
1084 $(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)
1085 endif # CPP_PROG_LINK
1086 endif # WINNT && !GNU_CC
1087 endif # WINCE
1089 ifdef ENABLE_STRIP
1090 $(STRIP) $@
1091 endif
1092 ifdef MOZ_POST_PROGRAM_COMMAND
1093 $(MOZ_POST_PROGRAM_COMMAND) $@
1094 endif
1096 $(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(OBJ_SUFFIX) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
1097 ifeq (WINCE,$(OS_ARCH))
1098 $(HOST_LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1099 else
1100 ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
1101 $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1102 else
1103 ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX))
1104 $(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXXFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1105 else
1106 $(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_CFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1107 endif
1108 endif
1109 endif
1112 # Purify target. Solaris/sparc only to start.
1113 # Purify does not recognize "egcs" or "c++" so we go with
1114 # "gcc" and "g++" for now.
1116 pure: $(PROGRAM)
1117 ifeq ($(CPP_PROG_LINK),1)
1118 $(PURIFY) $(CCC) -o $^.pure $(CXXFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1119 else
1120 $(PURIFY) $(CC) -o $^.pure $(CFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1121 endif
1122 ifndef NO_DIST_INSTALL
1123 $(INSTALL) $(IFLAGS2) $^.pure $(FINAL_TARGET)
1124 endif
1126 quantify: $(PROGRAM)
1127 ifeq ($(CPP_PROG_LINK),1)
1128 $(QUANTIFY) $(CCC) -o $^.quantify $(CXXFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1129 else
1130 $(QUANTIFY) $(CC) -o $^.quantify $(CFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1131 endif
1132 ifndef NO_DIST_INSTALL
1133 $(INSTALL) $(IFLAGS2) $^.quantify $(FINAL_TARGET)
1134 endif
1137 # This allows us to create static versions of the shared libraries
1138 # that are built using other static libraries. Confused...?
1140 ifdef SHARED_LIBRARY_LIBS
1141 ifeq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
1142 ifneq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB))
1143 LOBJS += $(SHARED_LIBRARY_LIBS)
1144 endif
1145 else
1146 ifneq (,$(filter OSF1 BSD_OS FreeBSD NetBSD OpenBSD SunOS Darwin,$(OS_ARCH)))
1147 CLEANUP1 := | egrep -v '(________64ELEL_|__.SYMDEF)'
1148 CLEANUP2 := rm -f ________64ELEL_ __.SYMDEF
1149 else
1150 CLEANUP2 := true
1151 endif
1152 SUB_LOBJS = $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
1153 endif
1154 endif
1155 ifdef MOZILLA_PROBE_LIBS
1156 PROBE_LOBJS = $(shell for lib in $(MOZILLA_PROBE_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
1157 endif
1158 ifdef DTRACE_PROBE_OBJ
1159 EXTRA_DEPS += $(DTRACE_PROBE_OBJ)
1160 endif
1162 $(LIBRARY): $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
1163 rm -f $@
1164 ifneq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
1165 ifdef SHARED_LIBRARY_LIBS
1166 @rm -f $(SUB_LOBJS)
1167 @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1168 endif
1169 endif
1170 $(AR) $(AR_FLAGS) $(OBJS) $(LOBJS) $(SUB_LOBJS)
1171 $(RANLIB) $@
1172 @rm -f foodummyfilefoo $(SUB_LOBJS)
1174 ifeq (,$(filter-out WINNT WINCE, $(OS_ARCH)))
1175 $(IMPORT_LIBRARY): $(SHARED_LIBRARY)
1176 endif
1178 ifeq ($(OS_ARCH),OS2)
1179 $(DEF_FILE): $(OBJS) $(SHARED_LIBRARY_LIBS)
1180 rm -f $@
1181 echo LIBRARY $(LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@
1182 echo PROTMODE >> $@
1183 echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@
1184 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
1185 echo EXPORTS >> $@
1186 ifeq ($(IS_COMPONENT),1)
1187 ifeq ($(HAS_EXTRAEXPORTS),1)
1188 ifndef MOZ_OS2_USE_DECLSPEC
1189 $(FILTER) $(OBJS) $(SHARED_LIBRARY_LIBS) >> $@
1190 endif
1191 else
1192 echo _NSGetModule >> $@
1193 endif
1194 else
1195 ifndef MOZ_OS2_USE_DECLSPEC
1196 $(FILTER) $(OBJS) $(SHARED_LIBRARY_LIBS) >> $@
1197 endif
1198 endif
1199 $(ADD_TO_DEF_FILE)
1201 ifdef MOZ_OS2_USE_DECLSPEC
1202 $(IMPORT_LIBRARY): $(SHARED_LIBRARY)
1203 else
1204 $(IMPORT_LIBRARY): $(DEF_FILE)
1205 endif
1206 rm -f $@
1207 $(IMPLIB) $@ $^
1208 $(RANLIB) $@
1209 endif # OS/2
1211 $(HOST_LIBRARY): $(HOST_OBJS) Makefile
1212 rm -f $@
1213 $(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
1214 $(HOST_RANLIB) $@
1216 ifdef NO_LD_ARCHIVE_FLAGS
1217 SUB_SHLOBJS = $(SUB_LOBJS)
1218 endif
1220 ifdef HAVE_DTRACE
1221 ifndef XP_MACOSX
1222 ifdef DTRACE_PROBE_OBJ
1223 ifndef DTRACE_LIB_DEPENDENT
1224 $(DTRACE_PROBE_OBJ): $(OBJS)
1225 dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(OBJS)
1226 endif
1227 endif
1228 endif
1229 endif
1231 # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
1232 # so instead of deleting .o files after repacking them into a dylib, we make
1233 # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
1234 # so no need to conditionalize on OS version or debugging format.
1236 $(SHARED_LIBRARY): $(OBJS) $(LOBJS) $(DEF_FILE) $(RESFILE) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(DSO_LDOPTS_DEPS) $(GLOBAL_DEPS)
1237 ifndef INCREMENTAL_LINKER
1238 rm -f $@
1239 endif
1240 ifeq ($(OS_ARCH),OpenVMS)
1241 @if test ! -f $(VMS_SYMVEC_FILE); then \
1242 if test -f $(VMS_SYMVEC_FILE_MODULE); then \
1243 echo Creating specific component options file $(VMS_SYMVEC_FILE); \
1244 cp $(VMS_SYMVEC_FILE_MODULE) $(VMS_SYMVEC_FILE); \
1245 fi; \
1247 ifdef IS_COMPONENT
1248 @if test ! -f $(VMS_SYMVEC_FILE); then \
1249 echo Creating generic component options file $(VMS_SYMVEC_FILE); \
1250 cp $(VMS_SYMVEC_FILE_COMP) $(VMS_SYMVEC_FILE); \
1252 endif
1253 endif # OpenVMS
1254 ifdef NO_LD_ARCHIVE_FLAGS
1255 ifdef SHARED_LIBRARY_LIBS
1256 @rm -f $(SUB_SHLOBJS)
1257 @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1258 ifeq ($(OS_ARCH),Darwin)
1259 @echo Making symlinks to the original object files in the archive libraries $(SHARED_LIBRARY_LIBS)
1260 @for lib in $(SHARED_LIBRARY_LIBS); do \
1261 libdir=`echo $$lib|sed -e 's,/[^/]*\.a,,'`; \
1262 ofiles=`$(AR_LIST) $${lib}`; \
1263 for ofile in $$ofiles; do \
1264 if [ -f $$libdir/$$ofile ]; then \
1265 rm -f $$ofile; \
1266 ln -s $$libdir/$$ofile $$ofile; \
1267 fi; \
1268 done; \
1269 done
1270 endif
1271 endif # SHARED_LIBRARY_LIBS
1272 endif # NO_LD_ARCHIVE_FLAGS
1273 ifdef DTRACE_LIB_DEPENDENT
1274 @rm -f $(PROBE_LOBJS)
1275 @for lib in $(MOZILLA_PROBE_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1276 ifndef XP_MACOSX
1277 dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS)
1278 endif
1279 @for lib in $(MOZILLA_PROBE_LIBS); do \
1280 ofiles=`$(AR_LIST) $${lib}`; \
1281 $(AR_DELETE) $${lib} $$ofiles; \
1282 done
1283 $(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)
1284 @rm -f $(PROBE_LOBJS)
1285 @rm -f $(DTRACE_PROBE_OBJ)
1286 @for lib in $(MOZILLA_PROBE_LIBS); do \
1287 if [ -L $${lib} ]; then rm -f `readlink $${lib}`; fi; \
1288 done
1289 @rm -f $(MOZILLA_PROBE_LIBS)
1291 else # ! DTRACE_LIB_DEPENDENT
1292 $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
1293 endif # DTRACE_LIB_DEPENDENT
1295 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
1296 ifdef MSMANIFEST_TOOL
1297 ifdef EMBED_MANIFEST_AT
1298 @if test -f $@.manifest; then \
1299 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
1300 rm -f $@.manifest; \
1302 endif # EMBED_MANIFEST_AT
1303 endif # MSVC with manifest tool
1304 endif # WINNT && !GCC
1305 ifeq ($(OS_ARCH),Darwin)
1306 else # non-Darwin
1307 @rm -f $(SUB_SHLOBJS)
1308 endif # Darwin
1309 @rm -f foodummyfilefoo $(DELETE_AFTER_LINK)
1310 chmod +x $@
1311 ifdef ENABLE_STRIP
1312 $(STRIP) $@
1313 endif
1314 ifdef MOZ_POST_DSO_LIB_COMMAND
1315 $(MOZ_POST_DSO_LIB_COMMAND) $@
1316 endif
1318 ifdef MOZ_AUTO_DEPS
1319 ifdef COMPILER_DEPEND
1320 ifeq (__SunOS,$(GNU_CC)_$(GNU_CXX)_$(OS_ARCH))
1321 _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
1323 define MAKE_DEPS_AUTO_CC
1324 if test -d $(@D); then \
1325 echo "Building deps for $< using Sun Studio cc"; \
1326 $(CC) $(COMPILE_CFLAGS) -xM $< >$(_MDDEPFILE) ; \
1328 endef
1329 define MAKE_DEPS_AUTO_CXX
1330 if test -d $(@D); then \
1331 echo "Building deps for $< using Sun Studio CC"; \
1332 $(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \
1334 endef
1335 endif # Sun Studio on Solaris
1336 else # COMPILER_DEPEND
1338 # Generate dependencies on the fly
1340 _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
1342 define MAKE_DEPS_AUTO
1343 if test -d $(@D); then \
1344 echo "Building deps for $<"; \
1345 $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f- $(DEFINES) $(ACDEFINES) $(INCLUDES) $< 2>/dev/null | sed -e "s|^[^ ]*/||" > $(_MDDEPFILE) ; \
1347 endef
1349 MAKE_DEPS_AUTO_CC = $(MAKE_DEPS_AUTO)
1350 MAKE_DEPS_AUTO_CXX = $(MAKE_DEPS_AUTO)
1352 endif # COMPILER_DEPEND
1354 endif # MOZ_AUTO_DEPS
1356 ifdef MOZ_MEMORY
1357 ifeq ($(OS_ARCH),SunOS)
1358 SOLARIS_JEMALLOC_LDFLAGS = $(call EXPAND_LIBNAME_PATH,jemalloc,$(DIST)/lib)
1359 endif
1360 endif
1362 # Rules for building native targets must come first because of the host_ prefix
1363 host_%.$(OBJ_SUFFIX): %.c $(GLOBAL_DEPS)
1364 $(REPORT_BUILD)
1365 $(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1367 host_%.$(OBJ_SUFFIX): %.cpp $(GLOBAL_DEPS)
1368 $(REPORT_BUILD)
1369 $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1371 host_%.$(OBJ_SUFFIX): %.cc $(GLOBAL_DEPS)
1372 $(REPORT_BUILD)
1373 $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1375 host_%.$(OBJ_SUFFIX): %.m $(GLOBAL_DEPS)
1376 $(REPORT_BUILD)
1377 $(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1379 host_%.$(OBJ_SUFFIX): %.mm $(GLOBAL_DEPS)
1380 $(REPORT_BUILD)
1381 $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1383 %: %.c $(GLOBAL_DEPS)
1384 $(REPORT_BUILD)
1385 @$(MAKE_DEPS_AUTO_CC)
1386 $(ELOG) $(CC) $(CFLAGS) $(LDFLAGS) $(OUTOPTION)$@ $(_VPATH_SRCS)
1388 %.$(OBJ_SUFFIX): %.c $(GLOBAL_DEPS)
1389 $(REPORT_BUILD)
1390 @$(MAKE_DEPS_AUTO_CC)
1391 $(ELOG) $(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $(_VPATH_SRCS)
1393 moc_%.cpp: %.h $(GLOBAL_DEPS)
1394 $(MOC) $< $(OUTOPTION)$@
1396 ifdef ASFILES
1397 # The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
1398 # a '-c' flag.
1399 %.$(OBJ_SUFFIX): %.$(ASM_SUFFIX) $(GLOBAL_DEPS)
1400 $(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) $(_VPATH_SRCS)
1401 endif
1403 %.$(OBJ_SUFFIX): %.S $(GLOBAL_DEPS)
1404 $(AS) -o $@ $(ASFLAGS) -c $<
1406 %: %.cpp $(GLOBAL_DEPS)
1407 @$(MAKE_DEPS_AUTO_CXX)
1408 $(CCC) $(OUTOPTION)$@ $(CXXFLAGS) $(_VPATH_SRCS) $(LDFLAGS)
1411 # Please keep the next two rules in sync.
1413 %.$(OBJ_SUFFIX): %.cc $(GLOBAL_DEPS)
1414 $(REPORT_BUILD)
1415 @$(MAKE_DEPS_AUTO_CXX)
1416 $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1418 %.$(OBJ_SUFFIX): %.cpp $(GLOBAL_DEPS)
1419 $(REPORT_BUILD)
1420 @$(MAKE_DEPS_AUTO_CXX)
1421 ifdef STRICT_CPLUSPLUS_SUFFIX
1422 echo "#line 1 \"$*.cpp\"" | cat - $*.cpp > t_$*.cc
1423 $(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) t_$*.cc
1424 rm -f t_$*.cc
1425 else
1426 $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1427 endif #STRICT_CPLUSPLUS_SUFFIX
1429 $(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.mm $(GLOBAL_DEPS)
1430 $(REPORT_BUILD)
1431 @$(MAKE_DEPS_AUTO_CXX)
1432 $(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(_VPATH_SRCS)
1434 $(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.m $(GLOBAL_DEPS)
1435 $(REPORT_BUILD)
1436 @$(MAKE_DEPS_AUTO_CC)
1437 $(ELOG) $(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $(_VPATH_SRCS)
1439 %.s: %.cpp
1440 $(CCC) -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1442 %.s: %.cc
1443 $(CCC) -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1445 %.s: %.c
1446 $(CC) -S $(COMPILE_CFLAGS) $(_VPATH_SRCS)
1448 %.i: %.cpp
1449 $(CCC) -C -E $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) > $*.i
1451 %.i: %.cc
1452 $(CCC) -C -E $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) > $*.i
1454 %.i: %.c
1455 $(CC) -C -E $(COMPILE_CFLAGS) $(_VPATH_SRCS) > $*.i
1457 %.i: %.mm
1458 $(CCC) -C -E $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(_VPATH_SRCS) > $*.i
1460 %.res: %.rc
1461 @echo Creating Resource file: $@
1462 ifeq ($(OS_ARCH),OS2)
1463 $(RC) $(RCFLAGS:-D%=-d %) -i $(subst /,\,$(srcdir)) -r $< $@
1464 else
1465 ifdef GNU_CC
1466 $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) $(OUTOPTION)$@ $(_VPATH_SRCS)
1467 else
1468 $(RC) $(RCFLAGS) -r $(DEFINES) $(INCLUDES) $(OUTOPTION)$@ $(_VPATH_SRCS)
1469 endif
1470 endif
1472 # need 3 separate lines for OS/2
1473 %: %.pl
1474 rm -f $@
1475 cp $< $@
1476 chmod +x $@
1478 %: %.sh
1479 rm -f $@; cp $< $@; chmod +x $@
1481 # Cancel these implicit rules
1483 %: %,v
1485 %: RCS/%,v
1487 %: s.%
1489 %: SCCS/s.%
1491 ###############################################################################
1492 # Java rules
1493 ###############################################################################
1494 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
1495 SEP := ;
1496 else
1497 SEP := :
1498 endif
1500 EMPTY :=
1501 SPACE := $(EMPTY) $(EMPTY)
1503 # Cygwin and MSYS have their own special path form, but javac expects the source
1504 # and class paths to be in the DOS form (i.e. e:/builds/...). This function
1505 # does the appropriate conversion on Windows, but is a noop on other systems.
1506 ifeq (,$(filter-out WINNT WINCE, $(HOST_OS_ARCH)))
1507 ifdef CYGWIN_WRAPPER
1508 normalizepath = $(foreach p,$(1),$(shell cygpath -m $(p)))
1509 else
1510 # assume MSYS
1511 # We use 'pwd -W' to get DOS form of the path. However, since the given path
1512 # could be a file or a non-existent path, we cannot call 'pwd -W' directly
1513 # on the path. Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
1514 # on it, then merge with the rest of the path.
1515 root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\1|")
1516 non-root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\2|")
1517 normalizepath = $(foreach p,$(1),$(if $(filter /%,$(1)),$(shell cd $(call root-path,$(1)) && pwd -W)$(call non-root-path,$(1)),$(1)))
1518 endif
1519 else
1520 normalizepath = $(1)
1521 endif
1523 _srcdir = $(call normalizepath,$(srcdir))
1524 ifdef JAVA_SOURCEPATH
1525 SP = $(subst $(SPACE),$(SEP),$(call normalizepath,$(strip $(JAVA_SOURCEPATH))))
1526 _JAVA_SOURCEPATH = ".$(SEP)$(_srcdir)$(SEP)$(SP)"
1527 else
1528 _JAVA_SOURCEPATH = ".$(SEP)$(_srcdir)"
1529 endif
1531 ifdef JAVA_CLASSPATH
1532 CP = $(subst $(SPACE),$(SEP),$(call normalizepath,$(strip $(JAVA_CLASSPATH))))
1533 _JAVA_CLASSPATH = ".$(SEP)$(CP)"
1534 else
1535 _JAVA_CLASSPATH = .
1536 endif
1538 _JAVA_DIR = _java
1539 $(_JAVA_DIR)::
1540 $(NSINSTALL) -D $@
1542 $(_JAVA_DIR)/%.class: %.java $(GLOBAL_DEPS) $(_JAVA_DIR)
1543 $(CYGWIN_WRAPPER) $(JAVAC) $(JAVAC_FLAGS) -classpath $(_JAVA_CLASSPATH) \
1544 -sourcepath $(_JAVA_SOURCEPATH) -d $(_JAVA_DIR) $(_VPATH_SRCS)
1546 $(JAVA_LIBRARY): $(addprefix $(_JAVA_DIR)/,$(JAVA_SRCS:.java=.class)) $(GLOBAL_DEPS)
1547 $(JAR) cf $@ -C $(_JAVA_DIR) .
1549 GARBAGE_DIRS += $(_JAVA_DIR)
1551 ###############################################################################
1552 # Update Makefiles
1553 ###############################################################################
1555 # In GNU make 3.80, makefiles must use the /cygdrive syntax, even if we're
1556 # processing them with AS perl. See bug 232003
1557 ifdef AS_PERL
1558 CYGWIN_TOPSRCDIR = -nowrap -p $(topsrcdir) -wrap
1559 endif
1561 # Note: Passing depth to make-makefile is optional.
1562 # It saves the script some work, though.
1563 Makefile: Makefile.in
1564 @$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR)
1566 ifdef SUBMAKEFILES
1567 # VPATH does not work on some machines in this case, so add $(srcdir)
1568 $(SUBMAKEFILES): % : $(srcdir)/%.in
1569 $(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR) $@
1570 endif
1572 ifdef AUTOUPDATE_CONFIGURE
1573 $(topsrcdir)/configure: $(topsrcdir)/configure.in
1574 (cd $(topsrcdir) && $(AUTOCONF)) && (cd $(DEPTH) && ./config.status --recheck)
1575 endif
1577 ###############################################################################
1578 # Bunch of things that extend the 'export' rule (in order):
1579 ###############################################################################
1581 ################################################################################
1582 # Copy each element of EXPORTS to $(PUBLIC)
1584 ifneq ($(EXPORTS)$(XPIDLSRCS)$(SDK_HEADERS)$(SDK_XPIDLSRCS),)
1585 $(SDK_PUBLIC) $(PUBLIC)::
1586 $(NSINSTALL) -D $@
1587 endif
1589 ifdef MOZ_JAVAXPCOM
1590 ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1591 $(JAVA_DIST_DIR)::
1592 $(NSINSTALL) -D $@
1593 endif
1594 endif
1596 ifneq ($(XPI_NAME),)
1597 $(FINAL_TARGET):
1598 $(NSINSTALL) -D $@
1600 export:: $(FINAL_TARGET)
1601 endif
1603 ifndef NO_DIST_INSTALL
1604 ifneq ($(EXPORTS),)
1605 export:: $(EXPORTS) $(PUBLIC)
1606 $(INSTALL) $(IFLAGS1) $^
1607 endif
1609 ifneq ($(SDK_HEADERS),)
1610 export:: $(SDK_HEADERS) $(SDK_PUBLIC)
1611 $(INSTALL) $(IFLAGS1) $^
1613 export:: $(SDK_HEADERS) $(PUBLIC)
1614 $(INSTALL) $(IFLAGS1) $^
1615 endif
1616 endif # NO_DIST_INSTALL
1618 ################################################################################
1619 # Copy each element of PREF_JS_EXPORTS
1621 ifdef GRE_MODULE
1622 PREF_DIR = greprefs
1623 else
1624 ifneq (,$(XPI_NAME)$(LIBXUL_SDK))
1625 PREF_DIR = defaults/preferences
1626 else
1627 PREF_DIR = defaults/pref
1628 endif
1629 endif
1631 ifneq ($(PREF_JS_EXPORTS),)
1632 # on win32, pref files need CRLF line endings... see bug 206029
1633 ifeq (WINNT,$(OS_ARCH))
1634 PREF_PPFLAGS = --line-endings=crlf
1635 endif
1637 ifndef NO_DIST_INSTALL
1638 $(FINAL_TARGET)/$(PREF_DIR):
1639 $(NSINSTALL) -D $@
1641 libs:: $(FINAL_TARGET)/$(PREF_DIR) $(PREF_JS_EXPORTS)
1642 $(EXIT_ON_ERROR) \
1643 for i in $(PREF_JS_EXPORTS); do \
1644 dest=$(FINAL_TARGET)/$(PREF_DIR)/`basename $$i`; \
1645 $(RM) -f $$dest; \
1646 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1647 done
1648 endif
1649 endif
1651 ################################################################################
1652 # Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
1654 ifneq ($(AUTOCFG_JS_EXPORTS),)
1655 $(FINAL_TARGET)/defaults/autoconfig::
1656 $(NSINSTALL) -D $@
1658 ifndef NO_DIST_INSTALL
1659 export:: $(AUTOCFG_JS_EXPORTS) $(FINAL_TARGET)/defaults/autoconfig
1660 $(INSTALL) $(IFLAGS1) $^
1661 endif
1663 endif
1664 ################################################################################
1665 # Export the elements of $(XPIDLSRCS) & $(SDK_XPIDLSRCS),
1666 # generating .h and .xpt files and moving them to the appropriate places.
1668 ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1670 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))
1672 ifndef XPIDL_MODULE
1673 XPIDL_MODULE = $(MODULE)
1674 endif
1676 ifeq ($(XPIDL_MODULE),) # we need $(XPIDL_MODULE) to make $(XPIDL_MODULE).xpt
1677 export:: FORCE
1678 @echo
1679 @echo "*** Error processing XPIDLSRCS:"
1680 @echo "Please define MODULE or XPIDL_MODULE when defining XPIDLSRCS,"
1681 @echo "so we have a module name to use when creating MODULE.xpt."
1682 @echo; sleep 2; false
1683 endif
1685 $(SDK_IDL_DIR) $(IDL_DIR)::
1686 $(NSINSTALL) -D $@
1688 # generate .h files from into $(XPIDL_GEN_DIR), then export to $(PUBLIC);
1689 # warn against overriding existing .h file.
1690 $(XPIDL_GEN_DIR)/.done:
1691 @if test ! -d $(XPIDL_GEN_DIR); then echo Creating $(XPIDL_GEN_DIR)/.done; rm -rf $(XPIDL_GEN_DIR); mkdir $(XPIDL_GEN_DIR); fi
1692 @touch $@
1694 # don't depend on $(XPIDL_GEN_DIR), because the modification date changes
1695 # with any addition to the directory, regenerating all .h files -> everything.
1697 $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
1698 $(REPORT_BUILD)
1699 $(ELOG) $(XPIDL_COMPILE) -m header -w $(XPIDL_FLAGS) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
1700 @if test -n "$(findstring $*.h, $(EXPORTS) $(SDK_HEADERS))"; \
1701 then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
1703 ifndef NO_GEN_XPT
1704 # generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link
1705 # into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
1706 $(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
1707 $(REPORT_BUILD)
1708 $(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$*.pp $(_VPATH_SRCS)
1710 # no need to link together if XPIDLSRCS contains only XPIDL_MODULE
1711 ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))
1712 $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS) $(SDK_XPIDLSRCS)) $(GLOBAL_DEPS) $(XPIDL_LINK)
1713 $(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS) $(SDK_XPIDLSRCS))
1714 endif # XPIDL_MODULE.xpt != XPIDLSRCS
1716 libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
1717 ifndef NO_DIST_INSTALL
1718 $(INSTALL) $(IFLAGS1) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(FINAL_TARGET)/components
1719 endif
1721 endif # NO_GEN_XPT
1723 GARBAGE_DIRS += $(XPIDL_GEN_DIR)
1725 endif # XPIDLSRCS || SDK_XPIDLSRCS
1727 ifneq ($(XPIDLSRCS),)
1728 # export .idl files to $(IDL_DIR)
1729 ifndef NO_DIST_INSTALL
1730 export:: $(XPIDLSRCS) $(IDL_DIR)
1731 $(INSTALL) $(IFLAGS1) $^
1733 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) $(PUBLIC)
1734 $(INSTALL) $(IFLAGS1) $^
1735 endif # NO_DIST_INSTALL
1737 endif # XPIDLSRCS
1742 # General rules for exporting idl files.
1744 # WORK-AROUND ONLY, for mozilla/tools/module-deps/bootstrap.pl build.
1745 # Bug to fix idl dependency problems w/o this extra build pass is
1746 # http://bugzilla.mozilla.org/show_bug.cgi?id=145777
1748 $(IDL_DIR)::
1749 $(NSINSTALL) -D $@
1751 export-idl:: $(SUBMAKEFILES) $(MAKE_DIRS)
1753 ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1754 ifndef NO_DIST_INSTALL
1755 export-idl:: $(XPIDLSRCS) $(SDK_XPIDLSRCS) $(IDL_DIR)
1756 $(INSTALL) $(IFLAGS1) $^
1757 endif
1758 endif
1759 +$(LOOP_OVER_PARALLEL_DIRS)
1760 +$(LOOP_OVER_DIRS)
1761 +$(LOOP_OVER_TOOL_DIRS)
1766 ifneq ($(SDK_XPIDLSRCS),)
1767 # export .idl files to $(IDL_DIR) & $(SDK_IDL_DIR)
1768 ifndef NO_DIST_INSTALL
1769 export:: $(SDK_XPIDLSRCS) $(IDL_DIR)
1770 $(INSTALL) $(IFLAGS1) $^
1772 export:: $(SDK_XPIDLSRCS) $(SDK_IDL_DIR)
1773 $(INSTALL) $(IFLAGS1) $^
1775 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(SDK_XPIDLSRCS)) $(PUBLIC)
1776 $(INSTALL) $(IFLAGS1) $^
1778 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(SDK_XPIDLSRCS)) $(SDK_PUBLIC)
1779 $(INSTALL) $(IFLAGS1) $^
1780 endif
1782 endif # SDK_XPIDLSRCS
1786 ifdef MOZ_JAVAXPCOM
1787 ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1789 JAVA_XPIDLSRCS = $(XPIDLSRCS) $(SDK_XPIDLSRCS)
1791 # A single IDL file can contain multiple interfaces, which result in multiple
1792 # Java interface files. So use hidden dependency files.
1793 JAVADEPFILES = $(addprefix $(JAVA_GEN_DIR)/.,$(JAVA_XPIDLSRCS:.idl=.java.pp))
1795 $(JAVA_GEN_DIR):
1796 $(NSINSTALL) -D $@
1797 GARBAGE_DIRS += $(JAVA_GEN_DIR)
1799 # generate .java files into _javagen/[package name dirs]
1800 _JAVA_GEN_DIR = $(JAVA_GEN_DIR)/$(JAVA_IFACES_PKG_NAME)
1801 $(_JAVA_GEN_DIR):
1802 $(NSINSTALL) -D $@
1804 $(JAVA_GEN_DIR)/.%.java.pp: %.idl $(XPIDL_COMPILE) $(_JAVA_GEN_DIR)
1805 $(REPORT_BUILD)
1806 $(ELOG) $(XPIDL_COMPILE) -m java -w -I$(srcdir) -I$(IDL_DIR) -o $(_JAVA_GEN_DIR)/$* $(_VPATH_SRCS)
1807 @touch $@
1809 # "Install" generated Java interfaces. We segregate them based on the XPI_NAME.
1810 # If XPI_NAME is not set, install into the "default" directory.
1811 ifneq ($(XPI_NAME),)
1812 JAVA_INSTALL_DIR = $(JAVA_DIST_DIR)/$(XPI_NAME)
1813 else
1814 JAVA_INSTALL_DIR = $(JAVA_DIST_DIR)/default
1815 endif
1817 $(JAVA_INSTALL_DIR):
1818 $(NSINSTALL) -D $@
1820 export:: $(JAVA_DIST_DIR) $(JAVADEPFILES) $(JAVA_INSTALL_DIR)
1821 (cd $(JAVA_GEN_DIR) && tar $(TAR_CREATE_FLAGS) - .) | (cd $(JAVA_INSTALL_DIR) && tar -xf -)
1823 endif # XPIDLSRCS || SDK_XPIDLSRCS
1824 endif # MOZ_JAVAXPCOM
1826 ################################################################################
1827 # Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
1828 ifdef EXTRA_COMPONENTS
1829 libs:: $(EXTRA_COMPONENTS)
1830 ifndef NO_DIST_INSTALL
1831 $(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/components
1832 endif
1834 endif
1836 ifdef EXTRA_PP_COMPONENTS
1837 libs:: $(EXTRA_PP_COMPONENTS)
1838 ifndef NO_DIST_INSTALL
1839 $(EXIT_ON_ERROR) \
1840 $(NSINSTALL) -D $(FINAL_TARGET)/components; \
1841 for i in $^; do \
1842 dest=$(FINAL_TARGET)/components/`basename $$i`; \
1843 $(RM) -f $$dest; \
1844 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1845 done
1846 endif
1848 endif
1850 ################################################################################
1851 # Copy each element of EXTRA_JS_MODULES to $(FINAL_TARGET)/modules
1852 ifdef EXTRA_JS_MODULES
1853 libs:: $(EXTRA_JS_MODULES)
1854 ifndef NO_DIST_INSTALL
1855 $(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/modules
1856 endif
1858 endif
1860 ifdef EXTRA_PP_JS_MODULES
1861 libs:: $(EXTRA_PP_JS_MODULES)
1862 ifndef NO_DIST_INSTALL
1863 $(EXIT_ON_ERROR) \
1864 $(NSINSTALL) -D $(FINAL_TARGET)/modules; \
1865 for i in $^; do \
1866 dest=$(FINAL_TARGET)/modules/`basename $$i`; \
1867 $(RM) -f $$dest; \
1868 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1869 done
1870 endif
1872 endif
1874 ################################################################################
1875 # SDK
1877 ifneq (,$(SDK_LIBRARY))
1878 $(SDK_LIB_DIR)::
1879 $(NSINSTALL) -D $@
1881 ifndef NO_DIST_INSTALL
1882 libs:: $(SDK_LIBRARY) $(SDK_LIB_DIR)
1883 $(INSTALL) $(IFLAGS2) $^
1884 endif
1886 endif # SDK_LIBRARY
1888 ifneq (,$(SDK_BINARY))
1889 $(SDK_BIN_DIR)::
1890 $(NSINSTALL) -D $@
1892 ifndef NO_DIST_INSTALL
1893 libs:: $(SDK_BINARY) $(SDK_BIN_DIR)
1894 $(INSTALL) $(IFLAGS2) $^
1895 endif
1897 endif # SDK_BINARY
1899 ################################################################################
1900 # CHROME PACKAGING
1902 JAR_MANIFEST := $(srcdir)/jar.mn
1904 chrome::
1905 $(MAKE) realchrome
1906 +$(LOOP_OVER_PARALLEL_DIRS)
1907 +$(LOOP_OVER_DIRS)
1908 +$(LOOP_OVER_TOOL_DIRS)
1910 $(FINAL_TARGET)/chrome:
1911 $(NSINSTALL) -D $@
1913 ifneq (,$(wildcard $(JAR_MANIFEST)))
1914 ifndef NO_DIST_INSTALL
1915 libs realchrome:: $(CHROME_DEPS) $(FINAL_TARGET)/chrome
1916 $(PYTHON) $(MOZILLA_DIR)/config/JarMaker.py \
1917 $(QUIET) -j $(FINAL_TARGET)/chrome \
1918 $(MAKE_JARS_FLAGS) $(XULPPFLAGS) $(DEFINES) $(ACDEFINES) \
1919 $(JAR_MANIFEST)
1920 endif
1921 endif
1923 ifneq ($(DIST_FILES),)
1924 libs:: $(DIST_FILES)
1925 @$(EXIT_ON_ERROR) \
1926 for f in $(DIST_FILES); do \
1927 dest=$(FINAL_TARGET)/`basename $$f`; \
1928 $(RM) -f $$dest; \
1929 $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
1930 $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
1931 $(srcdir)/$$f > $$dest; \
1932 done
1933 endif
1935 ifneq ($(DIST_CHROME_FILES),)
1936 libs:: $(DIST_CHROME_FILES)
1937 @$(EXIT_ON_ERROR) \
1938 for f in $(DIST_CHROME_FILES); do \
1939 dest=$(FINAL_TARGET)/chrome/`basename $$f`; \
1940 $(RM) -f $$dest; \
1941 $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
1942 $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
1943 $(srcdir)/$$f > $$dest; \
1944 done
1945 endif
1947 ifneq ($(XPI_PKGNAME),)
1948 libs realchrome::
1949 ifdef STRIP_XPI
1950 ifndef MOZ_DEBUG
1951 @echo "Stripping $(XPI_PKGNAME) package directory..."
1952 @echo $(FINAL_TARGET)
1953 @cd $(FINAL_TARGET) && find . ! -type d \
1954 ! -name "*.js" \
1955 ! -name "*.xpt" \
1956 ! -name "*.gif" \
1957 ! -name "*.jpg" \
1958 ! -name "*.png" \
1959 ! -name "*.xpm" \
1960 ! -name "*.txt" \
1961 ! -name "*.rdf" \
1962 ! -name "*.sh" \
1963 ! -name "*.properties" \
1964 ! -name "*.dtd" \
1965 ! -name "*.html" \
1966 ! -name "*.xul" \
1967 ! -name "*.css" \
1968 ! -name "*.xml" \
1969 ! -name "*.jar" \
1970 ! -name "*.dat" \
1971 ! -name "*.tbl" \
1972 ! -name "*.src" \
1973 ! -name "*.reg" \
1974 $(PLATFORM_EXCLUDE_LIST) \
1975 -exec $(STRIP) $(STRIP_FLAGS) {} >/dev/null 2>&1 \;
1976 endif
1977 endif
1978 @echo "Packaging $(XPI_PKGNAME).xpi..."
1979 cd $(FINAL_TARGET) && $(ZIP) -qr ../$(XPI_PKGNAME).xpi *
1980 endif
1982 ifdef INSTALL_EXTENSION_ID
1983 ifndef XPI_NAME
1984 $(error XPI_NAME must be set for INSTALL_EXTENSION_ID)
1985 endif
1987 libs::
1988 $(RM) -rf "$(DIST)/bin/extensions/$(INSTALL_EXTENSION_ID)"
1989 $(NSINSTALL) -D "$(DIST)/bin/extensions/$(INSTALL_EXTENSION_ID)"
1990 cd $(FINAL_TARGET) && tar $(TAR_CREATE_FLAGS) - . | (cd "../../bin/extensions/$(INSTALL_EXTENSION_ID)" && tar -xf -)
1992 endif
1994 ifneq (,$(filter flat symlink,$(MOZ_CHROME_FILE_FORMAT)))
1995 _JAR_REGCHROME_DISABLE_JAR=1
1996 else
1997 _JAR_REGCHROME_DISABLE_JAR=0
1998 endif
2000 REGCHROME = $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/add-chrome.pl \
2001 $(if $(filter gtk2,$(MOZ_WIDGET_TOOLKIT)),-x) \
2002 $(if $(CROSS_COMPILE),-o $(OS_ARCH)) $(FINAL_TARGET)/chrome/installed-chrome.txt \
2003 $(_JAR_REGCHROME_DISABLE_JAR)
2005 REGCHROME_INSTALL = $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/add-chrome.pl \
2006 $(if $(filter gtk2,$(MOZ_WIDGET_TOOLKIT)),-x) \
2007 $(if $(CROSS_COMPILE),-o $(OS_ARCH)) $(DESTDIR)$(mozappdir)/chrome/installed-chrome.txt \
2008 $(_JAR_REGCHROME_DISABLE_JAR)
2011 #############################################################################
2012 # Dependency system
2013 #############################################################################
2014 ifdef COMPILER_DEPEND
2015 depend::
2016 @echo "$(MAKE): No need to run depend target.\
2017 Using compiler-based depend." 1>&2
2018 ifeq ($(GNU_CC)$(GNU_CXX),)
2019 # Non-GNU compilers
2020 @echo "`echo '$(MAKE):'|sed 's/./ /g'`"\
2021 '(Compiler-based depend was turned on by "--enable-md".)' 1>&2
2022 else
2023 # GNU compilers
2024 @space="`echo '$(MAKE): '|sed 's/./ /g'`";\
2025 echo "$$space"'Since you are using a GNU compiler,\
2026 it is on by default.' 1>&2; \
2027 echo "$$space"'To turn it off, pass --disable-md to configure.' 1>&2
2028 endif
2030 else # ! COMPILER_DEPEND
2032 ifndef MOZ_AUTO_DEPS
2034 define MAKE_DEPS_NOAUTO
2035 $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f- $(DEFINES) $(ACDEFINES) $(INCLUDES) $< 2>/dev/null | sed -e "s|^[^ ]*/||" > $@
2036 endef
2038 $(MDDEPDIR)/%.pp: %.c
2039 $(REPORT_BUILD)
2040 @$(MAKE_DEPS_NOAUTO)
2042 $(MDDEPDIR)/%.pp: %.cpp
2043 $(REPORT_BUILD)
2044 @$(MAKE_DEPS_NOAUTO)
2046 $(MDDEPDIR)/%.pp: %.s
2047 $(REPORT_BUILD)
2048 @$(MAKE_DEPS_NOAUTO)
2050 ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
2051 depend:: $(SUBMAKEFILES) $(MAKE_DIRS) $(MDDEPFILES)
2052 else
2053 depend:: $(SUBMAKEFILES)
2054 endif
2055 +$(LOOP_OVER_PARALLEL_DIRS)
2056 +$(LOOP_OVER_DIRS)
2057 +$(LOOP_OVER_TOOL_DIRS)
2059 dependclean:: $(SUBMAKEFILES)
2060 rm -f $(MDDEPFILES)
2061 +$(LOOP_OVER_PARALLEL_DIRS)
2062 +$(LOOP_OVER_DIRS)
2063 +$(LOOP_OVER_TOOL_DIRS)
2065 endif # MOZ_AUTO_DEPS
2067 endif # COMPILER_DEPEND
2070 #############################################################################
2071 # MDDEPDIR is the subdirectory where all the dependency files are placed.
2072 # This uses a make rule (instead of a macro) to support parallel
2073 # builds (-jN). If this were done in the LOOP_OVER_DIRS macro, two
2074 # processes could simultaneously try to create the same directory.
2076 # We use $(CURDIR) in the rule's target to ensure that we don't find
2077 # a dependency directory in the source tree via VPATH (perhaps from
2078 # a previous build in the source tree) and thus neglect to create a
2079 # dependency directory in the object directory, where we really need
2080 # it.
2082 $(CURDIR)/$(MDDEPDIR):
2083 @if test ! -d $@; then echo Creating $@; rm -rf $@; mkdir $@; else true; fi
2085 ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))
2086 ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
2087 MDDEPEND_FILES := $(strip $(wildcard $(MDDEPDIR)/*.pp))
2089 ifneq (,$(MDDEPEND_FILES))
2090 ifdef PERL
2091 # The script mddepend.pl checks the dependencies and writes to stdout
2092 # one rule to force out-of-date objects. For example,
2093 # foo.o boo.o: FORCE
2094 # The script has an advantage over including the *.pp files directly
2095 # because it handles the case when header files are removed from the build.
2096 # 'make' would complain that there is no way to build missing headers.
2097 ifeq (,$(MAKE_RESTARTS))
2098 $(MDDEPDIR)/.all.pp: FORCE
2099 @$(PERL) $(BUILD_TOOLS)/mddepend.pl $@ $(MDDEPEND_FILES)
2100 endif
2101 -include $(MDDEPDIR)/.all.pp
2102 else
2103 include $(MDDEPEND_FILES)
2104 endif
2105 endif
2107 endif
2108 endif
2109 #############################################################################
2111 -include $(topsrcdir)/$(MOZ_BUILD_APP)/app-rules.mk
2112 -include $(MY_RULES)
2115 # This speeds up gmake's processing if these files don't exist.
2117 $(MY_CONFIG) $(MY_RULES):
2118 @touch $@
2121 # Generate Emacs tags in a file named TAGS if ETAGS was set in $(MY_CONFIG)
2122 # or in $(MY_RULES)
2124 ifdef ETAGS
2125 ifneq ($(CSRCS)$(CPPSRCS)$(HEADERS),)
2126 all:: TAGS
2127 TAGS:: $(CSRCS) $(CPPSRCS) $(HEADERS)
2128 $(ETAGS) $(CSRCS) $(CPPSRCS) $(HEADERS)
2129 endif
2130 endif
2132 ################################################################################
2133 # Special gmake rules.
2134 ################################################################################
2138 # Disallow parallel builds with MSVC < 8
2140 ifneq (,$(filter 1200 1300 1310,$(_MSC_VER)))
2141 .NOTPARALLEL:
2142 endif
2145 # Re-define the list of default suffixes, so gmake won't have to churn through
2146 # hundreds of built-in suffix rules for stuff we don't need.
2148 .SUFFIXES:
2151 # Fake targets. Always run these rules, even if a file/directory with that
2152 # name already exists.
2154 .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
2156 # Used as a dependency to force targets to rebuild
2157 FORCE:
2159 # Delete target if error occurs when building target
2160 .DELETE_ON_ERROR:
2162 # Properly set LIBPATTERNS for the platform
2163 .LIBPATTERNS = $(if $(IMPORT_LIB_SUFFIX),$(LIB_PREFIX)%.$(IMPORT_LIB_SUFFIX)) $(LIB_PREFIX)%.$(LIB_SUFFIX) $(DLL_PREFIX)%$(DLL_SUFFIX)
2165 tags: TAGS
2167 TAGS: $(SUBMAKEFILES) $(CSRCS) $(CPPSRCS) $(wildcard *.h)
2168 -etags $(CSRCS) $(CPPSRCS) $(wildcard *.h)
2169 +$(LOOP_OVER_PARALLEL_DIRS)
2170 +$(LOOP_OVER_DIRS)
2172 echo-variable-%:
2173 @echo $($*)
2175 echo-tiers:
2176 @echo $(TIERS)
2178 echo-dirs:
2179 @echo $(DIRS)
2181 echo-module:
2182 @echo $(MODULE)
2184 echo-requires:
2185 @echo $(REQUIRES)
2187 echo-requires-recursive::
2188 ifdef _REPORT_ALL_DIRS
2189 @echo $(subst $(topsrcdir)/,,$(srcdir)): $(MODULE): $(REQUIRES)
2190 else
2191 @$(if $(REQUIRES),echo $(subst $(topsrcdir)/,,$(srcdir)): $(MODULE): $(REQUIRES))
2192 endif
2193 +$(LOOP_OVER_PARALLEL_DIRS)
2194 +$(LOOP_OVER_DIRS)
2196 echo-depth-path:
2197 @$(topsrcdir)/build/unix/print-depth-path.sh
2199 echo-module-name:
2200 @$(topsrcdir)/build/package/rpm/print-module-name.sh
2202 echo-module-filelist:
2203 @$(topsrcdir)/build/package/rpm/print-module-filelist.sh
2205 showtargs:
2206 ifneq (,$(filter $(PROGRAM) $(HOST_PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS)))
2207 @echo --------------------------------------------------------------------------------
2208 @echo "PROGRAM = $(PROGRAM)"
2209 @echo "SIMPLE_PROGRAMS = $(SIMPLE_PROGRAMS)"
2210 @echo "LIBRARY = $(LIBRARY)"
2211 @echo "SHARED_LIBRARY = $(SHARED_LIBRARY)"
2212 @echo "SHARED_LIBRARY_LIBS = $(SHARED_LIBRARY_LIBS)"
2213 @echo "LIBS = $(LIBS)"
2214 @echo "DEF_FILE = $(DEF_FILE)"
2215 @echo "IMPORT_LIBRARY = $(IMPORT_LIBRARY)"
2216 @echo "STATIC_LIBS = $(STATIC_LIBS)"
2217 @echo "SHARED_LIBS = $(SHARED_LIBS)"
2218 @echo "EXTRA_DSO_LIBS = $(EXTRA_DSO_LIBS)"
2219 @echo "EXTRA_DSO_LDOPTS = $(EXTRA_DSO_LDOPTS)"
2220 @echo "DEPENDENT_LIBS = $(DEPENDENT_LIBS)"
2221 @echo --------------------------------------------------------------------------------
2222 endif
2223 +$(LOOP_OVER_PARALLEL_DIRS)
2224 +$(LOOP_OVER_DIRS)
2226 showbuild:
2227 @echo "MOZ_BUILD_ROOT = $(MOZ_BUILD_ROOT)"
2228 @echo "MOZ_WIDGET_TOOLKIT = $(MOZ_WIDGET_TOOLKIT)"
2229 @echo "CC = $(CC)"
2230 @echo "CXX = $(CXX)"
2231 @echo "CCC = $(CCC)"
2232 @echo "CPP = $(CPP)"
2233 @echo "LD = $(LD)"
2234 @echo "AR = $(AR)"
2235 @echo "IMPLIB = $(IMPLIB)"
2236 @echo "FILTER = $(FILTER)"
2237 @echo "MKSHLIB = $(MKSHLIB)"
2238 @echo "MKCSHLIB = $(MKCSHLIB)"
2239 @echo "RC = $(RC)"
2240 @echo "CFLAGS = $(CFLAGS)"
2241 @echo "OS_CFLAGS = $(OS_CFLAGS)"
2242 @echo "COMPILE_CFLAGS = $(COMPILE_CFLAGS)"
2243 @echo "CXXFLAGS = $(CXXFLAGS)"
2244 @echo "OS_CXXFLAGS = $(OS_CXXFLAGS)"
2245 @echo "COMPILE_CXXFLAGS = $(COMPILE_CXXFLAGS)"
2246 @echo "COMPILE_CMFLAGS = $(COMPILE_CMFLAGS)"
2247 @echo "COMPILE_CMMFLAGS = $(COMPILE_CMMFLAGS)"
2248 @echo "LDFLAGS = $(LDFLAGS)"
2249 @echo "OS_LDFLAGS = $(OS_LDFLAGS)"
2250 @echo "DSO_LDOPTS = $(DSO_LDOPTS)"
2251 @echo "OS_INCLUDES = $(OS_INCLUDES)"
2252 @echo "OS_LIBS = $(OS_LIBS)"
2253 @echo "EXTRA_LIBS = $(EXTRA_LIBS)"
2254 @echo "BIN_FLAGS = $(BIN_FLAGS)"
2255 @echo "INCLUDES = $(INCLUDES)"
2256 @echo "DEFINES = $(DEFINES)"
2257 @echo "ACDEFINES = $(ACDEFINES)"
2258 @echo "BIN_SUFFIX = $(BIN_SUFFIX)"
2259 @echo "LIB_SUFFIX = $(LIB_SUFFIX)"
2260 @echo "DLL_SUFFIX = $(DLL_SUFFIX)"
2261 @echo "IMPORT_LIB_SUFFIX = $(IMPORT_LIB_SUFFIX)"
2262 @echo "INSTALL = $(INSTALL)"
2264 showhost:
2265 @echo "HOST_CC = $(HOST_CC)"
2266 @echo "HOST_CXX = $(HOST_CXX)"
2267 @echo "HOST_CFLAGS = $(HOST_CFLAGS)"
2268 @echo "HOST_LDFLAGS = $(HOST_LDFLAGS)"
2269 @echo "HOST_LIBS = $(HOST_LIBS)"
2270 @echo "HOST_EXTRA_LIBS = $(HOST_EXTRA_LIBS)"
2271 @echo "HOST_EXTRA_DEPS = $(HOST_EXTRA_DEPS)"
2272 @echo "HOST_PROGRAM = $(HOST_PROGRAM)"
2273 @echo "HOST_OBJS = $(HOST_OBJS)"
2274 @echo "HOST_PROGOBJS = $(HOST_PROGOBJS)"
2275 @echo "HOST_LIBRARY = $(HOST_LIBRARY)"
2277 showbuildmods::
2278 @echo "Build Modules = $(BUILD_MODULES)"
2279 @echo "Module dirs = $(BUILD_MODULE_DIRS)"
2281 zipmakes:
2282 ifneq (,$(filter $(PROGRAM) $(SIMPLE_PROGRAMS) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS)))
2283 zip $(DEPTH)/makefiles $(subst $(topsrcdir),$(MOZ_SRC)/mozilla,$(srcdir)/Makefile.in)
2284 endif
2285 +$(LOOP_OVER_PARALLEL_DIRS)
2286 +$(LOOP_OVER_DIRS)
2288 documentation:
2289 @cd $(DEPTH)
2290 $(DOXYGEN) $(DEPTH)/config/doxygen.cfg
2292 check:: $(SUBMAKEFILES) $(MAKE_DIRS)
2293 +$(LOOP_OVER_PARALLEL_DIRS)
2294 +$(LOOP_OVER_DIRS)
2295 +$(LOOP_OVER_TOOL_DIRS)