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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.24