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