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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 507 - (show annotations)
Sun Jan 10 07:23:34 2010 UTC (9 years, 9 months ago) by siliconforks
File size: 66235 byte(s)
Update SpiderMonkey from Firefox 3.6rc1.

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 ifeq (WINCE,$(OS_ARCH))
977 $(LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
978 else
979 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
980 $(LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
981 ifdef MSMANIFEST_TOOL
982 @if test -f $@.manifest; then \
983 if test -f "$(srcdir)/$@.manifest"; then \
984 mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
985 else \
986 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
987 fi; \
988 rm -f $@.manifest; \
989 fi
990 endif # MSVC with manifest tool
991 else
992 ifeq ($(CPP_PROG_LINK),1)
993 $(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)
994 else # ! CPP_PROG_LINK
995 $(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
996 endif # CPP_PROG_LINK
997 endif # WINNT && !GNU_CC
998 endif # WINCE
999
1000 ifdef ENABLE_STRIP
1001 $(STRIP) $@
1002 endif
1003 ifdef MOZ_POST_PROGRAM_COMMAND
1004 $(MOZ_POST_PROGRAM_COMMAND) $@
1005 endif
1006 ifeq ($(OS_ARCH),BeOS)
1007 ifdef BEOS_PROGRAM_RESOURCE
1008 xres -o $@ $(BEOS_PROGRAM_RESOURCE)
1009 mimeset $@
1010 endif
1011 endif # BeOS
1012
1013 $(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
1014 ifeq (WINCE,$(OS_ARCH))
1015 $(HOST_LD) -NOLOGO -OUT:$@ $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1016 else
1017 ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
1018 $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1019 ifdef MSMANIFEST_TOOL
1020 @if test -f $@.manifest; then \
1021 if test -f "$(srcdir)/$@.manifest"; then \
1022 mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
1023 else \
1024 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
1025 fi; \
1026 rm -f $@.manifest; \
1027 fi
1028 endif # MSVC with manifest tool
1029 else
1030 ifeq ($(CPP_PROG_LINK),1)
1031 $(HOST_CXX) -o $@ $(HOST_CXXFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1032 else
1033 $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1034 endif # CPP_PROG_LINK
1035 endif
1036 endif
1037
1038 #
1039 # This is an attempt to support generation of multiple binaries
1040 # in one directory, it assumes everything to compile Foo is in
1041 # Foo.o (from either Foo.c or Foo.cpp).
1042 #
1043 # SIMPLE_PROGRAMS = Foo Bar
1044 # creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
1045 #
1046 $(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
1047 ifeq (WINCE,$(OS_ARCH))
1048 $(LD) -nologo -entry:main -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1049 else
1050 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
1051 $(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
1052 ifdef MSMANIFEST_TOOL
1053 @if test -f $@.manifest; then \
1054 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
1055 rm -f $@.manifest; \
1056 fi
1057 endif # MSVC with manifest tool
1058 else
1059 ifeq ($(CPP_PROG_LINK),1)
1060 $(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)
1061 else
1062 $(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)
1063 endif # CPP_PROG_LINK
1064 endif # WINNT && !GNU_CC
1065 endif # WINCE
1066
1067 ifdef ENABLE_STRIP
1068 $(STRIP) $@
1069 endif
1070 ifdef MOZ_POST_PROGRAM_COMMAND
1071 $(MOZ_POST_PROGRAM_COMMAND) $@
1072 endif
1073
1074 $(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(OBJ_SUFFIX) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
1075 ifeq (WINCE,$(OS_ARCH))
1076 $(HOST_LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1077 else
1078 ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
1079 $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1080 else
1081 ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX))
1082 $(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXXFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1083 else
1084 $(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_CFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1085 endif
1086 endif
1087 endif
1088
1089 #
1090 # Purify target. Solaris/sparc only to start.
1091 # Purify does not recognize "egcs" or "c++" so we go with
1092 # "gcc" and "g++" for now.
1093 #
1094 pure: $(PROGRAM)
1095 ifeq ($(CPP_PROG_LINK),1)
1096 $(PURIFY) $(CCC) -o $^.pure $(CXXFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1097 else
1098 $(PURIFY) $(CC) -o $^.pure $(CFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1099 endif
1100 ifndef NO_DIST_INSTALL
1101 $(INSTALL) $(IFLAGS2) $^.pure $(FINAL_TARGET)
1102 endif
1103
1104 quantify: $(PROGRAM)
1105 ifeq ($(CPP_PROG_LINK),1)
1106 $(QUANTIFY) $(CCC) -o $^.quantify $(CXXFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1107 else
1108 $(QUANTIFY) $(CC) -o $^.quantify $(CFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1109 endif
1110 ifndef NO_DIST_INSTALL
1111 $(INSTALL) $(IFLAGS2) $^.quantify $(FINAL_TARGET)
1112 endif
1113
1114 #
1115 # This allows us to create static versions of the shared libraries
1116 # that are built using other static libraries. Confused...?
1117 #
1118 ifdef SHARED_LIBRARY_LIBS
1119 ifeq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
1120 ifneq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB))
1121 LOBJS += $(SHARED_LIBRARY_LIBS)
1122 endif
1123 else
1124 ifneq (,$(filter OSF1 BSD_OS FreeBSD NetBSD OpenBSD SunOS Darwin,$(OS_ARCH)))
1125 CLEANUP1 := | egrep -v '(________64ELEL_|__.SYMDEF)'
1126 CLEANUP2 := rm -f ________64ELEL_ __.SYMDEF
1127 else
1128 CLEANUP2 := true
1129 endif
1130 SUB_LOBJS = $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
1131 endif
1132 endif
1133 ifdef MOZILLA_PROBE_LIBS
1134 PROBE_LOBJS = $(shell for lib in $(MOZILLA_PROBE_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
1135 endif
1136 ifdef DTRACE_PROBE_OBJ
1137 EXTRA_DEPS += $(DTRACE_PROBE_OBJ)
1138 endif
1139
1140 $(LIBRARY): $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
1141 rm -f $@
1142 ifneq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
1143 ifdef SHARED_LIBRARY_LIBS
1144 @rm -f $(SUB_LOBJS)
1145 @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1146 endif
1147 endif
1148 $(AR) $(AR_FLAGS) $(OBJS) $(LOBJS) $(SUB_LOBJS)
1149 $(RANLIB) $@
1150 @rm -f foodummyfilefoo $(SUB_LOBJS)
1151
1152 ifeq (,$(filter-out WINNT WINCE, $(OS_ARCH)))
1153 $(IMPORT_LIBRARY): $(SHARED_LIBRARY)
1154 endif
1155
1156 ifeq ($(OS_ARCH),OS2)
1157 $(DEF_FILE): $(OBJS) $(SHARED_LIBRARY_LIBS)
1158 rm -f $@
1159 echo LIBRARY $(SHARED_LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@
1160 echo PROTMODE >> $@
1161 echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@
1162 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
1163 echo EXPORTS >> $@
1164 ifeq ($(IS_COMPONENT),1)
1165 ifeq ($(HAS_EXTRAEXPORTS),1)
1166 ifndef MOZ_OS2_USE_DECLSPEC
1167 $(FILTER) $(OBJS) $(SHARED_LIBRARY_LIBS) >> $@
1168 endif
1169 else
1170 echo _NSGetModule >> $@
1171 endif
1172 else
1173 ifndef MOZ_OS2_USE_DECLSPEC
1174 $(FILTER) $(OBJS) $(SHARED_LIBRARY_LIBS) >> $@
1175 endif
1176 endif
1177 $(ADD_TO_DEF_FILE)
1178
1179 ifdef MOZ_OS2_USE_DECLSPEC
1180 $(IMPORT_LIBRARY): $(SHARED_LIBRARY)
1181 else
1182 $(IMPORT_LIBRARY): $(DEF_FILE)
1183 endif
1184 rm -f $@
1185 $(IMPLIB) $@ $^
1186 $(RANLIB) $@
1187 endif # OS/2
1188
1189 $(HOST_LIBRARY): $(HOST_OBJS) Makefile
1190 rm -f $@
1191 $(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
1192 $(HOST_RANLIB) $@
1193
1194 ifdef NO_LD_ARCHIVE_FLAGS
1195 SUB_SHLOBJS = $(SUB_LOBJS)
1196 endif
1197
1198 ifdef HAVE_DTRACE
1199 ifndef XP_MACOSX
1200 ifdef DTRACE_PROBE_OBJ
1201 ifndef DTRACE_LIB_DEPENDENT
1202 $(DTRACE_PROBE_OBJ): $(OBJS)
1203 dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(OBJS)
1204 endif
1205 endif
1206 endif
1207 endif
1208
1209 # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
1210 # so instead of deleting .o files after repacking them into a dylib, we make
1211 # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
1212 # so no need to conditionalize on OS version or debugging format.
1213
1214 $(SHARED_LIBRARY): $(OBJS) $(LOBJS) $(DEF_FILE) $(RESFILE) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(DSO_LDOPTS_DEPS) $(GLOBAL_DEPS)
1215 ifndef INCREMENTAL_LINKER
1216 rm -f $@
1217 endif
1218 ifeq ($(OS_ARCH),OpenVMS)
1219 @if test ! -f $(VMS_SYMVEC_FILE); then \
1220 if test -f $(VMS_SYMVEC_FILE_MODULE); then \
1221 echo Creating specific component options file $(VMS_SYMVEC_FILE); \
1222 cp $(VMS_SYMVEC_FILE_MODULE) $(VMS_SYMVEC_FILE); \
1223 fi; \
1224 fi
1225 ifdef IS_COMPONENT
1226 @if test ! -f $(VMS_SYMVEC_FILE); then \
1227 echo Creating generic component options file $(VMS_SYMVEC_FILE); \
1228 cp $(VMS_SYMVEC_FILE_COMP) $(VMS_SYMVEC_FILE); \
1229 fi
1230 endif
1231 endif # OpenVMS
1232 ifdef NO_LD_ARCHIVE_FLAGS
1233 ifdef SHARED_LIBRARY_LIBS
1234 @rm -f $(SUB_SHLOBJS)
1235 @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1236 ifeq ($(OS_ARCH),Darwin)
1237 @echo Making symlinks to the original object files in the archive libraries $(SHARED_LIBRARY_LIBS)
1238 @for lib in $(SHARED_LIBRARY_LIBS); do \
1239 libdir=`echo $$lib|sed -e 's,/[^/]*\.a,,'`; \
1240 ofiles=`$(AR_LIST) $${lib}`; \
1241 for ofile in $$ofiles; do \
1242 if [ -f $$libdir/$$ofile ]; then \
1243 rm -f $$ofile; \
1244 ln -s $$libdir/$$ofile $$ofile; \
1245 fi; \
1246 done; \
1247 done
1248 endif
1249 endif # SHARED_LIBRARY_LIBS
1250 endif # NO_LD_ARCHIVE_FLAGS
1251 ifdef DTRACE_LIB_DEPENDENT
1252 @rm -f $(PROBE_LOBJS)
1253 @for lib in $(MOZILLA_PROBE_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1254 ifndef XP_MACOSX
1255 dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS)
1256 endif
1257 @for lib in $(MOZILLA_PROBE_LIBS); do \
1258 ofiles=`$(AR_LIST) $${lib}`; \
1259 $(AR_DELETE) $${lib} $$ofiles; \
1260 done
1261 $(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)
1262 @rm -f $(PROBE_LOBJS)
1263 @rm -f $(DTRACE_PROBE_OBJ)
1264 @for lib in $(MOZILLA_PROBE_LIBS); do \
1265 if [ -L $${lib} ]; then rm -f `readlink $${lib}`; fi; \
1266 done
1267 @rm -f $(MOZILLA_PROBE_LIBS)
1268
1269 else # ! DTRACE_LIB_DEPENDENT
1270 $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
1271 endif # DTRACE_LIB_DEPENDENT
1272
1273 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
1274 ifdef MSMANIFEST_TOOL
1275 ifdef EMBED_MANIFEST_AT
1276 @if test -f $@.manifest; then \
1277 mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
1278 rm -f $@.manifest; \
1279 fi
1280 endif # EMBED_MANIFEST_AT
1281 endif # MSVC with manifest tool
1282 endif # WINNT && !GCC
1283 ifeq ($(OS_ARCH),Darwin)
1284 else # non-Darwin
1285 @rm -f $(SUB_SHLOBJS)
1286 endif # Darwin
1287 @rm -f foodummyfilefoo $(DELETE_AFTER_LINK)
1288 chmod +x $@
1289 ifdef ENABLE_STRIP
1290 $(STRIP) $@
1291 endif
1292 ifdef MOZ_POST_DSO_LIB_COMMAND
1293 $(MOZ_POST_DSO_LIB_COMMAND) $@
1294 endif
1295
1296 ifdef MOZ_AUTO_DEPS
1297 ifdef COMPILER_DEPEND
1298 ifeq ($(SOLARIS_SUNPRO_CC),1)
1299 _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
1300
1301 define MAKE_DEPS_AUTO_CC
1302 if test -d $(@D); then \
1303 echo "Building deps for $< using Sun Studio cc"; \
1304 $(CC) $(COMPILE_CFLAGS) -xM $< >$(_MDDEPFILE) ; \
1305 fi
1306 endef
1307 define MAKE_DEPS_AUTO_CXX
1308 if test -d $(@D); then \
1309 echo "Building deps for $< using Sun Studio CC"; \
1310 $(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \
1311 fi
1312 endef
1313 endif # Sun Studio on Solaris
1314 else # COMPILER_DEPEND
1315 #
1316 # Generate dependencies on the fly
1317 #
1318 _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
1319
1320 define MAKE_DEPS_AUTO
1321 if test -d $(@D); then \
1322 echo "Building deps for $<"; \
1323 $(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f- $(DEFINES) $(ACDEFINES) $(INCLUDES) $< 2>/dev/null | sed -e "s|^[^ ]*/||" > $(_MDDEPFILE) ; \
1324 fi
1325 endef
1326
1327 MAKE_DEPS_AUTO_CC = $(MAKE_DEPS_AUTO)
1328 MAKE_DEPS_AUTO_CXX = $(MAKE_DEPS_AUTO)
1329
1330 endif # COMPILER_DEPEND
1331
1332 endif # MOZ_AUTO_DEPS
1333
1334 ifdef MOZ_MEMORY
1335 ifeq ($(OS_ARCH),SunOS)
1336 SOLARIS_JEMALLOC_LDFLAGS = $(call EXPAND_LIBNAME_PATH,jemalloc,$(DIST)/lib)
1337 endif
1338 endif
1339
1340 # Rules for building native targets must come first because of the host_ prefix
1341 host_%.$(OBJ_SUFFIX): %.c $(GLOBAL_DEPS)
1342 $(REPORT_BUILD)
1343 $(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1344
1345 host_%.$(OBJ_SUFFIX): %.cpp $(GLOBAL_DEPS)
1346 $(REPORT_BUILD)
1347 $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1348
1349 host_%.$(OBJ_SUFFIX): %.cc $(GLOBAL_DEPS)
1350 $(REPORT_BUILD)
1351 $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1352
1353 host_%.$(OBJ_SUFFIX): %.m $(GLOBAL_DEPS)
1354 $(REPORT_BUILD)
1355 $(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1356
1357 host_%.$(OBJ_SUFFIX): %.mm $(GLOBAL_DEPS)
1358 $(REPORT_BUILD)
1359 $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1360
1361 %:: %.c $(GLOBAL_DEPS)
1362 $(REPORT_BUILD)
1363 @$(MAKE_DEPS_AUTO_CC)
1364 $(ELOG) $(CC) $(CFLAGS) $(LDFLAGS) $(OUTOPTION)$@ $(_VPATH_SRCS)
1365
1366 %.$(OBJ_SUFFIX): %.c $(GLOBAL_DEPS)
1367 $(REPORT_BUILD)
1368 @$(MAKE_DEPS_AUTO_CC)
1369 $(ELOG) $(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $(_VPATH_SRCS)
1370
1371 moc_%.cpp: %.h $(GLOBAL_DEPS)
1372 $(MOC) $< $(OUTOPTION)$@
1373
1374 ifdef ASFILES
1375 # The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
1376 # a '-c' flag.
1377 %.$(OBJ_SUFFIX): %.$(ASM_SUFFIX) $(GLOBAL_DEPS)
1378 $(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) $(_VPATH_SRCS)
1379 endif
1380
1381 %.$(OBJ_SUFFIX): %.S $(GLOBAL_DEPS)
1382 $(AS) -o $@ $(ASFLAGS) -c $<
1383
1384 %:: %.cpp $(GLOBAL_DEPS)
1385 @$(MAKE_DEPS_AUTO_CXX)
1386 $(CCC) $(OUTOPTION)$@ $(CXXFLAGS) $(_VPATH_SRCS) $(LDFLAGS)
1387
1388 #
1389 # Please keep the next two rules in sync.
1390 #
1391 %.$(OBJ_SUFFIX): %.cc $(GLOBAL_DEPS)
1392 $(REPORT_BUILD)
1393 @$(MAKE_DEPS_AUTO_CXX)
1394 $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1395
1396 %.$(OBJ_SUFFIX): %.cpp $(GLOBAL_DEPS)
1397 $(REPORT_BUILD)
1398 @$(MAKE_DEPS_AUTO_CXX)
1399 ifdef STRICT_CPLUSPLUS_SUFFIX
1400 echo "#line 1 \"$*.cpp\"" | cat - $*.cpp > t_$*.cc
1401 $(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) t_$*.cc
1402 rm -f t_$*.cc
1403 else
1404 $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1405 endif #STRICT_CPLUSPLUS_SUFFIX
1406
1407 $(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.mm $(GLOBAL_DEPS)
1408 $(REPORT_BUILD)
1409 @$(MAKE_DEPS_AUTO_CXX)
1410 $(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(_VPATH_SRCS)
1411
1412 $(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.m $(GLOBAL_DEPS)
1413 $(REPORT_BUILD)
1414 @$(MAKE_DEPS_AUTO_CC)
1415 $(ELOG) $(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $(_VPATH_SRCS)
1416
1417 %.s: %.cpp
1418 $(CCC) -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1419
1420 %.s: %.cc
1421 $(CCC) -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1422
1423 %.s: %.c
1424 $(CC) -S $(COMPILE_CFLAGS) $(_VPATH_SRCS)
1425
1426 %.i: %.cpp
1427 $(CCC) -C -E $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) > $*.i
1428
1429 %.i: %.cc
1430 $(CCC) -C -E $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) > $*.i
1431
1432 %.i: %.c
1433 $(CC) -C -E $(COMPILE_CFLAGS) $(_VPATH_SRCS) > $*.i
1434
1435 %.i: %.mm
1436 $(CCC) -C -E $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(_VPATH_SRCS) > $*.i
1437
1438 %.res: %.rc
1439 @echo Creating Resource file: $@
1440 ifeq ($(OS_ARCH),OS2)
1441 $(RC) $(RCFLAGS:-D%=-d %) -i $(subst /,\,$(srcdir)) -r $< $@
1442 else
1443 ifdef GNU_CC
1444 $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) $(OUTOPTION)$@ $(_VPATH_SRCS)
1445 else
1446 $(RC) $(RCFLAGS) -r $(DEFINES) $(INCLUDES) $(OUTOPTION)$@ $(_VPATH_SRCS)
1447 endif
1448 endif
1449
1450 # need 3 separate lines for OS/2
1451 %:: %.pl
1452 rm -f $@
1453 cp $< $@
1454 chmod +x $@
1455
1456 %:: %.sh
1457 rm -f $@; cp $< $@; chmod +x $@
1458
1459 # Cancel these implicit rules
1460 #
1461 %: %,v
1462
1463 %: RCS/%,v
1464
1465 %: s.%
1466
1467 %: SCCS/s.%
1468
1469 ###############################################################################
1470 # Java rules
1471 ###############################################################################
1472 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
1473 SEP := ;
1474 else
1475 SEP := :
1476 endif
1477
1478 EMPTY :=
1479 SPACE := $(EMPTY) $(EMPTY)
1480
1481 # Cygwin and MSYS have their own special path form, but javac expects the source
1482 # and class paths to be in the DOS form (i.e. e:/builds/...). This function
1483 # does the appropriate conversion on Windows, but is a noop on other systems.
1484 ifeq (,$(filter-out WINNT WINCE, $(HOST_OS_ARCH)))
1485 ifdef CYGWIN_WRAPPER
1486 normalizepath = $(foreach p,$(1),$(shell cygpath -m $(p)))
1487 else
1488 # assume MSYS
1489 # We use 'pwd -W' to get DOS form of the path. However, since the given path
1490 # could be a file or a non-existent path, we cannot call 'pwd -W' directly
1491 # on the path. Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
1492 # on it, then merge with the rest of the path.
1493 root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\1|")
1494 non-root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\2|")
1495 normalizepath = $(foreach p,$(1),$(if $(filter /%,$(1)),$(patsubst %/,%,$(shell cd $(call root-path,$(1)) && pwd -W))/$(call non-root-path,$(1)),$(1)))
1496 endif
1497 else
1498 normalizepath = $(1)
1499 endif
1500
1501 _srcdir = $(call normalizepath,$(srcdir))
1502 ifdef JAVA_SOURCEPATH
1503 SP = $(subst $(SPACE),$(SEP),$(call normalizepath,$(strip $(JAVA_SOURCEPATH))))
1504 _JAVA_SOURCEPATH = ".$(SEP)$(_srcdir)$(SEP)$(SP)"
1505 else
1506 _JAVA_SOURCEPATH = ".$(SEP)$(_srcdir)"
1507 endif
1508
1509 ifdef JAVA_CLASSPATH
1510 CP = $(subst $(SPACE),$(SEP),$(call normalizepath,$(strip $(JAVA_CLASSPATH))))
1511 _JAVA_CLASSPATH = ".$(SEP)$(CP)"
1512 else
1513 _JAVA_CLASSPATH = .
1514 endif
1515
1516 _JAVA_DIR = _java
1517 $(_JAVA_DIR)::
1518 $(NSINSTALL) -D $@
1519
1520 $(_JAVA_DIR)/%.class: %.java $(GLOBAL_DEPS) $(_JAVA_DIR)
1521 $(CYGWIN_WRAPPER) $(JAVAC) $(JAVAC_FLAGS) -classpath $(_JAVA_CLASSPATH) \
1522 -sourcepath $(_JAVA_SOURCEPATH) -d $(_JAVA_DIR) $(_VPATH_SRCS)
1523
1524 $(JAVA_LIBRARY): $(addprefix $(_JAVA_DIR)/,$(JAVA_SRCS:.java=.class)) $(GLOBAL_DEPS)
1525 $(JAR) cf $@ -C $(_JAVA_DIR) .
1526
1527 GARBAGE_DIRS += $(_JAVA_DIR)
1528
1529 ###############################################################################
1530 # Update Makefiles
1531 ###############################################################################
1532
1533 # In GNU make 3.80, makefiles must use the /cygdrive syntax, even if we're
1534 # processing them with AS perl. See bug 232003
1535 ifdef AS_PERL
1536 CYGWIN_TOPSRCDIR = -nowrap -p $(topsrcdir) -wrap
1537 endif
1538
1539 # Note: Passing depth to make-makefile is optional.
1540 # It saves the script some work, though.
1541 Makefile: Makefile.in
1542 @$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR)
1543
1544 ifdef SUBMAKEFILES
1545 # VPATH does not work on some machines in this case, so add $(srcdir)
1546 $(SUBMAKEFILES): % : $(srcdir)/%.in
1547 $(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR) $@
1548 endif
1549
1550 ifdef AUTOUPDATE_CONFIGURE
1551 $(topsrcdir)/configure: $(topsrcdir)/configure.in
1552 (cd $(topsrcdir) && $(AUTOCONF)) && (cd $(DEPTH) && ./config.status --recheck)
1553 endif
1554
1555 ###############################################################################
1556 # Bunch of things that extend the 'export' rule (in order):
1557 ###############################################################################
1558
1559 ################################################################################
1560 # Copy each element of EXPORTS to $(DIST)/include
1561
1562 ifdef MOZ_JAVAXPCOM
1563 ifneq ($(XPIDLSRCS),)
1564 $(JAVA_DIST_DIR)::
1565 $(NSINSTALL) -D $@
1566 endif
1567 endif
1568
1569 ifneq ($(XPI_NAME),)
1570 $(FINAL_TARGET):
1571 $(NSINSTALL) -D $@
1572
1573 export:: $(FINAL_TARGET)
1574 endif
1575
1576 ifndef NO_DIST_INSTALL
1577 ifneq (,$(EXPORTS))
1578 export:: $(EXPORTS)
1579 $(INSTALL) $(IFLAGS1) $^ $(DIST)/include
1580 endif
1581 endif # NO_DIST_INSTALL
1582
1583 define EXPORT_NAMESPACE_RULE
1584 ifndef NO_DIST_INSTALL
1585 export:: $(EXPORTS_$(namespace))
1586 $(INSTALL) $(IFLAGS1) $$^ $(DIST)/include/$(namespace)
1587 endif # NO_DIST_INSTALL
1588 endef
1589
1590 $(foreach namespace,$(EXPORTS_NAMESPACES),$(eval $(EXPORT_NAMESPACE_RULE)))
1591
1592 ################################################################################
1593 # Copy each element of PREF_JS_EXPORTS
1594
1595 ifdef GRE_MODULE
1596 PREF_DIR = greprefs
1597 else
1598 ifneq (,$(XPI_NAME)$(LIBXUL_SDK))
1599 PREF_DIR = defaults/preferences
1600 else
1601 PREF_DIR = defaults/pref
1602 endif
1603 endif
1604
1605 ifneq ($(PREF_JS_EXPORTS),)
1606 # on win32, pref files need CRLF line endings... see bug 206029
1607 ifeq (WINNT,$(OS_ARCH))
1608 PREF_PPFLAGS = --line-endings=crlf
1609 endif
1610
1611 ifndef NO_DIST_INSTALL
1612 $(FINAL_TARGET)/$(PREF_DIR):
1613 $(NSINSTALL) -D $@
1614
1615 libs:: $(FINAL_TARGET)/$(PREF_DIR) $(PREF_JS_EXPORTS)
1616 $(EXIT_ON_ERROR) \
1617 for i in $(PREF_JS_EXPORTS); do \
1618 dest=$(FINAL_TARGET)/$(PREF_DIR)/`basename $$i`; \
1619 $(RM) -f $$dest; \
1620 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1621 done
1622 endif
1623 endif
1624
1625 ################################################################################
1626 # Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
1627
1628 ifneq ($(AUTOCFG_JS_EXPORTS),)
1629 $(FINAL_TARGET)/defaults/autoconfig::
1630 $(NSINSTALL) -D $@
1631
1632 ifndef NO_DIST_INSTALL
1633 export:: $(AUTOCFG_JS_EXPORTS) $(FINAL_TARGET)/defaults/autoconfig
1634 $(INSTALL) $(IFLAGS1) $^
1635 endif
1636
1637 endif
1638 ################################################################################
1639 # Export the elements of $(XPIDLSRCS)
1640 # generating .h and .xpt files and moving them to the appropriate places.
1641
1642 ifneq ($(XPIDLSRCS),)
1643
1644 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))
1645
1646 ifndef XPIDL_MODULE
1647 XPIDL_MODULE = $(MODULE)
1648 endif
1649
1650 ifeq ($(XPIDL_MODULE),) # we need $(XPIDL_MODULE) to make $(XPIDL_MODULE).xpt
1651 export:: FORCE
1652 @echo
1653 @echo "*** Error processing XPIDLSRCS:"
1654 @echo "Please define MODULE or XPIDL_MODULE when defining XPIDLSRCS,"
1655 @echo "so we have a module name to use when creating MODULE.xpt."
1656 @echo; sleep 2; false
1657 endif
1658
1659 $(IDL_DIR)::
1660 $(NSINSTALL) -D $@
1661
1662 # generate .h files from into $(XPIDL_GEN_DIR), then export to $(DIST)/include;
1663 # warn against overriding existing .h file.
1664 $(XPIDL_GEN_DIR)/.done:
1665 @if test ! -d $(XPIDL_GEN_DIR); then echo Creating $(XPIDL_GEN_DIR)/.done; rm -rf $(XPIDL_GEN_DIR); mkdir $(XPIDL_GEN_DIR); fi
1666 @touch $@
1667
1668 # don't depend on $(XPIDL_GEN_DIR), because the modification date changes
1669 # with any addition to the directory, regenerating all .h files -> everything.
1670
1671 $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
1672 $(REPORT_BUILD)
1673 $(ELOG) $(XPIDL_COMPILE) -m header -w $(XPIDL_FLAGS) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
1674 @if test -n "$(findstring $*.h, $(EXPORTS))"; \
1675 then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
1676
1677 ifndef NO_GEN_XPT
1678 # generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link
1679 # into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
1680 $(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
1681 $(REPORT_BUILD)
1682 $(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$*.pp $(_VPATH_SRCS)
1683
1684 # no need to link together if XPIDLSRCS contains only XPIDL_MODULE
1685 ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))
1686 $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS)) $(GLOBAL_DEPS) $(XPIDL_LINK)
1687 $(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS))
1688 endif # XPIDL_MODULE.xpt != XPIDLSRCS
1689
1690 libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
1691 ifndef NO_DIST_INSTALL
1692 $(INSTALL) $(IFLAGS1) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(FINAL_TARGET)/components
1693 endif
1694
1695 endif # NO_GEN_XPT
1696
1697 GARBAGE_DIRS += $(XPIDL_GEN_DIR)
1698
1699 endif # XPIDLSRCS
1700
1701 ifneq ($(XPIDLSRCS),)
1702 # export .idl files to $(IDL_DIR)
1703 ifndef NO_DIST_INSTALL
1704 export:: $(XPIDLSRCS) $(IDL_DIR)
1705 $(INSTALL) $(IFLAGS1) $^
1706
1707 export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) $(DIST)/include
1708 $(INSTALL) $(IFLAGS1) $^
1709 endif # NO_DIST_INSTALL
1710
1711 endif # XPIDLSRCS
1712
1713
1714
1715 #
1716 # General rules for exporting idl files.
1717 #
1718 # WORK-AROUND ONLY, for mozilla/tools/module-deps/bootstrap.pl build.
1719 # Bug to fix idl dependency problems w/o this extra build pass is
1720 # http://bugzilla.mozilla.org/show_bug.cgi?id=145777
1721 #
1722 $(IDL_DIR)::
1723 $(NSINSTALL) -D $@
1724
1725 export-idl:: $(SUBMAKEFILES) $(MAKE_DIRS)
1726
1727 ifneq ($(XPIDLSRCS),)
1728 ifndef NO_DIST_INSTALL
1729 export-idl:: $(XPIDLSRCS) $(IDL_DIR)
1730 $(INSTALL) $(IFLAGS1) $^
1731 endif
1732 endif
1733 $(LOOP_OVER_PARALLEL_DIRS)
1734 $(LOOP_OVER_DIRS)
1735 $(LOOP_OVER_TOOL_DIRS)
1736
1737 ifdef MOZ_JAVAXPCOM
1738 ifneq ($(XPIDLSRCS),)
1739
1740 JAVA_XPIDLSRCS = $(XPIDLSRCS)
1741
1742 # A single IDL file can contain multiple interfaces, which result in multiple
1743 # Java interface files. So use hidden dependency files.
1744 JAVADEPFILES = $(addprefix $(JAVA_GEN_DIR)/.,$(JAVA_XPIDLSRCS:.idl=.java.pp))
1745
1746 $(JAVA_GEN_DIR):
1747 $(NSINSTALL) -D $@
1748 GARBAGE_DIRS += $(JAVA_GEN_DIR)
1749
1750 # generate .java files into _javagen/[package name dirs]
1751 _JAVA_GEN_DIR = $(JAVA_GEN_DIR)/$(JAVA_IFACES_PKG_NAME)
1752 $(_JAVA_GEN_DIR):
1753 $(NSINSTALL) -D $@
1754
1755 $(JAVA_GEN_DIR)/.%.java.pp: %.idl $(XPIDL_COMPILE) $(_JAVA_GEN_DIR)
1756 $(REPORT_BUILD)
1757 $(ELOG) $(XPIDL_COMPILE) -m java -w -I$(srcdir) -I$(IDL_DIR) -o $(_JAVA_GEN_DIR)/$* $(_VPATH_SRCS)
1758 @touch $@
1759
1760 # "Install" generated Java interfaces. We segregate them based on the XPI_NAME.
1761 # If XPI_NAME is not set, install into the "default" directory.
1762 ifneq ($(XPI_NAME),)
1763 JAVA_INSTALL_DIR = $(JAVA_DIST_DIR)/$(XPI_NAME)
1764 else
1765 JAVA_INSTALL_DIR = $(JAVA_DIST_DIR)/default
1766 endif
1767
1768 $(JAVA_INSTALL_DIR):
1769 $(NSINSTALL) -D $@
1770
1771 export:: $(JAVA_DIST_DIR) $(JAVADEPFILES) $(JAVA_INSTALL_DIR)
1772 (cd $(JAVA_GEN_DIR) && tar $(TAR_CREATE_FLAGS) - .) | (cd $(JAVA_INSTALL_DIR) && tar -xf -)
1773
1774 endif # XPIDLSRCS
1775 endif # MOZ_JAVAXPCOM
1776
1777 ################################################################################
1778 # Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
1779 ifdef EXTRA_COMPONENTS
1780 libs:: $(EXTRA_COMPONENTS)
1781 ifndef NO_DIST_INSTALL
1782 $(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/components
1783 @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_TARGET)/components/components.list $(notdir $^)
1784 endif
1785
1786 endif
1787
1788 ifdef EXTRA_PP_COMPONENTS
1789 libs:: $(EXTRA_PP_COMPONENTS)
1790 ifndef NO_DIST_INSTALL
1791 $(EXIT_ON_ERROR) \
1792 $(NSINSTALL) -D $(FINAL_TARGET)/components; \
1793 for i in $^; do \
1794 fname=`basename $$i`; \
1795 dest=$(FINAL_TARGET)/components/$${fname}; \
1796 $(RM) -f $$dest; \
1797 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1798 $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_TARGET)/components/components.list $$fname; \
1799 done
1800 endif
1801
1802 endif
1803
1804 ################################################################################
1805 # Copy each element of EXTRA_JS_MODULES to $(FINAL_TARGET)/modules
1806 ifdef EXTRA_JS_MODULES
1807 libs:: $(EXTRA_JS_MODULES)
1808 ifndef NO_DIST_INSTALL
1809 $(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/modules
1810 endif
1811
1812 endif
1813
1814 ifdef EXTRA_PP_JS_MODULES
1815 libs:: $(EXTRA_PP_JS_MODULES)
1816 ifndef NO_DIST_INSTALL
1817 $(EXIT_ON_ERROR) \
1818 $(NSINSTALL) -D $(FINAL_TARGET)/modules; \
1819 for i in $^; do \
1820 dest=$(FINAL_TARGET)/modules/`basename $$i`; \
1821 $(RM) -f $$dest; \
1822 $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1823 done
1824 endif
1825
1826 endif
1827
1828 ################################################################################
1829 # SDK
1830
1831 ifneq (,$(SDK_LIBRARY))
1832 $(SDK_LIB_DIR)::
1833 $(NSINSTALL) -D $@
1834
1835 ifndef NO_DIST_INSTALL
1836 libs:: $(SDK_LIBRARY) $(SDK_LIB_DIR)
1837 $(INSTALL) $(IFLAGS2) $^
1838 endif
1839
1840 endif # SDK_LIBRARY
1841
1842 ifneq (,$(SDK_BINARY))
1843 $(SDK_BIN_DIR)::
1844 $(NSINSTALL) -D $@
1845
1846 ifndef NO_DIST_INSTALL
1847 libs:: $(SDK_BINARY) $(SDK_BIN_DIR)
1848 $(INSTALL) $(IFLAGS2) $^
1849 endif
1850
1851 endif # SDK_BINARY
1852
1853 ################################################################################
1854 # CHROME PACKAGING
1855
1856 JAR_MANIFEST := $(srcdir)/jar.mn
1857
1858 chrome::
1859 $(MAKE) realchrome
1860 $(LOOP_OVER_PARALLEL_DIRS)
1861 $(LOOP_OVER_DIRS)
1862 $(LOOP_OVER_TOOL_DIRS)
1863
1864 $(FINAL_TARGET)/chrome:
1865 $(NSINSTALL) -D $@
1866
1867 ifneq (,$(wildcard $(JAR_MANIFEST)))
1868 ifndef NO_DIST_INSTALL
1869 libs realchrome:: $(CHROME_DEPS) $(FINAL_TARGET)/chrome
1870 $(PYTHON) $(MOZILLA_DIR)/config/JarMaker.py \
1871 $(QUIET) -j $(FINAL_TARGET)/chrome \
1872 $(MAKE_JARS_FLAGS) $(XULPPFLAGS) $(DEFINES) $(ACDEFINES) \
1873 $(JAR_MANIFEST)
1874 endif
1875 endif
1876
1877 ifneq ($(DIST_FILES),)
1878 $(DIST)/bin:
1879 $(NSINSTALL) -D $@
1880
1881 libs:: $(DIST_FILES) $(DIST)/bin
1882 @$(EXIT_ON_ERROR) \
1883 for f in $(DIST_FILES); do \
1884 dest=$(FINAL_TARGET)/`basename $$f`; \
1885 $(RM) -f $$dest; \
1886 $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
1887 $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
1888 $(srcdir)/$$f > $$dest; \
1889 done
1890 endif
1891
1892 ifneq ($(DIST_CHROME_FILES),)
1893 libs:: $(DIST_CHROME_FILES)
1894 @$(EXIT_ON_ERROR) \
1895 for f in $(DIST_CHROME_FILES); do \
1896 dest=$(FINAL_TARGET)/chrome/`basename $$f`; \
1897 $(RM) -f $$dest; \
1898 $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
1899 $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
1900 $(srcdir)/$$f > $$dest; \
1901 done
1902 endif
1903
1904 ifneq ($(XPI_PKGNAME),)
1905 libs realchrome::
1906 ifdef STRIP_XPI
1907 ifndef MOZ_DEBUG
1908 @echo "Stripping $(XPI_PKGNAME) package directory..."
1909 @echo $(FINAL_TARGET)
1910 @cd $(FINAL_TARGET) && find . ! -type d \
1911 ! -name "*.js" \
1912 ! -name "*.xpt" \
1913 ! -name "*.gif" \
1914 ! -name "*.jpg" \
1915 ! -name "*.png" \
1916 ! -name "*.xpm" \
1917 ! -name "*.txt" \
1918 ! -name "*.rdf" \
1919 ! -name "*.sh" \
1920 ! -name "*.properties" \
1921 ! -name "*.dtd" \
1922 ! -name "*.html" \
1923 ! -name "*.xul" \
1924 ! -name "*.css" \
1925 ! -name "*.xml" \
1926 ! -name "*.jar" \
1927 ! -name "*.dat" \
1928 ! -name "*.tbl" \
1929 ! -name "*.src" \
1930 ! -name "*.reg" \
1931 $(PLATFORM_EXCLUDE_LIST) \
1932 -exec $(STRIP) $(STRIP_FLAGS) {} >/dev/null 2>&1 \;
1933 endif
1934 endif
1935 @echo "Packaging $(XPI_PKGNAME).xpi..."
1936 cd $(FINAL_TARGET) && $(ZIP) -qr ../$(XPI_PKGNAME).xpi *
1937 endif
1938
1939 ifdef INSTALL_EXTENSION_ID
1940 ifndef XPI_NAME
1941 $(error XPI_NAME must be set for INSTALL_EXTENSION_ID)
1942 endif
1943
1944 libs::
1945 $(RM) -rf "$(DIST)/bin/extensions/$(INSTALL_EXTENSION_ID)"
1946 $(NSINSTALL) -D "$(DIST)/bin/extensions/$(INSTALL_EXTENSION_ID)"
1947 cd $(FINAL_TARGET) && tar $(TAR_CREATE_FLAGS) - . | (cd "../../bin/extensions/$(INSTALL_EXTENSION_ID)" && tar -xf -)
1948
1949 endif
1950
1951 ifneq (,$(filter flat symlink,$(MOZ_CHROME_FILE_FORMAT)))
1952 _JAR_REGCHROME_DISABLE_JAR=1
1953 else
1954 _JAR_REGCHROME_DISABLE_JAR=0
1955 endif
1956
1957 REGCHROME = $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/add-chrome.pl \
1958 $(if $(filter gtk2,$(MOZ_WIDGET_TOOLKIT)),-x) \
1959 $(if $(CROSS_COMPILE),-o $(OS_ARCH)) $(FINAL_TARGET)/chrome/installed-chrome.txt \
1960 $(_JAR_REGCHROME_DISABLE_JAR)
1961
1962 REGCHROME_INSTALL = $(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)) $(DESTDIR)$(mozappdir)/chrome/installed-chrome.txt \
1965 $(_JAR_REGCHROME_DISABLE_JAR)
1966
1967
1968 #############################################################################
1969 # Dependency system
1970 #############################################################################
1971 ifdef COMPILER_DEPEND
1972 depend::
1973 @echo "$(MAKE): No need to run depend target.\
1974 Using compiler-based depend." 1>&2
1975 ifeq ($(GNU_CC)$(GNU_CXX),)
1976 # Non-GNU compilers
1977 @echo "`echo '$(MAKE):'|sed 's/./ /g'`"\
1978 '(Compiler-based depend was turned on by "--enable-md".)' 1>&2
1979 else
1980 # GNU compilers
1981 @space="`echo '$(MAKE): '|sed 's/./ /g'`";\
1982 echo "$$space"'Since you are using a GNU compiler,\
1983 it is on by default.' 1>&2; \
1984 echo "$$space"'To turn it off, pass --disable-md to configure.' 1>&2
1985 endif
1986
1987 else # ! COMPILER_DEPEND
1988
1989 ifndef MOZ_AUTO_DEPS
1990
1991 define MAKE_DEPS_NOAUTO
1992 $(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f- $(DEFINES) $(ACDEFINES) $(INCLUDES) $< 2>/dev/null | sed -e "s|^[^ ]*/||" > $@
1993 endef
1994
1995 $(MDDEPDIR)/%.pp: %.c
1996 $(REPORT_BUILD)
1997 @$(MAKE_DEPS_NOAUTO)
1998
1999 $(MDDEPDIR)/%.pp: %.cpp
2000 $(REPORT_BUILD)
2001 @$(MAKE_DEPS_NOAUTO)
2002
2003 $(MDDEPDIR)/%.pp: %.s
2004 $(REPORT_BUILD)
2005 @$(MAKE_DEPS_NOAUTO)
2006
2007 ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS))
2008 depend:: $(SUBMAKEFILES) $(MAKE_DIRS) $(MDDEPFILES)
2009 else
2010 depend:: $(SUBMAKEFILES)
2011 endif
2012 $(LOOP_OVER_PARALLEL_DIRS)
2013 $(LOOP_OVER_DIRS)
2014 $(LOOP_OVER_TOOL_DIRS)
2015
2016 dependclean:: $(SUBMAKEFILES)
2017 rm -f $(MDDEPFILES)
2018 $(LOOP_OVER_PARALLEL_DIRS)
2019 $(LOOP_OVER_DIRS)
2020 $(LOOP_OVER_TOOL_DIRS)
2021
2022 endif # MOZ_AUTO_DEPS
2023
2024 endif # COMPILER_DEPEND
2025
2026
2027 #############################################################################
2028 # MDDEPDIR is the subdirectory where all the dependency files are placed.
2029 # This uses a make rule (instead of a macro) to support parallel
2030 # builds (-jN). If this were done in the LOOP_OVER_DIRS macro, two
2031 # processes could simultaneously try to create the same directory.
2032 #
2033 # We use $(CURDIR) in the rule's target to ensure that we don't find
2034 # a dependency directory in the source tree via VPATH (perhaps from
2035 # a previous build in the source tree) and thus neglect to create a
2036 # dependency directory in the object directory, where we really need
2037 # it.
2038
2039 $(CURDIR)/$(MDDEPDIR):
2040 @if test ! -d $@; then echo Creating $@; rm -rf $@; mkdir $@; else true; fi
2041
2042 ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))
2043 ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS))
2044 MDDEPEND_FILES := $(strip $(wildcard $(MDDEPDIR)/*.pp))
2045
2046 ifneq (,$(MDDEPEND_FILES))
2047 ifdef PERL
2048 # The script mddepend.pl checks the dependencies and writes to stdout
2049 # one rule to force out-of-date objects. For example,
2050 # foo.o boo.o: FORCE
2051 # The script has an advantage over including the *.pp files directly
2052 # because it handles the case when header files are removed from the build.
2053 # 'make' would complain that there is no way to build missing headers.
2054 ifeq (,$(MAKE_RESTARTS))
2055 $(MDDEPDIR)/.all.pp: FORCE
2056 @$(PERL) $(BUILD_TOOLS)/mddepend.pl $@ $(MDDEPEND_FILES)
2057 endif
2058 -include $(MDDEPDIR)/.all.pp
2059 else
2060 include $(MDDEPEND_FILES)
2061 endif
2062 endif
2063
2064 endif
2065 endif
2066 #############################################################################
2067
2068 -include $(topsrcdir)/$(MOZ_BUILD_APP)/app-rules.mk
2069 -include $(MY_RULES)
2070
2071 #
2072 # This speeds up gmake's processing if these files don't exist.
2073 #
2074 $(MY_CONFIG) $(MY_RULES):
2075 @touch $@
2076
2077 #
2078 # Generate Emacs tags in a file named TAGS if ETAGS was set in $(MY_CONFIG)
2079 # or in $(MY_RULES)
2080 #
2081 ifdef ETAGS
2082 ifneq ($(CSRCS)$(CPPSRCS)$(HEADERS),)
2083 all:: TAGS
2084 TAGS:: $(CSRCS) $(CPPSRCS) $(HEADERS)
2085 $(ETAGS) $(CSRCS) $(CPPSRCS) $(HEADERS)
2086 endif
2087 endif
2088
2089 ################################################################################
2090 # Special gmake rules.
2091 ################################################################################
2092
2093
2094 #
2095 # Disallow parallel builds with MSVC < 8
2096 #
2097 ifneq (,$(filter 1200 1300 1310,$(_MSC_VER)))
2098 .NOTPARALLEL:
2099 endif
2100
2101 #
2102 # Re-define the list of default suffixes, so gmake won't have to churn through
2103 # hundreds of built-in suffix rules for stuff we don't need.
2104 #
2105 .SUFFIXES:
2106
2107 #
2108 # Fake targets. Always run these rules, even if a file/directory with that
2109 # name already exists.
2110 #
2111 .PHONY: all alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_apprunner tools $(DIRS) $(TOOL_DIRS) FORCE
2112
2113 # Used as a dependency to force targets to rebuild
2114 FORCE:
2115
2116 # Delete target if error occurs when building target
2117 .DELETE_ON_ERROR:
2118
2119 # Properly set LIBPATTERNS for the platform
2120 .LIBPATTERNS = $(if $(IMPORT_LIB_SUFFIX),$(LIB_PREFIX)%.$(IMPORT_LIB_SUFFIX)) $(LIB_PREFIX)%.$(LIB_SUFFIX) $(DLL_PREFIX)%$(DLL_SUFFIX)
2121
2122 tags: TAGS
2123
2124 TAGS: $(SUBMAKEFILES) $(CSRCS) $(CPPSRCS) $(wildcard *.h)
2125 -etags $(CSRCS) $(CPPSRCS) $(wildcard *.h)
2126 $(LOOP_OVER_PARALLEL_DIRS)
2127 $(LOOP_OVER_DIRS)
2128
2129 echo-variable-%:
2130 @echo "$($*)"
2131
2132 echo-tiers:
2133 @echo $(TIERS)
2134
2135 echo-tier-dirs:
2136 @$(foreach tier,$(TIERS),echo '$(tier):'; echo ' dirs: $(tier_$(tier)_dirs)'; echo ' staticdirs: $(tier_$(tier)_staticdirs)'; )
2137
2138 echo-dirs:
2139 @echo $(DIRS)
2140
2141 echo-module:
2142 @echo $(MODULE)
2143
2144 echo-requires:
2145 @echo $(REQUIRES)
2146
2147 echo-requires-recursive::
2148 ifdef _REPORT_ALL_DIRS
2149 @echo $(subst $(topsrcdir)/,,$(srcdir)): $(MODULE): $(REQUIRES)
2150 else
2151 @$(if $(REQUIRES),echo $(subst $(topsrcdir)/,,$(srcdir)): $(MODULE): $(REQUIRES))
2152 endif
2153 $(LOOP_OVER_PARALLEL_DIRS)
2154 $(LOOP_OVER_DIRS)
2155
2156 echo-depth-path:
2157 @$(topsrcdir)/build/unix/print-depth-path.sh
2158
2159 echo-module-name:
2160 @$(topsrcdir)/build/package/rpm/print-module-name.sh
2161
2162 echo-module-filelist:
2163 @$(topsrcdir)/build/package/rpm/print-module-filelist.sh
2164
2165 showtargs:
2166 ifneq (,$(filter $(PROGRAM) $(HOST_PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS)))
2167 @echo --------------------------------------------------------------------------------
2168 @echo "PROGRAM = $(PROGRAM)"
2169 @echo "SIMPLE_PROGRAMS = $(SIMPLE_PROGRAMS)"
2170 @echo "LIBRARY = $(LIBRARY)"
2171 @echo "SHARED_LIBRARY = $(SHARED_LIBRARY)"
2172 @echo "SHARED_LIBRARY_LIBS = $(SHARED_LIBRARY_LIBS)"
2173 @echo "LIBS = $(LIBS)"
2174 @echo "DEF_FILE = $(DEF_FILE)"
2175 @echo "IMPORT_LIBRARY = $(IMPORT_LIBRARY)"
2176 @echo "STATIC_LIBS = $(STATIC_LIBS)"
2177 @echo "SHARED_LIBS = $(SHARED_LIBS)"
2178 @echo "EXTRA_DSO_LIBS = $(EXTRA_DSO_LIBS)"
2179 @echo "EXTRA_DSO_LDOPTS = $(EXTRA_DSO_LDOPTS)"
2180 @echo "DEPENDENT_LIBS = $(DEPENDENT_LIBS)"
2181 @echo --------------------------------------------------------------------------------
2182 endif
2183 $(LOOP_OVER_PARALLEL_DIRS)
2184 $(LOOP_OVER_DIRS)
2185
2186 showbuild:
2187 @echo "MOZ_BUILD_ROOT = $(MOZ_BUILD_ROOT)"
2188 @echo "MOZ_WIDGET_TOOLKIT = $(MOZ_WIDGET_TOOLKIT)"
2189 @echo "CC = $(CC)"
2190 @echo "CXX = $(CXX)"
2191 @echo "CCC = $(CCC)"
2192 @echo "CPP = $(CPP)"
2193 @echo "LD = $(LD)"
2194 @echo "AR = $(AR)"
2195 @echo "IMPLIB = $(IMPLIB)"
2196 @echo "FILTER = $(FILTER)"
2197 @echo "MKSHLIB = $(MKSHLIB)"
2198 @echo "MKCSHLIB = $(MKCSHLIB)"
2199 @echo "RC = $(RC)"
2200 @echo "CFLAGS = $(CFLAGS)"
2201 @echo "OS_CFLAGS = $(OS_CFLAGS)"
2202 @echo "COMPILE_CFLAGS = $(COMPILE_CFLAGS)"
2203 @echo "CXXFLAGS = $(CXXFLAGS)"
2204 @echo "OS_CXXFLAGS = $(OS_CXXFLAGS)"
2205 @echo "COMPILE_CXXFLAGS = $(COMPILE_CXXFLAGS)"
2206 @echo "COMPILE_CMFLAGS = $(COMPILE_CMFLAGS)"
2207 @echo "COMPILE_CMMFLAGS = $(COMPILE_CMMFLAGS)"
2208 @echo "LDFLAGS = $(LDFLAGS)"
2209 @echo "OS_LDFLAGS = $(OS_LDFLAGS)"
2210 @echo "DSO_LDOPTS = $(DSO_LDOPTS)"
2211 @echo "OS_INCLUDES = $(OS_INCLUDES)"
2212 @echo "OS_LIBS = $(OS_LIBS)"
2213 @echo "EXTRA_LIBS = $(EXTRA_LIBS)"
2214 @echo "BIN_FLAGS = $(BIN_FLAGS)"
2215 @echo "INCLUDES = $(INCLUDES)"
2216 @echo "DEFINES = $(DEFINES)"
2217 @echo "ACDEFINES = $(ACDEFINES)"
2218 @echo "BIN_SUFFIX = $(BIN_SUFFIX)"
2219 @echo "LIB_SUFFIX = $(LIB_SUFFIX)"
2220 @echo "DLL_SUFFIX = $(DLL_SUFFIX)"
2221 @echo "IMPORT_LIB_SUFFIX = $(IMPORT_LIB_SUFFIX)"
2222 @echo "INSTALL = $(INSTALL)"
2223
2224 showhost:
2225 @echo "HOST_CC = $(HOST_CC)"
2226 @echo "HOST_CXX = $(HOST_CXX)"
2227 @echo "HOST_CFLAGS = $(HOST_CFLAGS)"
2228 @echo "HOST_LDFLAGS = $(HOST_LDFLAGS)"
2229 @echo "HOST_LIBS = $(HOST_LIBS)"
2230 @echo "HOST_EXTRA_LIBS = $(HOST_EXTRA_LIBS)"
2231 @echo "HOST_EXTRA_DEPS = $(HOST_EXTRA_DEPS)"
2232 @echo "HOST_PROGRAM = $(HOST_PROGRAM)"
2233 @echo "HOST_OBJS = $(HOST_OBJS)"
2234 @echo "HOST_PROGOBJS = $(HOST_PROGOBJS)"
2235 @echo "HOST_LIBRARY = $(HOST_LIBRARY)"
2236
2237 showbuildmods::
2238 @echo "Build Modules = $(BUILD_MODULES)"
2239 @echo "Module dirs = $(BUILD_MODULE_DIRS)"
2240
2241 documentation:
2242 @cd $(DEPTH)
2243 $(DOXYGEN) $(DEPTH)/config/doxygen.cfg
2244
2245 ifdef ENABLE_TESTS
2246 check:: $(SUBMAKEFILES) $(MAKE_DIRS)
2247 $(LOOP_OVER_PARALLEL_DIRS)
2248 $(LOOP_OVER_DIRS)
2249 $(LOOP_OVER_TOOL_DIRS)
2250 endif
2251
2252
2253 FREEZE_VARIABLES = \
2254 CSRCS \
2255 CPPSRCS \
2256 EXPORTS \
2257 XPIDLSRCS \
2258 DIRS \
2259 LIBRARY \
2260 MODULE \
2261 REQUIRES \
2262 SHORT_LIBNAME \
2263 TIERS \
2264 $(NULL)
2265
2266 $(foreach var,$(FREEZE_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))
2267
2268 CHECK_FROZEN_VARIABLES = $(foreach var,$(FREEZE_VARIABLES), \
2269 $(if $(subst $($(var)_FROZEN),,'$($(var))'),$(error Makefile variable '$(var)' changed value after including rules.mk. Was $($(var)_FROZEN), now $($(var)).)))
2270
2271 libs export libs::
2272 $(CHECK_FROZEN_VARIABLES)

  ViewVC Help
Powered by ViewVC 1.1.24