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