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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 399 - (show annotations)
Tue Dec 9 03:37:47 2008 UTC (10 years, 9 months ago) by siliconforks
File size: 66075 byte(s)
Use SpiderMonkey from Firefox 3.1b2.

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

  ViewVC Help
Powered by ViewVC 1.1.24