/[jscoverage]/trunk/js/config/rules.mk
ViewVC logotype

Contents of /trunk/js/config/rules.mk

Parent Directory Parent Directory | Revision Log Revision Log


Revision 585 - (show annotations)
Sun Sep 12 15:13:23 2010 UTC (9 years, 1 month ago) by siliconforks
File size: 66540 byte(s)
Update to SpiderMonkey from Firefox 3.6.9.

1 # vim:set ts=8 sw=8 sts=8 noet:
2 #
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 #
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/
10 #
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.
15 #
16 # The Original Code is mozilla.org code.
17 #
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.
22 #
23 # Contributor(s):
24 # Chase Phillips <chase@mozilla.org>
25 # Benjamin Smedberg <benjamin@smedbergs.us>
26 # Jeff Walden <jwalden+code@mit.edu>
27 #
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.
39 #
40 # ***** END LICENSE BLOCK *****
41
42 ifndef topsrcdir
43 $(error topsrcdir was not set))
44 endif
45
46 ifndef MOZILLA_DIR
47 MOZILLA_DIR = $(topsrcdir)
48 endif
49
50 ifndef INCLUDED_CONFIG_MK
51 include $(topsrcdir)/config/config.mk
52 endif
53
54 ifndef INCLUDED_VERSION_MK
55 include $(topsrcdir)/config/version.mk
56 endif
57
58 ifdef SDK_XPIDLSRCS
59 XPIDLSRCS += $(SDK_XPIDLSRCS)
60 endif
61 ifdef SDK_HEADERS
62 EXPORTS += $(SDK_HEADERS)
63 endif
64
65 REPORT_BUILD = @echo $(notdir $<)
66
67 ifeq ($(OS_ARCH),OS2)
68 EXEC =
69 else
70 EXEC = exec
71 endif
72
73 # Don't copy xulrunner files at install time, when using system xulrunner
74 ifdef SYSTEM_LIBXUL
75 SKIP_COPY_XULRUNNER=1
76 endif
77
78 # ELOG prints out failed command when building silently (gmake -s).
79 ifneq (,$(findstring -s,$(MAKEFLAGS)))
80 ELOG := $(EXEC) sh $(BUILD_TOOLS)/print-failed-commands.sh
81 else
82 ELOG :=
83 endif
84
85 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
86 ifndef GNU_CC
87 _LIBNAME_RELATIVE_PATHS=1
88 endif
89 endif
90
91 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
92 _VPATH_SRCS = $(if $(filter /%,$<),$<,$(CURDIR)/$<)
93 else
94 _VPATH_SRCS = $<
95 endif
96
97 # Add $(DIST)/lib to VPATH so that -lfoo dependencies are followed
98 VPATH += $(DIST)/lib
99 ifdef LIBXUL_SDK
100 VPATH += $(LIBXUL_SDK)/lib
101 endif
102
103 # EXPAND_LIBNAME - $(call EXPAND_LIBNAME,foo)
104 # expands to foo.lib on platforms with import libs and -lfoo otherwise
105
106 # EXPAND_LIBNAME_PATH - $(call EXPAND_LIBNAME_PATH,foo,dir)
107 # expands to dir/foo.lib on platforms with import libs and
108 # -Ldir -lfoo otherwise
109
110 # EXPAND_MOZLIBNAME - $(call EXPAND_MOZLIBNAME,foo)
111 # expands to $(DIST)/lib/foo.lib on platforms with import libs and
112 # -lfoo otherwise
113
114 ifdef _LIBNAME_RELATIVE_PATHS
115 EXPAND_LIBNAME = $(foreach lib,$(1),$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
116 EXPAND_LIBNAME_PATH = $(foreach lib,$(1),$(2)/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
117 EXPAND_MOZLIBNAME = $(foreach lib,$(1),$(DIST)/lib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
118 else
119 EXPAND_LIBNAME = $(addprefix -l,$(1))
120 EXPAND_LIBNAME_PATH = -L$(2) $(addprefix -l,$(1))
121 EXPAND_MOZLIBNAME = $(addprefix -l,$(1))
122 endif
123
124 ifdef EXTRA_DSO_LIBS
125 EXTRA_DSO_LIBS := $(call EXPAND_MOZLIBNAME,$(EXTRA_DSO_LIBS))
126 endif
127
128 ################################################################################
129 # Testing frameworks support
130 ################################################################################
131
132 ifdef ENABLE_TESTS
133
134 ifdef XPCSHELL_TESTS
135 ifndef MODULE
136 $(error Must define MODULE when defining XPCSHELL_TESTS.)
137 endif
138
139 testxpcobjdir = $(DEPTH)/_tests/xpcshell
140
141 # Test file installation
142 ifneq (,$(filter WINNT os2-emx,$(HOST_OS_ARCH)))
143 # Windows and OS/2 nsinstall can't recursively copy directories, so use nsinstall.py
144 TEST_INSTALLER = $(PYTHON) $(topsrcdir)/config/nsinstall.py
145 else
146 TEST_INSTALLER = $(INSTALL)
147 endif
148
149 define _INSTALL_TESTS
150 $(TEST_INSTALLER) $(wildcard $(srcdir)/$(dir)/*) $(testxpcobjdir)/$(MODULE)/$(dir)
151
152 endef # do not remove the blank line!
153
154 SOLO_FILE ?= $(error Specify a test filename in SOLO_FILE when using check-interactive or check-one)
155
156 libs::
157 $(foreach dir,$(XPCSHELL_TESTS),$(_INSTALL_TESTS))
158 $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl \
159 $(testxpcobjdir)/all-test-dirs.list \
160 $(addprefix $(MODULE)/,$(XPCSHELL_TESTS))
161
162 testxpcsrcdir = $(topsrcdir)/testing/xpcshell
163
164 # Execute all tests in the $(XPCSHELL_TESTS) directories.
165 # See also testsuite-targets.mk 'xpcshell-tests' target for global execution.
166 xpcshell-tests:
167 $(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
168 -I$(topsrcdir)/build \
169 $(testxpcsrcdir)/runxpcshelltests.py \
170 --symbols-path=$(DIST)/crashreporter-symbols \
171 $(DIST)/bin/xpcshell \
172 $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
173
174 # Execute a single test, specified in $(SOLO_FILE), but don't automatically
175 # start the test. Instead, present the xpcshell prompt so the user can
176 # attach a debugger and then start the test.
177 check-interactive:
178 $(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
179 -I$(topsrcdir)/build \
180 $(testxpcsrcdir)/runxpcshelltests.py \
181 --symbols-path=$(DIST)/crashreporter-symbols \
182 --test-path=$(SOLO_FILE) \
183 --interactive \
184 $(DIST)/bin/xpcshell \
185 $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
186
187 # Execute a single test, specified in $(SOLO_FILE)
188 check-one:
189 $(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
190 -I$(topsrcdir)/build \
191 $(testxpcsrcdir)/runxpcshelltests.py \
192 --symbols-path=$(DIST)/crashreporter-symbols \
193 --test-path=$(SOLO_FILE) \
194 $(DIST)/bin/xpcshell \
195 $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
196
197 endif # XPCSHELL_TESTS
198
199 ifdef CPP_UNIT_TESTS
200
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 INCLUDES += -I$(DIST)/include/testing
207 LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS)
208
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
215
216 endif # CPP_UNIT_TESTS
217
218 .PHONY: check xpcshell-tests check-interactive check-one
219
220 endif # ENABLE_TESTS
221
222
223 #
224 # Library rules
225 #
226 # If BUILD_STATIC_LIBS or FORCE_STATIC_LIB is set, build a static library.
227 # Otherwise, build a shared library.
228 #
229
230 ifndef LIBRARY
231 ifdef STATIC_LIBRARY_NAME
232 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
233 ifdef SHORT_LIBNAME
234 STATIC_LIBRARY_NAME := $(SHORT_LIBNAME)
235 SHARED_LIBRARY_NAME := $(SHORT_LIBNAME)
236 endif
237 endif
238 LIBRARY := $(LIB_PREFIX)$(STATIC_LIBRARY_NAME).$(LIB_SUFFIX)
239 endif # STATIC_LIBRARY_NAME
240 endif # LIBRARY
241
242 ifndef HOST_LIBRARY
243 ifdef HOST_LIBRARY_NAME
244 HOST_LIBRARY := $(LIB_PREFIX)$(HOST_LIBRARY_NAME).$(LIB_SUFFIX)
245 endif
246 endif
247
248 ifdef LIBRARY
249 ifneq (_1,$(FORCE_SHARED_LIB)_$(BUILD_STATIC_LIBS))
250 ifdef MKSHLIB
251
252 ifdef LIB_IS_C_ONLY
253 MKSHLIB = $(MKCSHLIB)
254 endif
255
256 ifdef MAKE_FRAMEWORK
257 SHARED_LIBRARY := $(SHARED_LIBRARY_NAME)
258 else
259 SHARED_LIBRARY := $(DLL_PREFIX)$(SHARED_LIBRARY_NAME)$(DLL_SUFFIX)
260 endif
261
262 ifeq ($(OS_ARCH),OS2)
263 DEF_FILE := $(SHARED_LIBRARY:.dll=.def)
264 endif
265
266 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
267 IMPORT_LIBRARY := $(LIB_PREFIX)$(SHARED_LIBRARY_NAME).$(IMPORT_LIB_SUFFIX)
268 endif
269
270 ifdef MOZ_ENABLE_LIBXUL
271 EMBED_MANIFEST_AT=2
272 endif
273
274 endif # MKSHLIB
275 endif # FORCE_SHARED_LIB && !BUILD_STATIC_LIBS
276 endif # LIBRARY
277
278 ifeq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB))
279 LIBRARY := $(NULL)
280 endif
281
282 ifeq (_1,$(FORCE_SHARED_LIB)_$(BUILD_STATIC_LIBS))
283 SHARED_LIBRARY := $(NULL)
284 DEF_FILE := $(NULL)
285 IMPORT_LIBRARY := $(NULL)
286 endif
287
288 ifdef FORCE_STATIC_LIB
289 ifndef FORCE_SHARED_LIB
290 SHARED_LIBRARY := $(NULL)
291 DEF_FILE := $(NULL)
292 IMPORT_LIBRARY := $(NULL)
293 endif
294 endif
295
296 ifdef FORCE_SHARED_LIB
297 ifndef FORCE_STATIC_LIB
298 LIBRARY := $(NULL)
299 endif
300 endif
301
302 ifdef JAVA_LIBRARY_NAME
303 JAVA_LIBRARY := $(JAVA_LIBRARY_NAME).jar
304 endif
305
306 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
307 ifndef GNU_CC
308
309 #
310 # Unless we're building SIMPLE_PROGRAMS, all C++ files share a PDB file per
311 # directory. For parallel builds, this PDB file is shared and locked by
312 # MSPDBSRV.EXE, starting with MSVC8 SP1. If you're using MSVC 7.1 or MSVC8
313 # without SP1, don't do parallel builds.
314 #
315 # The final PDB for libraries and programs is created by the linker and uses
316 # a different name from the single PDB file created by the compiler. See
317 # bug 462740.
318 #
319
320 ifdef SIMPLE_PROGRAMS
321 COMPILE_PDBFILE = $(basename $(@F)).pdb
322 else
323 COMPILE_PDBFILE = generated.pdb
324 endif
325
326 LINK_PDBFILE = $(basename $(@F)).pdb
327 ifdef MOZ_DEBUG
328 CODFILE=$(basename $(@F)).cod
329 endif
330
331 ifdef MOZ_MAPINFO
332 ifdef SHARED_LIBRARY_NAME
333 MAPFILE=$(SHARED_LIBRARY_NAME).map
334 else
335 MAPFILE=$(basename $(@F)).map
336 endif # SHARED_LIBRARY_NAME
337 endif # MOZ_MAPINFO
338
339 ifdef DEFFILE
340 OS_LDFLAGS += -DEF:$(call normalizepath,$(DEFFILE))
341 EXTRA_DEPS += $(DEFFILE)
342 endif
343
344 ifdef MAPFILE
345 OS_LDFLAGS += -MAP:$(MAPFILE)
346 endif
347
348 endif # !GNU_CC
349
350 ifdef ENABLE_CXX_EXCEPTIONS
351 ifdef GNU_CC
352 CXXFLAGS += -fexceptions
353 else
354 ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER)))
355 CXXFLAGS += -GX
356 else
357 CXXFLAGS += -EHsc
358 endif # _MSC_VER
359 endif # GNU_CC
360 endif # ENABLE_CXX_EXCEPTIONS
361 endif # WINNT
362
363 ifeq (,$(filter-out WINNT WINCE,$(HOST_OS_ARCH)))
364 HOST_PDBFILE=$(basename $(@F)).pdb
365 endif
366
367 ifndef TARGETS
368 TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
369 endif
370
371 ifndef OBJS
372 _OBJS = \
373 $(JRI_STUB_CFILES) \
374 $(addsuffix .$(OBJ_SUFFIX), $(JMC_GEN)) \
375 $(CSRCS:.c=.$(OBJ_SUFFIX)) \
376 $(patsubst %.cc,%.$(OBJ_SUFFIX),$(CPPSRCS:.cpp=.$(OBJ_SUFFIX))) \
377 $(CMSRCS:.m=.$(OBJ_SUFFIX)) \
378 $(CMMSRCS:.mm=.$(OBJ_SUFFIX)) \
379 $(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX))
380 OBJS = $(strip $(_OBJS))
381 endif
382
383 ifndef HOST_OBJS
384 _HOST_OBJS = \
385 $(addprefix host_,$(HOST_CSRCS:.c=.$(OBJ_SUFFIX))) \
386 $(addprefix host_,$(patsubst %.cc,%.$(OBJ_SUFFIX),$(HOST_CPPSRCS:.cpp=.$(OBJ_SUFFIX)))) \
387 $(addprefix host_,$(HOST_CMSRCS:.m=.$(OBJ_SUFFIX))) \
388 $(addprefix host_,$(HOST_CMMSRCS:.mm=.$(OBJ_SUFFIX)))
389 HOST_OBJS = $(strip $(_HOST_OBJS))
390 endif
391
392 LIBOBJS := $(addprefix \", $(OBJS))
393 LIBOBJS := $(addsuffix \", $(LIBOBJS))
394
395 ifndef MOZ_AUTO_DEPS
396 ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS))
397 MDDEPFILES = $(addprefix $(MDDEPDIR)/,$(OBJS:.$(OBJ_SUFFIX)=.pp))
398 ifndef NO_GEN_XPT
399 MDDEPFILES += $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.xpt))
400 endif
401 endif
402 endif
403
404 ALL_TRASH = \
405 $(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
406 $(filter-out $(ASFILES),$(OBJS:.$(OBJ_SUFFIX)=.s)) $(OBJS:.$(OBJ_SUFFIX)=.ii) \
407 $(OBJS:.$(OBJ_SUFFIX)=.i) \
408 $(HOST_PROGOBJS) $(HOST_OBJS) $(IMPORT_LIBRARY) $(DEF_FILE)\
409 $(EXE_DEF_FILE) so_locations _gen _stubs $(wildcard *.res) $(wildcard *.RES) \
410 $(wildcard *.pdb) $(CODFILE) $(MAPFILE) $(IMPORT_LIBRARY) \
411 $(SHARED_LIBRARY:$(DLL_SUFFIX)=.exp) $(wildcard *.ilk) \
412 $(PROGRAM:$(BIN_SUFFIX)=.exp) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.exp) \
413 $(PROGRAM:$(BIN_SUFFIX)=.lib) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.lib) \
414 $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.$(OBJ_SUFFIX)) \
415 $(wildcard gts_tmp_*) $(LIBRARY:%.a=.%.timestamp)
416 ALL_TRASH_DIRS = \
417 $(GARBAGE_DIRS) /no-such-file
418
419 ifdef QTDIR
420 GARBAGE += $(MOCSRCS)
421 endif
422
423 ifdef SIMPLE_PROGRAMS
424 GARBAGE += $(SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX))
425 endif
426
427 ifdef HOST_SIMPLE_PROGRAMS
428 GARBAGE += $(HOST_SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX))
429 endif
430
431 #
432 # the Solaris WorkShop template repository cache. it occasionally can get
433 # out of sync, so targets like clobber should kill it.
434 #
435 ifeq ($(SOLARIS_SUNPRO_CXX),1)
436 GARBAGE_DIRS += SunWS_cache
437 endif
438
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
455
456 XPIDL_GEN_DIR = _xpidlgen
457
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!$(1) in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$(2)!" $(MOZILLA_DIR)/config/xterm.str;
463 endif
464
465 define SUBMAKE # $(call SUBMAKE,target,directory)
466 @$(UPDATE_TITLE)
467 +@$(MAKE) $(if $(2),-C $(2)) $(1)
468
469 endef # The extra line is important here! don't delete it
470
471 ifneq (,$(strip $(DIRS)))
472 LOOP_OVER_DIRS = \
473 $(foreach dir,$(DIRS),$(call SUBMAKE,$@,$(dir)))
474 endif
475
476 # we only use this for the makefiles target and other stuff that doesn't matter
477 ifneq (,$(strip $(PARALLEL_DIRS)))
478 LOOP_OVER_PARALLEL_DIRS = \
479 $(foreach dir,$(PARALLEL_DIRS),$(call SUBMAKE,$@,$(dir)))
480 endif
481
482 ifneq (,$(strip $(STATIC_DIRS)))
483 LOOP_OVER_STATIC_DIRS = \
484 $(foreach dir,$(STATIC_DIRS),$(call SUBMAKE,$@,$(dir)))
485 endif
486
487 ifneq (,$(strip $(TOOL_DIRS)))
488 LOOP_OVER_TOOL_DIRS = \
489 $(foreach dir,$(TOOL_DIRS),$(call SUBMAKE,$@,$(dir)))
490 endif
491
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))
497
498 .PHONY: $(PARALLEL_DIRS_export) $(PARALLEL_DIRS_libs) $(PARALLEL_DIRS_tools)
499 endif
500
501 #
502 # Now we can differentiate between objects used to build a library, and
503 # objects used to build an executable in the same directory.
504 #
505 ifndef PROGOBJS
506 PROGOBJS = $(OBJS)
507 endif
508
509 ifndef HOST_PROGOBJS
510 HOST_PROGOBJS = $(HOST_OBJS)
511 endif
512
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)$(SIMPLE_PROGRAMS)$(NEED_MDDEPDIR))
517 MAKE_DIRS += $(CURDIR)/$(MDDEPDIR)
518 GARBAGE_DIRS += $(MDDEPDIR)
519 endif
520
521 #
522 # Tags: emacs (etags), vi (ctags)
523 # TAG_PROGRAM := ctags -L -
524 #
525 TAG_PROGRAM = xargs etags -a
526
527 #
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)
531 #
532 ifneq ($(CPPSRCS)$(CMMSRCS),)
533 CPP_PROG_LINK = 1
534 endif
535
536 #
537 # Make sure to wrap static libs inside linker specific flags to turn on & off
538 # inclusion of all symbols inside the static libs
539 #
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
545
546 #
547 # This will strip out symbols that the component should not be
548 # exporting from the .dynsym section.
549 #
550 ifdef IS_COMPONENT
551 EXTRA_DSO_LDOPTS += $(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
552 endif # IS_COMPONENT
553
554 #
555 # Enforce the requirement that MODULE_NAME must be set
556 # for components in static builds
557 #
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
567
568 #
569 # MacOS X specific stuff
570 #
571
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
581
582 #
583 # On NetBSD a.out systems, use -Bsymbolic. This fixes what would otherwise be
584 # fatal symbol name clashes between components.
585 #
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
593
594 ifeq ($(OS_ARCH),FreeBSD)
595 ifdef IS_COMPONENT
596 EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
597 endif
598 endif
599
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
608
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
617
618 #
619 # HP-UXBeOS specific section: for COMPONENTS only, add -Bsymbolic flag
620 # which uses internal symbols first
621 #
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
637
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
646
647 #
648 # OSF1: add -B symbolic flag for components
649 #
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
657
658 #
659 # Linux: add -Bsymbolic flag for components
660 #
661 ifeq ($(OS_ARCH),Linux)
662 ifdef IS_COMPONENT
663 EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
664 endif
665 endif
666
667 #
668 # MINGW32
669 #
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
677
678 ifeq ($(USE_TVFS),1)
679 IFLAGS1 = -rb
680 IFLAGS2 = -rb
681 else
682 IFLAGS1 = -m 644
683 IFLAGS2 = -m 755
684 endif
685
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
694
695 ifeq ($(OS_TARGET), WINCE)
696 OUTOPTION = -Fo# eol
697 HOST_OUTOPTION = -Fo# eol
698 else
699
700 ifeq (,$(CROSS_COMPILE))
701 HOST_OUTOPTION = $(OUTOPTION)
702 else
703 HOST_OUTOPTION = -o # eol
704 endif
705
706 endif
707 ################################################################################
708
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))
712
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 $(foreach tier,$(TIERS),$(call SUBMAKE,tier_$(tier)))
721 else
722
723 default all::
724 ifneq (,$(strip $(STATIC_DIRS)))
725 $(foreach dir,$(STATIC_DIRS),$(call SUBMAKE,,$(dir)))
726 endif
727 $(MAKE) export
728 $(MAKE) libs
729 $(MAKE) tools
730
731 # Do depend as well
732 alldep::
733 $(MAKE) export
734 $(MAKE) depend
735 $(MAKE) libs
736 $(MAKE) tools
737
738 endif # TIERS
739 endif # SUPPRESS_DEFAULT_RULES
740
741 ifeq ($(filter s,$(MAKEFLAGS)),)
742 ECHO := echo
743 QUIET :=
744 else
745 ECHO := true
746 QUIET := -q
747 endif
748
749 MAKE_TIER_SUBMAKEFILES = +$(if $(tier_$*_dirs),$(MAKE) $(addsuffix /Makefile,$(tier_$*_dirs)))
750
751 export_tier_%:
752 @$(ECHO) "$@"
753 @$(MAKE_TIER_SUBMAKEFILES)
754 $(foreach dir,$(tier_$*_dirs),$(call SUBMAKE,export,$(dir)))
755
756 libs_tier_%:
757 @$(ECHO) "$@"
758 @$(MAKE_TIER_SUBMAKEFILES)
759 $(foreach dir,$(tier_$*_dirs),$(call SUBMAKE,libs,$(dir)))
760
761 tools_tier_%:
762 @$(ECHO) "$@"
763 @$(MAKE_TIER_SUBMAKEFILES)
764 $(foreach dir,$(tier_$*_dirs),$(call SUBMAKE,tools,$(dir)))
765
766 $(foreach tier,$(TIERS),tier_$(tier))::
767 @$(ECHO) "$@: $($@_staticdirs) $($@_dirs)"
768 $(foreach dir,$($@_staticdirs),$(call SUBMAKE,,$(dir)))
769 $(MAKE) export_$@
770 $(MAKE) libs_$@
771
772 # Do everything from scratch
773 everything::
774 $(MAKE) clean
775 $(MAKE) alldep
776
777 # Add dummy depend target for tinderboxes
778 depend::
779
780 # Target to only regenerate makefiles
781 makefiles: $(SUBMAKEFILES)
782 ifneq (,$(DIRS)$(TOOL_DIRS)$(PARALLEL_DIRS))
783 $(LOOP_OVER_PARALLEL_DIRS)
784 $(LOOP_OVER_DIRS)
785 $(LOOP_OVER_TOOL_DIRS)
786 endif
787
788 ifdef PARALLEL_DIRS
789 export:: $(PARALLEL_DIRS_export)
790
791 $(PARALLEL_DIRS_export): %_export: %/Makefile
792 +@$(call SUBMAKE,export,$*)
793 endif
794
795 export:: $(SUBMAKEFILES) $(MAKE_DIRS) $(if $(XPIDLSRCS),$(IDL_DIR))
796 $(LOOP_OVER_DIRS)
797 $(LOOP_OVER_TOOL_DIRS)
798
799 ifdef PARALLEL_DIRS
800 tools:: $(PARALLEL_DIRS_tools)
801
802 $(PARALLEL_DIRS_tools): %_tools: %/Makefile
803 +@$(call SUBMAKE,tools,$*)
804 endif
805
806 tools:: $(SUBMAKEFILES) $(MAKE_DIRS)
807 $(LOOP_OVER_DIRS)
808 ifneq (,$(strip $(TOOL_DIRS)))
809 $(foreach dir,$(TOOL_DIRS),$(call SUBMAKE,libs,$(dir)))
810 endif
811
812 #
813 # Rule to create list of libraries for final link
814 #
815 export::
816 ifdef LIBRARY_NAME
817 ifdef EXPORT_LIBRARY
818 ifdef IS_COMPONENT
819 ifdef BUILD_STATIC_LIBS
820 @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(STATIC_LIBRARY_NAME)
821 ifdef MODULE_NAME
822 @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMP_NAMES) $(MODULE_NAME)
823 endif
824 endif # BUILD_STATIC_LIBS
825 else # !IS_COMPONENT
826 $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(STATIC_LIBRARY_NAME)
827 endif # IS_COMPONENT
828 endif # EXPORT_LIBRARY
829 endif # LIBRARY_NAME
830
831 # Create dependencies on static (and shared EXTRA_DSO_LIBS) libraries
832 LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(LIBS))
833 HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(HOST_LIBS))
834 DSO_LDOPTS_DEPS = $(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS))
835
836 # Dependancies which, if modified, should cause everything to rebuild
837 GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
838
839 ##############################################
840 ifdef PARALLEL_DIRS
841 libs:: $(PARALLEL_DIRS_libs)
842
843 $(PARALLEL_DIRS_libs): %_libs: %/Makefile
844 +@$(call SUBMAKE,libs,$*)
845 endif
846
847 libs:: $(SUBMAKEFILES) $(MAKE_DIRS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(HOST_PROGRAM) $(PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
848 ifndef NO_DIST_INSTALL
849 ifdef LIBRARY
850 ifdef EXPORT_LIBRARY # Stage libs that will be linked into a static build
851 ifdef IS_COMPONENT
852 $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib/components
853 else
854 $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib
855 endif
856 endif # EXPORT_LIBRARY
857 ifdef DIST_INSTALL
858 ifdef IS_COMPONENT
859 $(error Shipping static component libs makes no sense.)
860 else
861 $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DIST)/lib
862 endif
863 endif # DIST_INSTALL
864 endif # LIBRARY
865 ifdef SHARED_LIBRARY
866 ifdef IS_COMPONENT
867 $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
868 $(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
869 @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_TARGET)/components/components.list $(SHARED_LIBRARY)
870 ifdef BEOS_ADDON_WORKAROUND
871 ( cd $(FINAL_TARGET)/components && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
872 endif
873 else # ! IS_COMPONENT
874 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
875 $(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(DIST)/lib
876 else
877 $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DIST)/lib
878 endif
879 $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)
880 ifdef BEOS_ADDON_WORKAROUND
881 ( cd $(FINAL_TARGET) && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
882 endif
883 endif # IS_COMPONENT
884 endif # SHARED_LIBRARY
885 ifdef PROGRAM
886 $(INSTALL) $(IFLAGS2) $(PROGRAM) $(FINAL_TARGET)
887 endif
888 ifdef SIMPLE_PROGRAMS
889 $(INSTALL) $(IFLAGS2) $(SIMPLE_PROGRAMS) $(FINAL_TARGET)
890 endif
891 ifdef HOST_PROGRAM
892 $(INSTALL) $(IFLAGS2) $(HOST_PROGRAM) $(DIST)/host/bin
893 endif
894 ifdef HOST_SIMPLE_PROGRAMS
895 $(INSTALL) $(IFLAGS2) $(HOST_SIMPLE_PROGRAMS) $(DIST)/host/bin
896 endif
897 ifdef HOST_LIBRARY
898 $(INSTALL) $(IFLAGS1) $(HOST_LIBRARY) $(DIST)/host/lib
899 endif
900 ifdef JAVA_LIBRARY
901 ifdef IS_COMPONENT
902 $(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)/components
903 else
904 $(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)
905 endif
906 endif # JAVA_LIBRARY
907 endif # !NO_DIST_INSTALL
908 $(LOOP_OVER_DIRS)
909
910 ##############################################
911
912 ifndef NO_PROFILE_GUIDED_OPTIMIZE
913 ifneq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
914 ifeq ($(OS_ARCH)_$(GNU_CC)$(INTERNAL_TOOLS), WINNT_)
915 # Force re-linking when building with PGO, since
916 # the MSVC linker does all the work. We force re-link
917 # in both stages so you can do depend builds with PGO.
918 ifdef SHARED_LIBRARY
919 $(SHARED_LIBRARY): FORCE
920 endif
921 ifdef PROGRAM
922 $(PROGRAM): FORCE
923 endif
924
925 ifdef MOZ_PROFILE_USE
926 # In the second pass, we need to merge the pgc files into the pgd file.
927 # The compiler would do this for us automatically if they were in the right
928 # place, but they're in dist/bin.
929 ifneq (,$(SHARED_LIBRARY)$(PROGRAM))
930 export::
931 ifdef PROGRAM
932 $(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
933 $(PROGRAM:$(BIN_SUFFIX)=) $(DIST)/bin
934 endif
935 ifdef SHARED_LIBRARY
936 $(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
937 $(SHARED_LIBRARY_NAME) $(DIST)/bin
938 endif
939 endif
940 endif # MOZ_PROFILE_USE
941 endif # WINNT_
942 endif # MOZ_PROFILE_GENERATE || MOZ_PROFILE_USE
943 endif # NO_PROFILE_GUIDED_OPTIMIZE
944
945 ##############################################
946
947 checkout:
948 $(MAKE) -C $(topsrcdir) -f client.mk checkout
949
950 clean clobber realclean clobber_all:: $(SUBMAKEFILES)
951 -rm -f $(ALL_TRASH)
952 -rm -rf $(ALL_TRASH_DIRS)
953 $(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(STATIC_DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
954
955 distclean:: $(SUBMAKEFILES)
956 $(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(STATIC_DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
957 -rm -rf $(ALL_TRASH_DIRS)
958 -rm -f $(ALL_TRASH) \
959 Makefile .HSancillary \
960 $(wildcard *.$(OBJ_SUFFIX)) $(wildcard *.ho) $(wildcard host_*.o*) \
961 $(wildcard *.$(LIB_SUFFIX)) $(wildcard *$(DLL_SUFFIX)) \
962 $(wildcard *.$(IMPORT_LIB_SUFFIX))
963 ifeq ($(OS_ARCH),OS2)
964 -rm -f $(PROGRAM:.exe=.map)
965 endif
966
967 alltags:
968 rm -f TAGS
969 find $(topsrcdir) -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' -o -name '*.idl' \) -print | $(TAG_PROGRAM)
970
971 #
972 # PROGRAM = Foo
973 # creates OBJS, links with LIBS to create Foo
974 #
975 $(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) $(EXE_DEF_FILE) $(RESFILE) $(GLOBAL_DEPS)
976 @rm -f $@.manifest
977 ifeq (WINCE,$(OS_ARCH))
978 $(LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
979 else
980 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
981 $(LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
982 ifdef MSMANIFEST_TOOL
983 @if test -f $@.manifest; then \
984 if test -f "$(srcdir)/$@.manifest"; then \
985 echo "Embedding manifest from $(srcdir)/$@.manifest and $@.manifest"; \
986 mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
987 else \
988 echo "Embedding manifest from $@.manifest"; \
989 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
990 fi; \
991 elif test -f "$(srcdir)/$@.manifest"; then \
992 echo "Embedding manifest from $(srcdir)/$@.manifest"; \
993 mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" -OUTPUTRESOURCE:$@\;1; \
994 fi
995 endif # MSVC with manifest tool
996 else
997 ifeq ($(CPP_PROG_LINK),1)
998 $(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)
999 else # ! CPP_PROG_LINK
1000 $(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
1001 endif # CPP_PROG_LINK
1002 endif # WINNT && !GNU_CC
1003 endif # WINCE
1004
1005 ifdef ENABLE_STRIP
1006 $(STRIP) $@
1007 endif
1008 ifdef MOZ_POST_PROGRAM_COMMAND
1009 $(MOZ_POST_PROGRAM_COMMAND) $@
1010 endif
1011 ifeq ($(OS_ARCH),BeOS)
1012 ifdef BEOS_PROGRAM_RESOURCE
1013 xres -o $@ $(BEOS_PROGRAM_RESOURCE)
1014 mimeset $@
1015 endif
1016 endif # BeOS
1017
1018 $(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
1019 ifeq (WINCE,$(OS_ARCH))
1020 $(HOST_LD) -NOLOGO -OUT:$@ $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1021 else
1022 ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
1023 $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1024 ifdef MSMANIFEST_TOOL
1025 @if test -f $@.manifest; then \
1026 if test -f "$(srcdir)/$@.manifest"; then \
1027 mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
1028 else \
1029 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
1030 fi; \
1031 rm -f $@.manifest; \
1032 fi
1033 endif # MSVC with manifest tool
1034 else
1035 ifeq ($(CPP_PROG_LINK),1)
1036 $(HOST_CXX) -o $@ $(HOST_CXXFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1037 else
1038 $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1039 endif # CPP_PROG_LINK
1040 endif
1041 endif
1042
1043 #
1044 # This is an attempt to support generation of multiple binaries
1045 # in one directory, it assumes everything to compile Foo is in
1046 # Foo.o (from either Foo.c or Foo.cpp).
1047 #
1048 # SIMPLE_PROGRAMS = Foo Bar
1049 # creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
1050 #
1051 $(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
1052 ifeq (WINCE,$(OS_ARCH))
1053 $(LD) -nologo -entry:main -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1054 else
1055 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
1056 $(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1057 ifdef MSMANIFEST_TOOL
1058 @if test -f $@.manifest; then \
1059 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
1060 rm -f $@.manifest; \
1061 fi
1062 endif # MSVC with manifest tool
1063 else
1064 ifeq ($(CPP_PROG_LINK),1)
1065 $(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)
1066 else
1067 $(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)
1068 endif # CPP_PROG_LINK
1069 endif # WINNT && !GNU_CC
1070 endif # WINCE
1071
1072 ifdef ENABLE_STRIP
1073 $(STRIP) $@
1074 endif
1075 ifdef MOZ_POST_PROGRAM_COMMAND
1076 $(MOZ_POST_PROGRAM_COMMAND) $@
1077 endif
1078
1079 $(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(OBJ_SUFFIX) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
1080 ifeq (WINCE,$(OS_ARCH))
1081 $(HOST_LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1082 else
1083 ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
1084 $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1085 else
1086 ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX))
1087 $(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXXFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1088 else
1089 $(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_CFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1090 endif
1091 endif
1092 endif
1093
1094 #
1095 # Purify target. Solaris/sparc only to start.
1096 # Purify does not recognize "egcs" or "c++" so we go with
1097 # "gcc" and "g++" for now.
1098 #
1099 pure: $(PROGRAM)
1100 ifeq ($(CPP_PROG_LINK),1)
1101 $(PURIFY) $(CCC) -o $^.pure $(CXXFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1102 else
1103 $(PURIFY) $(CC) -o $^.pure $(CFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1104 endif
1105 ifndef NO_DIST_INSTALL
1106 $(INSTALL) $(IFLAGS2) $^.pure $(FINAL_TARGET)
1107 endif
1108
1109 quantify: $(PROGRAM)
1110 ifeq ($(CPP_PROG_LINK),1)
1111 $(QUANTIFY) $(CCC) -o $^.quantify $(CXXFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1112 else
1113 $(QUANTIFY) $(CC) -o $^.quantify $(CFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1114 endif
1115 ifndef NO_DIST_INSTALL
1116 $(INSTALL) $(IFLAGS2) $^.quantify $(FINAL_TARGET)
1117 endif
1118
1119 #
1120 # This allows us to create static versions of the shared libraries
1121 # that are built using other static libraries. Confused...?
1122 #
1123 ifdef SHARED_LIBRARY_LIBS
1124 ifeq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
1125 ifneq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB))
1126 LOBJS += $(SHARED_LIBRARY_LIBS)
1127 endif
1128 else
1129 ifneq (,$(filter OSF1 BSD_OS FreeBSD NetBSD OpenBSD SunOS Darwin,$(OS_ARCH)))
1130 CLEANUP1 := | egrep -v '(________64ELEL_|__.SYMDEF)'
1131 CLEANUP2 := rm -f ________64ELEL_ __.SYMDEF
1132 else
1133 CLEANUP2 := true
1134 endif
1135 SUB_LOBJS = $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
1136 endif
1137 endif
1138 ifdef MOZILLA_PROBE_LIBS
1139 PROBE_LOBJS = $(shell for lib in $(MOZILLA_PROBE_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
1140 endif
1141 ifdef DTRACE_PROBE_OBJ
1142 EXTRA_DEPS += $(DTRACE_PROBE_OBJ)
1143 endif
1144
1145 $(LIBRARY): $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
1146 rm -f $@
1147 ifneq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
1148 ifdef SHARED_LIBRARY_LIBS
1149 @rm -f $(SUB_LOBJS)
1150 @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1151 endif
1152 endif
1153 $(AR) $(AR_FLAGS) $(OBJS) $(LOBJS) $(SUB_LOBJS)
1154 $(RANLIB) $@
1155 @rm -f foodummyfilefoo $(SUB_LOBJS)
1156
1157 ifeq (,$(filter-out WINNT WINCE, $(OS_ARCH)))
1158 $(IMPORT_LIBRARY): $(SHARED_LIBRARY)
1159 endif
1160
1161 ifeq ($(OS_ARCH),OS2)
1162 $(DEF_FILE): $(OBJS) $(SHARED_LIBRARY_LIBS)
1163 rm -f $@
1164 echo LIBRARY $(SHARED_LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@
1165 echo PROTMODE >> $@
1166 echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@
1167 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
1168 echo EXPORTS >> $@
1169 ifeq ($(IS_COMPONENT),1)
1170 ifeq ($(HAS_EXTRAEXPORTS),1)
1171 ifndef MOZ_OS2_USE_DECLSPEC
1172 $(FILTER) $(OBJS) $(SHARED_LIBRARY_LIBS) >> $@
1173 endif
1174 else
1175 echo _NSGetModule >> $@
1176 endif
1177 else
1178 ifndef MOZ_OS2_USE_DECLSPEC
1179 $(FILTER) $(OBJS) $(SHARED_LIBRARY_LIBS) >> $@
1180 endif
1181 endif
1182 $(ADD_TO_DEF_FILE)
1183
1184 ifdef MOZ_OS2_USE_DECLSPEC
1185 $(IMPORT_LIBRARY): $(SHARED_LIBRARY)
1186 else
1187 $(IMPORT_LIBRARY): $(DEF_FILE)
1188 endif
1189 rm -f $@
1190 $(IMPLIB) $@ $^
1191 $(RANLIB) $@
1192 endif # OS/2
1193
1194 $(HOST_LIBRARY): $(HOST_OBJS) Makefile
1195 rm -f $@
1196 $(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
1197 $(HOST_RANLIB) $@
1198
1199 ifdef NO_LD_ARCHIVE_FLAGS
1200 SUB_SHLOBJS = $(SUB_LOBJS)
1201 endif
1202
1203 ifdef HAVE_DTRACE
1204 ifndef XP_MACOSX
1205 ifdef DTRACE_PROBE_OBJ
1206 ifndef DTRACE_LIB_DEPENDENT
1207 $(DTRACE_PROBE_OBJ): $(OBJS)
1208 dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(OBJS)
1209 endif
1210 endif
1211 endif
1212 endif
1213
1214 # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
1215 # so instead of deleting .o files after repacking them into a dylib, we make
1216 # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
1217 # so no need to conditionalize on OS version or debugging format.
1218
1219 $(SHARED_LIBRARY): $(OBJS) $(LOBJS) $(DEF_FILE) $(RESFILE) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(DSO_LDOPTS_DEPS) $(GLOBAL_DEPS)
1220 ifndef INCREMENTAL_LINKER
1221 rm -f $@
1222 endif
1223 ifeq ($(OS_ARCH),OpenVMS)
1224 @if test ! -f $(VMS_SYMVEC_FILE); then \
1225 if test -f $(VMS_SYMVEC_FILE_MODULE); then \
1226 echo Creating specific component options file $(VMS_SYMVEC_FILE); \
1227 cp $(VMS_SYMVEC_FILE_MODULE) $(VMS_SYMVEC_FILE); \
1228 fi; \
1229 fi
1230 ifdef IS_COMPONENT
1231 @if test ! -f $(VMS_SYMVEC_FILE); then \
1232 echo Creating generic component options file $(VMS_SYMVEC_FILE); \
1233 cp $(VMS_SYMVEC_FILE_COMP) $(VMS_SYMVEC_FILE); \
1234 fi
1235 endif
1236 endif # OpenVMS
1237 ifdef NO_LD_ARCHIVE_FLAGS
1238 ifdef SHARED_LIBRARY_LIBS
1239 @rm -f $(SUB_SHLOBJS)
1240 @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1241 ifeq ($(OS_ARCH),Darwin)
1242 @echo Making symlinks to the original object files in the archive libraries $(SHARED_LIBRARY_LIBS)
1243 @for lib in $(SHARED_LIBRARY_LIBS); do \
1244 libdir=`echo $$lib|sed -e 's,/[^/]*\.a,,'`; \
1245 ofiles=`$(AR_LIST) $${lib}`; \
1246 for ofile in $$ofiles; do \
1247 if [ -f $$libdir/$$ofile ]; then \
1248 rm -f $$ofile; \
1249 ln -s $$libdir/$$ofile $$ofile; \
1250 fi; \
1251 done; \
1252 done
1253 endif
1254 endif # SHARED_LIBRARY_LIBS
1255 endif # NO_LD_ARCHIVE_FLAGS
1256 ifdef DTRACE_LIB_DEPENDENT
1257 @rm -f $(PROBE_LOBJS)
1258 @for lib in $(MOZILLA_PROBE_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1259 ifndef XP_MACOSX
1260 dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS)
1261 endif
1262 @for lib in $(MOZILLA_PROBE_LIBS); do \
1263 ofiles=`$(AR_LIST) $${lib}`; \
1264 $(AR_DELETE) $${lib} $$ofiles; \
1265 done
1266 $(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)
1267 @rm -f $(PROBE_LOBJS)
1268 @rm -f $(DTRACE_PROBE_OBJ)
1269 @for lib in $(MOZILLA_PROBE_LIBS); do \
1270 if [ -L $${lib} ]; then rm -f `readlink $${lib}`; fi; \
1271 done
1272 @rm -f $(MOZILLA_PROBE_LIBS)
1273
1274 else # ! DTRACE_LIB_DEPENDENT
1275 $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
1276 endif # DTRACE_LIB_DEPENDENT
1277
1278 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
1279 ifdef MSMANIFEST_TOOL
1280 ifdef EMBED_MANIFEST_AT
1281 @if test -f $@.manifest; then \
1282 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
1283 rm -f $@.manifest; \
1284 fi
1285 endif # EMBED_MANIFEST_AT
1286 endif # MSVC with manifest tool
1287 endif # WINNT && !GCC
1288 ifeq ($(OS_ARCH),Darwin)
1289 else # non-Darwin
1290 @rm -f $(SUB_SHLOBJS)
1291 endif # Darwin
1292 @rm -f foodummyfilefoo $(DELETE_AFTER_LINK)
1293 chmod +x $@
1294 ifdef ENABLE_STRIP
1295 $(STRIP) $@
1296 endif
1297 ifdef MOZ_POST_DSO_LIB_COMMAND
1298 $(MOZ_POST_DSO_LIB_COMMAND) $@
1299 endif
1300
1301 ifdef MOZ_AUTO_DEPS
1302 ifdef COMPILER_DEPEND
1303 ifeq ($(SOLARIS_SUNPRO_CC),1)
1304 _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
1305
1306 define MAKE_DEPS_AUTO_CC
1307 if test -d $(@D); then \
1308 echo "Building deps for $< using Sun Studio cc"; \
1309 $(CC) $(COMPILE_CFLAGS) -xM $< >$(_MDDEPFILE) ; \
1310 fi
1311 endef
1312 define MAKE_DEPS_AUTO_CXX
1313 if test -d $(@D); then \
1314 echo "Building deps for $< using Sun Studio CC"; \
1315 $(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \
1316 fi
1317 endef
1318 endif # Sun Studio on Solaris
1319 else # COMPILER_DEPEND
1320 #
1321 # Generate dependencies on the fly
1322 #
1323 _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
1324
1325 define MAKE_DEPS_AUTO
1326 if test -d $(@D); then \
1327 echo "Building deps for $<"; \
1328 $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f- $(DEFINES) $(ACDEFINES) $(INCLUDES) $< 2>/dev/null | sed -e "s|^[^ ]*/||" > $(_MDDEPFILE) ; \
1329 fi
1330 endef
1331
1332 MAKE_DEPS_AUTO_CC = $(MAKE_DEPS_AUTO)
1333 MAKE_DEPS_AUTO_CXX = $(MAKE_DEPS_AUTO)
1334
1335 endif # COMPILER_DEPEND
1336
1337 endif # MOZ_AUTO_DEPS
1338
1339 ifdef MOZ_MEMORY
1340 ifeq ($(OS_ARCH),SunOS)
1341 SOLARIS_JEMALLOC_LDFLAGS = $(call EXPAND_LIBNAME_PATH,jemalloc,$(DIST)/lib)
1342 endif
1343 endif
1344
1345 # Rules for building native targets must come first because of the host_ prefix
1346 host_%.$(OBJ_SUFFIX): %.c $(GLOBAL_DEPS)
1347 $(REPORT_BUILD)
1348 $(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1349
1350 host_%.$(OBJ_SUFFIX): %.cpp $(GLOBAL_DEPS)
1351 $(REPORT_BUILD)
1352 $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1353
1354 host_%.$(OBJ_SUFFIX): %.cc $(GLOBAL_DEPS)
1355 $(REPORT_BUILD)
1356 $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1357
1358 host_%.$(OBJ_SUFFIX): %.m $(GLOBAL_DEPS)
1359 $(REPORT_BUILD)
1360 $(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1361
1362 host_%.$(OBJ_SUFFIX): %.mm $(GLOBAL_DEPS)
1363 $(REPORT_BUILD)
1364 $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1365
1366 %:: %.c $(GLOBAL_DEPS)
1367 $(REPORT_BUILD)
1368 @$(MAKE_DEPS_AUTO_CC)
1369 $(ELOG) $(CC) $(CFLAGS) $(LDFLAGS) $(OUTOPTION)$@ $(_VPATH_SRCS)
1370
1371 %.$(OBJ_SUFFIX): %.c $(GLOBAL_DEPS)
1372 $(REPORT_BUILD)
1373 @$(MAKE_DEPS_AUTO_CC)
1374 $(ELOG) $(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $(_VPATH_SRCS)
1375
1376 moc_%.cpp: %.h $(GLOBAL_DEPS)
1377 $(MOC) $< $(OUTOPTION)$@
1378
1379 ifdef ASFILES
1380 # The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
1381 # a '-c' flag.
1382 %.$(OBJ_SUFFIX): %.$(ASM_SUFFIX) $(GLOBAL_DEPS)
1383 $(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) $(_VPATH_SRCS)
1384 endif
1385
1386 %.$(OBJ_SUFFIX): %.S $(GLOBAL_DEPS)
1387 $(AS) -o $@ $(ASFLAGS) -c $<
1388
1389 %:: %.cpp $(GLOBAL_DEPS)
1390 @$(MAKE_DEPS_AUTO_CXX)
1391 $(CCC) $(OUTOPTION)$@ $(CXXFLAGS) $(_VPATH_SRCS) $(LDFLAGS)
1392
1393 #
1394 # Please keep the next two rules in sync.
1395 #
1396 %.$(OBJ_SUFFIX): %.cc $(GLOBAL_DEPS)
1397 $(REPORT_BUILD)
1398 @$(MAKE_DEPS_AUTO_CXX)
1399 $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1400
1401 %.$(OBJ_SUFFIX): %.cpp $(GLOBAL_DEPS)
1402 $(REPORT_BUILD)
1403 @$(MAKE_DEPS_AUTO_CXX)
1404 ifdef STRICT_CPLUSPLUS_SUFFIX
1405 echo "#line 1 \"$*.cpp\"" | cat - $*.cpp > t_$*.cc
1406 $(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) t_$*.cc
1407 rm -f t_$*.cc
1408 else
1409 $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1410 endif #STRICT_CPLUSPLUS_SUFFIX
1411
1412 $(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.mm $(GLOBAL_DEPS)
1413 $(REPORT_BUILD)
1414 @$(MAKE_DEPS_AUTO_CXX)
1415 $(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(_VPATH_SRCS)
1416
1417 $(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.m $(GLOBAL_DEPS)
1418 $(REPORT_BUILD)
1419 @$(MAKE_DEPS_AUTO_CC)
1420 $(ELOG) $(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $(_VPATH_SRCS)
1421
1422 %.s: %.cpp
1423 $(CCC) -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1424
1425 %.s: %.cc
1426 $(CCC) -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1427
1428 %.s: %.c
1429 $(CC) -S $(COMPILE_CFLAGS) $(_VPATH_SRCS)
1430
1431 %.i: %.cpp
1432 $(CCC) -C -E $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) > $*.i
1433
1434 %.i: %.cc
1435 $(CCC) -C -E $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) > $*.i
1436
1437 %.i: %.c
1438 $(CC) -C -E $(COMPILE_CFLAGS) $(_VPATH_SRCS) > $*.i
1439
1440 %.i: %.mm
1441 $(CCC) -C -E $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(_VPATH_SRCS) > $*.i
1442
1443 %.res: %.rc
1444 @echo Creating Resource file: $@
1445 ifeq ($(OS_ARCH),OS2)
1446 $(RC) $(RCFLAGS:-D%=-d %) -i $(subst /,\,$(srcdir)) -r $< $@
1447 else
1448 ifdef GNU_CC
1449 $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) $(OUTOPTION)$@ $(_VPATH_SRCS)
1450 else
1451 $(RC) $(RCFLAGS) -r $(DEFINES) $(INCLUDES) $(OUTOPTION)$@ $(_VPATH_SRCS)
1452 endif
1453 endif
1454
1455 # need 3 separate lines for OS/2
1456 %:: %.pl
1457 rm -f $@
1458 cp $< $@
1459 chmod +x $@
1460
1461 %:: %.sh
1462 rm -f $@; cp $< $@; chmod +x $@
1463
1464 # Cancel these implicit rules
1465 #
1466 %: %,v
1467
1468 %: RCS/%,v
1469
1470 %: s.%
1471
1472 %: SCCS/s.%
1473
1474 ###############################################################################
1475 # Java rules
1476 ###############################################################################
1477 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
1478 SEP := ;
1479 else
1480 SEP := :
1481 endif
1482
1483 EMPTY :=
1484 SPACE := $(EMPTY) $(EMPTY)
1485
1486 # Cygwin and MSYS have their own special path form, but javac expects the source
1487 # and class paths to be in the DOS form (i.e. e:/builds/...). This function
1488 # does the appropriate conversion on Windows, but is a noop on other systems.
1489 ifeq (,$(filter-out WINNT WINCE, $(HOST_OS_ARCH)))
1490 ifdef CYGWIN_WRAPPER
1491 normalizepath = $(foreach p,$(1),$(shell cygpath -m $(p)))
1492 else
1493 # assume MSYS
1494 # We use 'pwd -W' to get DOS form of the path. However, since the given path
1495 # could be a file or a non-existent path, we cannot call 'pwd -W' directly
1496 # on the path. Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
1497 # on it, then merge with the rest of the path.
1498 root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\1|")
1499 non-root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\2|")
1500 normalizepath = $(foreach p,$(1),$(if $(filter /%,$(1)),$(patsubst %/,%,$(shell cd $(call root-path,$(1)) && pwd -W))/$(call non-root-path,$(1)),$(1)))
1501 endif
1502 else
1503 normalizepath = $(1)
1504 endif
1505
1506 _srcdir = $(call normalizepath,$(srcdir))
1507 ifdef JAVA_SOURCEPATH
1508 SP = $(subst $(SPACE),$(SEP),$(call normalizepath,$(strip $(JAVA_SOURCEPATH))))
1509 _JAVA_SOURCEPATH = ".$(SEP)$(_srcdir)$(SEP)$(SP)"
1510 else
1511 _JAVA_SOURCEPATH = ".$(SEP)$(_srcdir)"
1512 endif
1513
1514 ifdef JAVA_CLASSPATH
1515 CP = $(subst $(SPACE),$(SEP),$(call normalizepath,$(strip $(JAVA_CLASSPATH))))
1516 _JAVA_CLASSPATH = ".$(SEP)$(CP)"
1517 else
1518 _JAVA_CLASSPATH = .
1519 endif
1520
1521 _JAVA_DIR = _java
1522 $(_JAVA_DIR)::
1523 $(NSINSTALL) -D $@
1524
1525 $(_JAVA_DIR)/%.class: %.java $(GLOBAL_DEPS) $(_JAVA_DIR)
1526 $(CYGWIN_WRAPPER) $(JAVAC) $(JAVAC_FLAGS) -classpath $(_JAVA_CLASSPATH) \
1527 -sourcepath $(_JAVA_SOURCEPATH) -d $(_JAVA_DIR) $(_VPATH_SRCS)
1528
1529 $(JAVA_LIBRARY): $(addprefix $(_JAVA_DIR)/,$(JAVA_SRCS:.java=.class)) $(GLOBAL_DEPS)
1530 $(JAR) cf $@ -C $(_JAVA_DIR) .
1531
1532 GARBAGE_DIRS += $(_JAVA_DIR)
1533
1534 ###############################################################################
1535 # Update Makefiles
1536 ###############################################################################
1537
1538 # In GNU make 3.80, makefiles must use the /cygdrive syntax, even if we're
1539 # processing them with AS perl. See bug 232003
1540 ifdef AS_PERL
1541 CYGWIN_TOPSRCDIR = -nowrap -p $(topsrcdir) -wrap
1542 endif
1543
1544 # Note: Passing depth to make-makefile is optional.
1545 # It saves the script some work, though.
1546 Makefile: Makefile.in
1547 @$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR)
1548
1549 ifdef SUBMAKEFILES
1550 # VPATH does not work on some machines in this case, so add $(srcdir)
1551 $(SUBMAKEFILES): % : $(srcdir)/%.in
1552 $(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR) $@
1553 endif
1554
1555 ifdef AUTOUPDATE_CONFIGURE
1556 $(topsrcdir)/configure: $(topsrcdir)/configure.in
1557 (cd $(topsrcdir) && $(AUTOCONF)) && (cd $(DEPTH) && ./config.status --recheck)
1558 endif
1559
1560 ###############################################################################
1561 # Bunch of things that extend the 'export' rule (in order):
1562 ###############################################################################
1563
1564 ################################################################################
1565 # Copy each element of EXPORTS to $(DIST)/include
1566
1567 ifdef MOZ_JAVAXPCOM
1568 ifneq ($(XPIDLSRCS),)
1569 $(JAVA_DIST_DIR)::
1570 $(NSINSTALL) -D $@
1571 endif
1572 endif
1573
1574 ifneq ($(XPI_NAME),)
1575 $(FINAL_TARGET):
1576 $(NSINSTALL) -D $@
1577
1578 export:: $(FINAL_TARGET)
1579 endif
1580
1581 ifndef NO_DIST_INSTALL
1582 ifneq (,$(EXPORTS))
1583 export:: $(EXPORTS)
1584 $(INSTALL) $(IFLAGS1) $^ $(DIST)/include
1585 endif
1586 endif # NO_DIST_INSTALL
1587
1588 define EXPORT_NAMESPACE_RULE
1589 ifndef NO_DIST_INSTALL
1590 export:: $(EXPORTS_$(namespace))
1591 $(INSTALL) $(IFLAGS1) $$^ $(DIST)/include/$(namespace)
1592 endif # NO_DIST_INSTALL
1593 endef
1594
1595 $(foreach namespace,$(EXPORTS_NAMESPACES),$(eval $(EXPORT_NAMESPACE_RULE)))
1596
1597 ################################################################################
1598 # Copy each element of PREF_JS_EXPORTS
1599
1600 ifdef GRE_MODULE
1601 PREF_DIR = greprefs
1602 else
1603 ifneq (,$(XPI_NAME)$(LIBXUL_SDK))
1604 PREF_DIR = defaults/preferences
1605 else
1606 PREF_DIR = defaults/pref
1607 endif
1608 endif
1609
1610 ifneq ($(PREF_JS_EXPORTS),)
1611 # on win32, pref files need CRLF line endings... see bug 206029
1612 ifeq (WINNT,$(OS_ARCH))
1613 PREF_PPFLAGS = --line-endings=crlf
1614 endif
1615
1616 ifndef NO_DIST_INSTALL
1617 $(FINAL_TARGET)/$(PREF_DIR):
1618 $(NSINSTALL) -D $@
1619
1620 libs:: $(FINAL_TARGET)/$(PREF_DIR) $(PREF_JS_EXPORTS)
1621 $(EXIT_ON_ERROR) \
1622 for i in $(PREF_JS_EXPORTS); do \
1623 dest=$(FINAL_TARGET)/$(PREF_DIR)/`basename $$i`; \
1624 $(RM) -f $$dest; \
1625 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1626 done
1627 endif
1628 endif
1629
1630 ################################################################################
1631 # Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
1632
1633 ifneq ($(AUTOCFG_JS_EXPORTS),)
1634 $(FINAL_TARGET)/defaults/autoconfig::
1635 $(NSINSTALL) -D $@
1636
1637 ifndef NO_DIST_INSTALL
1638 export:: $(AUTOCFG_JS_EXPORTS) $(FINAL_TARGET)/defaults/autoconfig
1639 $(INSTALL) $(IFLAGS1) $^
1640 endif
1641
1642 endif
1643 ################################################################################
1644 # Export the elements of $(XPIDLSRCS)
1645 # generating .h and .xpt files and moving them to the appropriate places.
1646
1647 ifneq ($(XPIDLSRCS),)
1648
1649 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))
1650
1651 ifndef XPIDL_MODULE
1652 XPIDL_MODULE = $(MODULE)
1653 endif
1654
1655 ifeq ($(XPIDL_MODULE),) # we need $(XPIDL_MODULE) to make $(XPIDL_MODULE).xpt
1656 export:: FORCE
1657 @echo
1658 @echo "*** Error processing XPIDLSRCS:"
1659 @echo "Please define MODULE or XPIDL_MODULE when defining XPIDLSRCS,"
1660 @echo "so we have a module name to use when creating MODULE.xpt."
1661 @echo; sleep 2; false
1662 endif
1663
1664 $(IDL_DIR)::
1665 $(NSINSTALL) -D $@
1666
1667 # generate .h files from into $(XPIDL_GEN_DIR), then export to $(DIST)/include;
1668 # warn against overriding existing .h file.
1669 $(XPIDL_GEN_DIR)/.done:
1670 @if test ! -d $(XPIDL_GEN_DIR); then echo Creating $(XPIDL_GEN_DIR)/.done; rm -rf $(XPIDL_GEN_DIR); mkdir $(XPIDL_GEN_DIR); fi
1671 @touch $@
1672
1673 # don't depend on $(XPIDL_GEN_DIR), because the modification date changes
1674 # with any addition to the directory, regenerating all .h files -> everything.
1675
1676 $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
1677 $(REPORT_BUILD)
1678 $(ELOG) $(XPIDL_COMPILE) -m header -w $(XPIDL_FLAGS) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
1679 @if test -n "$(findstring $*.h, $(EXPORTS))"; \
1680 then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
1681
1682 ifndef NO_GEN_XPT
1683 # generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link
1684 # into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
1685 $(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
1686 $(REPORT_BUILD)
1687 $(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$*.pp $(_VPATH_SRCS)
1688
1689 # no need to link together if XPIDLSRCS contains only XPIDL_MODULE
1690 ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))
1691 $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS)) $(GLOBAL_DEPS) $(XPIDL_LINK)
1692 $(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS))
1693 endif # XPIDL_MODULE.xpt != XPIDLSRCS
1694
1695 libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
1696 ifndef NO_DIST_INSTALL
1697 $(INSTALL) $(IFLAGS1) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(FINAL_TARGET)/components
1698 endif
1699
1700 endif # NO_GEN_XPT
1701
1702 GARBAGE_DIRS += $(XPIDL_GEN_DIR)
1703
1704 endif # XPIDLSRCS
1705
1706 ifneq ($(XPIDLSRCS),)
1707 # export .idl files to $(IDL_DIR)
1708 ifndef NO_DIST_INSTALL
1709 export:: $(XPIDLSRCS) $(IDL_DIR)
1710 $(INSTALL) $(IFLAGS1) $^
1711
1712 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) $(DIST)/include
1713 $(INSTALL) $(IFLAGS1) $^
1714 endif # NO_DIST_INSTALL
1715
1716 endif # XPIDLSRCS
1717
1718
1719
1720 #
1721 # General rules for exporting idl files.
1722 #
1723 # WORK-AROUND ONLY, for mozilla/tools/module-deps/bootstrap.pl build.
1724 # Bug to fix idl dependency problems w/o this extra build pass is
1725 # http://bugzilla.mozilla.org/show_bug.cgi?id=145777
1726 #
1727 $(IDL_DIR)::
1728 $(NSINSTALL) -D $@
1729
1730 export-idl:: $(SUBMAKEFILES) $(MAKE_DIRS)
1731
1732 ifneq ($(XPIDLSRCS),)
1733 ifndef NO_DIST_INSTALL
1734 export-idl:: $(XPIDLSRCS) $(IDL_DIR)
1735 $(INSTALL) $(IFLAGS1) $^
1736 endif
1737 endif
1738 $(LOOP_OVER_PARALLEL_DIRS)
1739 $(LOOP_OVER_DIRS)
1740 $(LOOP_OVER_TOOL_DIRS)
1741
1742 ifdef MOZ_JAVAXPCOM
1743 ifneq ($(XPIDLSRCS),)
1744
1745 JAVA_XPIDLSRCS = $(XPIDLSRCS)
1746
1747 # A single IDL file can contain multiple interfaces, which result in multiple
1748 # Java interface files. So use hidden dependency files.
1749 JAVADEPFILES = $(addprefix $(JAVA_GEN_DIR)/.,$(JAVA_XPIDLSRCS:.idl=.java.pp))
1750
1751 $(JAVA_GEN_DIR):
1752 $(NSINSTALL) -D $@
1753 GARBAGE_DIRS += $(JAVA_GEN_DIR)
1754
1755 # generate .java files into _javagen/[package name dirs]
1756 _JAVA_GEN_DIR = $(JAVA_GEN_DIR)/$(JAVA_IFACES_PKG_NAME)
1757 $(_JAVA_GEN_DIR):
1758 $(NSINSTALL) -D $@
1759
1760 $(JAVA_GEN_DIR)/.%.java.pp: %.idl $(XPIDL_COMPILE) $(_JAVA_GEN_DIR)
1761 $(REPORT_BUILD)
1762 $(ELOG) $(XPIDL_COMPILE) -m java -w -I$(srcdir) -I$(IDL_DIR) -o $(_JAVA_GEN_DIR)/$* $(_VPATH_SRCS)
1763 @touch $@
1764
1765 # "Install" generated Java interfaces. We segregate them based on the XPI_NAME.
1766 # If XPI_NAME is not set, install into the "default" directory.
1767 ifneq ($(XPI_NAME),)
1768 JAVA_INSTALL_DIR = $(JAVA_DIST_DIR)/$(XPI_NAME)
1769 else
1770 JAVA_INSTALL_DIR = $(JAVA_DIST_DIR)/default
1771 endif
1772
1773 $(JAVA_INSTALL_DIR):
1774 $(NSINSTALL) -D $@
1775
1776 export:: $(JAVA_DIST_DIR) $(JAVADEPFILES) $(JAVA_INSTALL_DIR)
1777 (cd $(JAVA_GEN_DIR) && tar $(TAR_CREATE_FLAGS) - .) | (cd $(JAVA_INSTALL_DIR) && tar -xf -)
1778
1779 endif # XPIDLSRCS
1780 endif # MOZ_JAVAXPCOM
1781
1782 ################################################################################
1783 # Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
1784 ifdef EXTRA_COMPONENTS
1785 libs:: $(EXTRA_COMPONENTS)
1786 ifndef NO_DIST_INSTALL
1787 $(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/components
1788 @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_TARGET)/components/components.list $(notdir $^)
1789 endif
1790
1791 endif
1792
1793 ifdef EXTRA_PP_COMPONENTS
1794 libs:: $(EXTRA_PP_COMPONENTS)
1795 ifndef NO_DIST_INSTALL
1796 $(EXIT_ON_ERROR) \
1797 $(NSINSTALL) -D $(FINAL_TARGET)/components; \
1798 for i in $^; do \
1799 fname=`basename $$i`; \
1800 dest=$(FINAL_TARGET)/components/$${fname}; \
1801 $(RM) -f $$dest; \
1802 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1803 $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_TARGET)/components/components.list $$fname; \
1804 done
1805 endif
1806
1807 endif
1808
1809 ################################################################################
1810 # Copy each element of EXTRA_JS_MODULES to $(FINAL_TARGET)/modules
1811 ifdef EXTRA_JS_MODULES
1812 libs:: $(EXTRA_JS_MODULES)
1813 ifndef NO_DIST_INSTALL
1814 $(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/modules
1815 endif
1816
1817 endif
1818
1819 ifdef EXTRA_PP_JS_MODULES
1820 libs:: $(EXTRA_PP_JS_MODULES)
1821 ifndef NO_DIST_INSTALL
1822 $(EXIT_ON_ERROR) \
1823 $(NSINSTALL) -D $(FINAL_TARGET)/modules; \
1824 for i in $^; do \
1825 dest=$(FINAL_TARGET)/modules/`basename $$i`; \
1826 $(RM) -f $$dest; \
1827 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1828 done
1829 endif
1830
1831 endif
1832
1833 ################################################################################
1834 # SDK
1835
1836 ifneq (,$(SDK_LIBRARY))
1837 $(SDK_LIB_DIR)::
1838 $(NSINSTALL) -D $@
1839
1840 ifndef NO_DIST_INSTALL
1841 libs:: $(SDK_LIBRARY) $(SDK_LIB_DIR)
1842 $(INSTALL) $(IFLAGS2) $^
1843 endif
1844
1845 endif # SDK_LIBRARY
1846
1847 ifneq (,$(SDK_BINARY))
1848 $(SDK_BIN_DIR)::
1849 $(NSINSTALL) -D $@
1850
1851 ifndef NO_DIST_INSTALL
1852 libs:: $(SDK_BINARY) $(SDK_BIN_DIR)
1853 $(INSTALL) $(IFLAGS2) $^
1854 endif
1855
1856 endif # SDK_BINARY
1857
1858 ################################################################################
1859 # CHROME PACKAGING
1860
1861 JAR_MANIFEST := $(srcdir)/jar.mn
1862
1863 chrome::
1864 $(MAKE) realchrome
1865 $(LOOP_OVER_PARALLEL_DIRS)
1866 $(LOOP_OVER_DIRS)
1867 $(LOOP_OVER_TOOL_DIRS)
1868
1869 $(FINAL_TARGET)/chrome:
1870 $(NSINSTALL) -D $@
1871
1872 libs realchrome:: $(CHROME_DEPS) $(FINAL_TARGET)/chrome
1873 ifneq (,$(wildcard $(JAR_MANIFEST)))
1874 ifndef NO_DIST_INSTALL
1875 $(PYTHON) $(MOZILLA_DIR)/config/JarMaker.py \
1876 $(QUIET) -j $(FINAL_TARGET)/chrome \
1877 $(MAKE_JARS_FLAGS) $(XULPPFLAGS) $(DEFINES) $(ACDEFINES) \
1878 $(JAR_MANIFEST)
1879 endif
1880 endif
1881
1882 ifneq ($(DIST_FILES),)
1883 $(DIST)/bin:
1884 $(NSINSTALL) -D $@
1885
1886 libs:: $(DIST_FILES) $(DIST)/bin
1887 @$(EXIT_ON_ERROR) \
1888 for f in $(DIST_FILES); do \
1889 dest=$(FINAL_TARGET)/`basename $$f`; \
1890 $(RM) -f $$dest; \
1891 $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
1892 $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
1893 $(srcdir)/$$f > $$dest; \
1894 done
1895 endif
1896
1897 ifneq ($(DIST_CHROME_FILES),)
1898 libs:: $(DIST_CHROME_FILES)
1899 @$(EXIT_ON_ERROR) \
1900 for f in $(DIST_CHROME_FILES); do \
1901 dest=$(FINAL_TARGET)/chrome/`basename $$f`; \
1902 $(RM) -f $$dest; \
1903 $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
1904 $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
1905 $(srcdir)/$$f > $$dest; \
1906 done
1907 endif
1908
1909 ifneq ($(XPI_PKGNAME),)
1910 libs realchrome::
1911 ifdef STRIP_XPI
1912 ifndef MOZ_DEBUG
1913 @echo "Stripping $(XPI_PKGNAME) package directory..."
1914 @echo $(FINAL_TARGET)
1915 @cd $(FINAL_TARGET) && find . ! -type d \
1916 ! -name "*.js" \
1917 ! -name "*.xpt" \
1918 ! -name "*.gif" \
1919 ! -name "*.jpg" \
1920 ! -name "*.png" \
1921 ! -name "*.xpm" \
1922 ! -name "*.txt" \
1923 ! -name "*.rdf" \
1924 ! -name "*.sh" \
1925 ! -name "*.properties" \
1926 ! -name "*.dtd" \
1927 ! -name "*.html" \
1928 ! -name "*.xul" \
1929 ! -name "*.css" \
1930 ! -name "*.xml" \
1931 ! -name "*.jar" \
1932 ! -name "*.dat" \
1933 ! -name "*.tbl" \
1934 ! -name "*.src" \
1935 ! -name "*.reg" \
1936 $(PLATFORM_EXCLUDE_LIST) \
1937 -exec $(STRIP) $(STRIP_FLAGS) {} >/dev/null 2>&1 \;
1938 endif
1939 endif
1940 @echo "Packaging $(XPI_PKGNAME).xpi..."
1941 cd $(FINAL_TARGET) && $(ZIP) -qr ../$(XPI_PKGNAME).xpi *
1942 endif
1943
1944 ifdef INSTALL_EXTENSION_ID
1945 ifndef XPI_NAME
1946 $(error XPI_NAME must be set for INSTALL_EXTENSION_ID)
1947 endif
1948
1949 libs::
1950 $(RM) -rf "$(DIST)/bin/extensions/$(INSTALL_EXTENSION_ID)"
1951 $(NSINSTALL) -D "$(DIST)/bin/extensions/$(INSTALL_EXTENSION_ID)"
1952 cd $(FINAL_TARGET) && tar $(TAR_CREATE_FLAGS) - . | (cd "../../bin/extensions/$(INSTALL_EXTENSION_ID)" && tar -xf -)
1953
1954 endif
1955
1956 ifneq (,$(filter flat symlink,$(MOZ_CHROME_FILE_FORMAT)))
1957 _JAR_REGCHROME_DISABLE_JAR=1
1958 else
1959 _JAR_REGCHROME_DISABLE_JAR=0
1960 endif
1961
1962 REGCHROME = $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/add-chrome.pl \
1963 $(if $(filter gtk2,$(MOZ_WIDGET_TOOLKIT)),-x) \
1964 $(if $(CROSS_COMPILE),-o $(OS_ARCH)) $(FINAL_TARGET)/chrome/installed-chrome.txt \
1965 $(_JAR_REGCHROME_DISABLE_JAR)
1966
1967 REGCHROME_INSTALL = $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/add-chrome.pl \
1968 $(if $(filter gtk2,$(MOZ_WIDGET_TOOLKIT)),-x) \
1969 $(if $(CROSS_COMPILE),-o $(OS_ARCH)) $(DESTDIR)$(mozappdir)/chrome/installed-chrome.txt \
1970 $(_JAR_REGCHROME_DISABLE_JAR)
1971
1972
1973 #############################################################################
1974 # Dependency system
1975 #############################################################################
1976 ifdef COMPILER_DEPEND
1977 depend::
1978 @echo "$(MAKE): No need to run depend target.\
1979 Using compiler-based depend." 1>&2
1980 ifeq ($(GNU_CC)$(GNU_CXX),)
1981 # Non-GNU compilers
1982 @echo "`echo '$(MAKE):'|sed 's/./ /g'`"\
1983 '(Compiler-based depend was turned on by "--enable-md".)' 1>&2
1984 else
1985 # GNU compilers
1986 @space="`echo '$(MAKE): '|sed 's/./ /g'`";\
1987 echo "$$space"'Since you are using a GNU compiler,\
1988 it is on by default.' 1>&2; \
1989 echo "$$space"'To turn it off, pass --disable-md to configure.' 1>&2
1990 endif
1991
1992 else # ! COMPILER_DEPEND
1993
1994 ifndef MOZ_AUTO_DEPS
1995
1996 define MAKE_DEPS_NOAUTO
1997 $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f- $(DEFINES) $(ACDEFINES) $(INCLUDES) $< 2>/dev/null | sed -e "s|^[^ ]*/||" > $@
1998 endef
1999
2000 $(MDDEPDIR)/%.pp: %.c
2001 $(REPORT_BUILD)
2002 @$(MAKE_DEPS_NOAUTO)
2003
2004 $(MDDEPDIR)/%.pp: %.cpp
2005 $(REPORT_BUILD)
2006 @$(MAKE_DEPS_NOAUTO)
2007
2008 $(MDDEPDIR)/%.pp: %.s
2009 $(REPORT_BUILD)
2010 @$(MAKE_DEPS_NOAUTO)
2011
2012 ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS))
2013 depend:: $(SUBMAKEFILES) $(MAKE_DIRS) $(MDDEPFILES)
2014 else
2015 depend:: $(SUBMAKEFILES)
2016 endif
2017 $(LOOP_OVER_PARALLEL_DIRS)
2018 $(LOOP_OVER_DIRS)
2019 $(LOOP_OVER_TOOL_DIRS)
2020
2021 dependclean:: $(SUBMAKEFILES)
2022 rm -f $(MDDEPFILES)
2023 $(LOOP_OVER_PARALLEL_DIRS)
2024 $(LOOP_OVER_DIRS)
2025 $(LOOP_OVER_TOOL_DIRS)
2026
2027 endif # MOZ_AUTO_DEPS
2028
2029 endif # COMPILER_DEPEND
2030
2031
2032 #############################################################################
2033 # MDDEPDIR is the subdirectory where all the dependency files are placed.
2034 # This uses a make rule (instead of a macro) to support parallel
2035 # builds (-jN). If this were done in the LOOP_OVER_DIRS macro, two
2036 # processes could simultaneously try to create the same directory.
2037 #
2038 # We use $(CURDIR) in the rule's target to ensure that we don't find
2039 # a dependency directory in the source tree via VPATH (perhaps from
2040 # a previous build in the source tree) and thus neglect to create a
2041 # dependency directory in the object directory, where we really need
2042 # it.
2043
2044 $(CURDIR)/$(MDDEPDIR):
2045 @if test ! -d $@; then echo Creating $@; rm -rf $@; mkdir $@; else true; fi
2046
2047 ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))
2048 ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS))
2049 MDDEPEND_FILES := $(strip $(wildcard $(MDDEPDIR)/*.pp))
2050
2051 ifneq (,$(MDDEPEND_FILES))
2052 ifdef PERL
2053 # The script mddepend.pl checks the dependencies and writes to stdout
2054 # one rule to force out-of-date objects. For example,
2055 # foo.o boo.o: FORCE
2056 # The script has an advantage over including the *.pp files directly
2057 # because it handles the case when header files are removed from the build.
2058 # 'make' would complain that there is no way to build missing headers.
2059 ifeq (,$(MAKE_RESTARTS))
2060 $(MDDEPDIR)/.all.pp: FORCE
2061 @$(PERL) $(BUILD_TOOLS)/mddepend.pl $@ $(MDDEPEND_FILES)
2062 endif
2063 -include $(MDDEPDIR)/.all.pp
2064 else
2065 include $(MDDEPEND_FILES)
2066 endif
2067 endif
2068
2069 endif
2070 endif
2071 #############################################################################
2072
2073 -include $(topsrcdir)/$(MOZ_BUILD_APP)/app-rules.mk
2074 -include $(MY_RULES)
2075
2076 #
2077 # This speeds up gmake's processing if these files don't exist.
2078 #
2079 $(MY_CONFIG) $(MY_RULES):
2080 @touch $@
2081
2082 #
2083 # Generate Emacs tags in a file named TAGS if ETAGS was set in $(MY_CONFIG)
2084 # or in $(MY_RULES)
2085 #
2086 ifdef ETAGS
2087 ifneq ($(CSRCS)$(CPPSRCS)$(HEADERS),)
2088 all:: TAGS
2089 TAGS:: $(CSRCS) $(CPPSRCS) $(HEADERS)
2090 $(ETAGS) $(CSRCS) $(CPPSRCS) $(HEADERS)
2091 endif
2092 endif
2093
2094 ################################################################################
2095 # Special gmake rules.
2096 ################################################################################
2097
2098
2099 #
2100 # Disallow parallel builds with MSVC < 8
2101 #
2102 ifneq (,$(filter 1200 1300 1310,$(_MSC_VER)))
2103 .NOTPARALLEL:
2104 endif
2105
2106 #
2107 # Re-define the list of default suffixes, so gmake won't have to churn through
2108 # hundreds of built-in suffix rules for stuff we don't need.
2109 #
2110 .SUFFIXES:
2111
2112 #
2113 # Fake targets. Always run these rules, even if a file/directory with that
2114 # name already exists.
2115 #
2116 .PHONY: all alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_apprunner tools $(DIRS) $(TOOL_DIRS) FORCE
2117
2118 # Used as a dependency to force targets to rebuild
2119 FORCE:
2120
2121 # Delete target if error occurs when building target
2122 .DELETE_ON_ERROR:
2123
2124 # Properly set LIBPATTERNS for the platform
2125 .LIBPATTERNS = $(if $(IMPORT_LIB_SUFFIX),$(LIB_PREFIX)%.$(IMPORT_LIB_SUFFIX)) $(LIB_PREFIX)%.$(LIB_SUFFIX) $(DLL_PREFIX)%$(DLL_SUFFIX)
2126
2127 tags: TAGS
2128
2129 TAGS: $(SUBMAKEFILES) $(CSRCS) $(CPPSRCS) $(wildcard *.h)
2130 -etags $(CSRCS) $(CPPSRCS) $(wildcard *.h)
2131 $(LOOP_OVER_PARALLEL_DIRS)
2132 $(LOOP_OVER_DIRS)
2133
2134 echo-variable-%:
2135 @echo "$($*)"
2136
2137 echo-tiers:
2138 @echo $(TIERS)
2139
2140 echo-tier-dirs:
2141 @$(foreach tier,$(TIERS),echo '$(tier):'; echo ' dirs: $(tier_$(tier)_dirs)'; echo ' staticdirs: $(tier_$(tier)_staticdirs)'; )
2142
2143 echo-dirs:
2144 @echo $(DIRS)
2145
2146 echo-module:
2147 @echo $(MODULE)
2148
2149 echo-requires:
2150 @echo $(REQUIRES)
2151
2152 echo-requires-recursive::
2153 ifdef _REPORT_ALL_DIRS
2154 @echo $(subst $(topsrcdir)/,,$(srcdir)): $(MODULE): $(REQUIRES)
2155 else
2156 @$(if $(REQUIRES),echo $(subst $(topsrcdir)/,,$(srcdir)): $(MODULE): $(REQUIRES))
2157 endif
2158 $(LOOP_OVER_PARALLEL_DIRS)
2159 $(LOOP_OVER_DIRS)
2160
2161 echo-depth-path:
2162 @$(topsrcdir)/build/unix/print-depth-path.sh
2163
2164 echo-module-name:
2165 @$(topsrcdir)/build/package/rpm/print-module-name.sh
2166
2167 echo-module-filelist:
2168 @$(topsrcdir)/build/package/rpm/print-module-filelist.sh
2169
2170 showtargs:
2171 ifneq (,$(filter $(PROGRAM) $(HOST_PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS)))
2172 @echo --------------------------------------------------------------------------------
2173 @echo "PROGRAM = $(PROGRAM)"
2174 @echo "SIMPLE_PROGRAMS = $(SIMPLE_PROGRAMS)"
2175 @echo "LIBRARY = $(LIBRARY)"
2176 @echo "SHARED_LIBRARY = $(SHARED_LIBRARY)"
2177 @echo "SHARED_LIBRARY_LIBS = $(SHARED_LIBRARY_LIBS)"
2178 @echo "LIBS = $(LIBS)"
2179 @echo "DEF_FILE = $(DEF_FILE)"
2180 @echo "IMPORT_LIBRARY = $(IMPORT_LIBRARY)"
2181 @echo "STATIC_LIBS = $(STATIC_LIBS)"
2182 @echo "SHARED_LIBS = $(SHARED_LIBS)"
2183 @echo "EXTRA_DSO_LIBS = $(EXTRA_DSO_LIBS)"
2184 @echo "EXTRA_DSO_LDOPTS = $(EXTRA_DSO_LDOPTS)"
2185 @echo "DEPENDENT_LIBS = $(DEPENDENT_LIBS)"
2186 @echo --------------------------------------------------------------------------------
2187 endif
2188 $(LOOP_OVER_PARALLEL_DIRS)
2189 $(LOOP_OVER_DIRS)
2190
2191 showbuild:
2192 @echo "MOZ_BUILD_ROOT = $(MOZ_BUILD_ROOT)"
2193 @echo "MOZ_WIDGET_TOOLKIT = $(MOZ_WIDGET_TOOLKIT)"
2194 @echo "CC = $(CC)"
2195 @echo "CXX = $(CXX)"
2196 @echo "CCC = $(CCC)"
2197 @echo "CPP = $(CPP)"
2198 @echo "LD = $(LD)"
2199 @echo "AR = $(AR)"
2200 @echo "IMPLIB = $(IMPLIB)"
2201 @echo "FILTER = $(FILTER)"
2202 @echo "MKSHLIB = $(MKSHLIB)"
2203 @echo "MKCSHLIB = $(MKCSHLIB)"
2204 @echo "RC = $(RC)"
2205 @echo "CFLAGS = $(CFLAGS)"
2206 @echo "OS_CFLAGS = $(OS_CFLAGS)"
2207 @echo "COMPILE_CFLAGS = $(COMPILE_CFLAGS)"
2208 @echo "CXXFLAGS = $(CXXFLAGS)"
2209 @echo "OS_CXXFLAGS = $(OS_CXXFLAGS)"
2210 @echo "COMPILE_CXXFLAGS = $(COMPILE_CXXFLAGS)"
2211 @echo "COMPILE_CMFLAGS = $(COMPILE_CMFLAGS)"
2212 @echo "COMPILE_CMMFLAGS = $(COMPILE_CMMFLAGS)"
2213 @echo "LDFLAGS = $(LDFLAGS)"
2214 @echo "OS_LDFLAGS = $(OS_LDFLAGS)"
2215 @echo "DSO_LDOPTS = $(DSO_LDOPTS)"
2216 @echo "OS_INCLUDES = $(OS_INCLUDES)"
2217 @echo "OS_LIBS = $(OS_LIBS)"
2218 @echo "EXTRA_LIBS = $(EXTRA_LIBS)"
2219 @echo "BIN_FLAGS = $(BIN_FLAGS)"
2220 @echo "INCLUDES = $(INCLUDES)"
2221 @echo "DEFINES = $(DEFINES)"
2222 @echo "ACDEFINES = $(ACDEFINES)"
2223 @echo "BIN_SUFFIX = $(BIN_SUFFIX)"
2224 @echo "LIB_SUFFIX = $(LIB_SUFFIX)"
2225 @echo "DLL_SUFFIX = $(DLL_SUFFIX)"
2226 @echo "IMPORT_LIB_SUFFIX = $(IMPORT_LIB_SUFFIX)"
2227 @echo "INSTALL = $(INSTALL)"
2228
2229 showhost:
2230 @echo "HOST_CC = $(HOST_CC)"
2231 @echo "HOST_CXX = $(HOST_CXX)"
2232 @echo "HOST_CFLAGS = $(HOST_CFLAGS)"
2233 @echo "HOST_LDFLAGS = $(HOST_LDFLAGS)"
2234 @echo "HOST_LIBS = $(HOST_LIBS)"
2235 @echo "HOST_EXTRA_LIBS = $(HOST_EXTRA_LIBS)"
2236 @echo "HOST_EXTRA_DEPS = $(HOST_EXTRA_DEPS)"
2237 @echo "HOST_PROGRAM = $(HOST_PROGRAM)"
2238 @echo "HOST_OBJS = $(HOST_OBJS)"
2239 @echo "HOST_PROGOBJS = $(HOST_PROGOBJS)"
2240 @echo "HOST_LIBRARY = $(HOST_LIBRARY)"
2241
2242 showbuildmods::
2243 @echo "Build Modules = $(BUILD_MODULES)"
2244 @echo "Module dirs = $(BUILD_MODULE_DIRS)"
2245
2246 documentation:
2247 @cd $(DEPTH)
2248 $(DOXYGEN) $(DEPTH)/config/doxygen.cfg
2249
2250 ifdef ENABLE_TESTS
2251 check:: $(SUBMAKEFILES) $(MAKE_DIRS)
2252 $(LOOP_OVER_PARALLEL_DIRS)
2253 $(LOOP_OVER_DIRS)
2254 $(LOOP_OVER_TOOL_DIRS)
2255 endif
2256
2257
2258 FREEZE_VARIABLES = \
2259 CSRCS \
2260 CPPSRCS \
2261 EXPORTS \
2262 XPIDLSRCS \
2263 DIRS \
2264 LIBRARY \
2265 MODULE \
2266 REQUIRES \
2267 SHORT_LIBNAME \
2268 TIERS \
2269 $(NULL)
2270
2271 $(foreach var,$(FREEZE_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))
2272
2273 CHECK_FROZEN_VARIABLES = $(foreach var,$(FREEZE_VARIABLES), \
2274 $(if $(subst $($(var)_FROZEN),,'$($(var))'),$(error Makefile variable '$(var)' changed value after including rules.mk. Was $($(var)_FROZEN), now $($(var)).)))
2275
2276 libs export libs::
2277 $(CHECK_FROZEN_VARIABLES)

  ViewVC Help
Powered by ViewVC 1.1.24