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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 460 - (show annotations)
Sat Sep 26 23:15:22 2009 UTC (9 years, 11 months ago) by siliconforks
File size: 66835 byte(s)
Upgrade to SpiderMonkey from Firefox 3.5.3.

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

  ViewVC Help
Powered by ViewVC 1.1.24