PageRenderTime 502ms CodeModel.GetById 356ms app.highlight 132ms RepoModel.GetById 1ms app.codeStats 1ms

/js/lib/Socket.IO-node/support/expresso/deps/jscoverage/js/config/rules.mk

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
Makefile | 2248 lines | 1592 code | 334 blank | 322 comment | 47 complexity | 28b30b0357b8c8a9aed70bc264445b62 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1# vim:set ts=8 sw=8 sts=8 noet:
   2#
   3# ***** BEGIN LICENSE BLOCK *****
   4# Version: MPL 1.1/GPL 2.0/LGPL 2.1
   5#
   6# The contents of this file are subject to the Mozilla Public License Version
   7# 1.1 (the "License"); you may not use this file except in compliance with
   8# the License. You may obtain a copy of the License at
   9# http://www.mozilla.org/MPL/
  10#
  11# Software distributed under the License is distributed on an "AS IS" basis,
  12# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13# for the specific language governing rights and limitations under the
  14# License.
  15#
  16# The Original Code is mozilla.org code.
  17#
  18# The Initial Developer of the Original Code is
  19# Netscape Communications Corporation.
  20# Portions created by the Initial Developer are Copyright (C) 1998
  21# the Initial Developer. All Rights Reserved.
  22#
  23# Contributor(s):
  24#  Chase Phillips <chase@mozilla.org>
  25#  Benjamin Smedberg <benjamin@smedbergs.us>
  26#  Jeff Walden <jwalden+code@mit.edu>
  27#
  28# Alternatively, the contents of this file may be used under the terms of
  29# either of the GNU General Public License Version 2 or later (the "GPL"),
  30# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  31# in which case the provisions of the GPL or the LGPL are applicable instead
  32# of those above. If you wish to allow use of your version of this file only
  33# under the terms of either the GPL or the LGPL, and not to allow others to
  34# use your version of this file under the terms of the MPL, indicate your
  35# decision by deleting the provisions above and replace them with the notice
  36# and other provisions required by the GPL or the LGPL. If you do not delete
  37# the provisions above, a recipient may use your version of this file under
  38# the terms of any one of the MPL, the GPL or the LGPL.
  39#
  40# ***** END LICENSE BLOCK *****
  41NO_DIST_INSTALL = 1
  42
  43ifndef topsrcdir
  44topsrcdir		= $(DEPTH)
  45endif
  46
  47ifndef MOZILLA_DIR
  48MOZILLA_DIR = $(topsrcdir)
  49endif
  50
  51ifndef INCLUDED_CONFIG_MK
  52include $(topsrcdir)/config/config.mk
  53endif
  54
  55ifndef INCLUDED_VERSION_MK
  56include $(topsrcdir)/config/version.mk
  57endif
  58
  59REPORT_BUILD = @echo $(notdir $<)
  60
  61ifeq ($(OS_ARCH),OS2)
  62EXEC			=
  63else
  64EXEC			= exec
  65endif
  66
  67# ELOG prints out failed command when building silently (gmake -s).
  68ifneq (,$(findstring -s,$(MAKEFLAGS)))
  69  ELOG := $(EXEC) sh $(BUILD_TOOLS)/print-failed-commands.sh
  70else
  71  ELOG :=
  72endif
  73
  74ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
  75ifndef GNU_CC
  76_LIBNAME_RELATIVE_PATHS=1
  77endif
  78endif
  79
  80ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
  81PWD := $(shell pwd)
  82_VPATH_SRCS = $(if $(filter /%,$<),$<,$(PWD)/$<)
  83else
  84_VPATH_SRCS = $<
  85endif
  86
  87# Add $(DIST)/lib to VPATH so that -lfoo dependencies are followed
  88VPATH += $(DIST)/lib
  89ifdef LIBXUL_SDK
  90VPATH += $(LIBXUL_SDK)/lib
  91endif
  92
  93# EXPAND_LIBNAME - $(call EXPAND_LIBNAME,foo)
  94# expands to foo.lib on platforms with import libs and -lfoo otherwise
  95
  96# EXPAND_LIBNAME_PATH - $(call EXPAND_LIBNAME_PATH,foo,dir)
  97# expands to dir/foo.lib on platforms with import libs and
  98# -Ldir -lfoo otherwise
  99
 100# EXPAND_MOZLIBNAME - $(call EXPAND_MOZLIBNAME,foo)
 101# expands to $(DIST)/lib/foo.lib on platforms with import libs and
 102# -lfoo otherwise
 103
 104ifdef _LIBNAME_RELATIVE_PATHS
 105EXPAND_LIBNAME = $(foreach lib,$(1),$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
 106EXPAND_LIBNAME_PATH = $(foreach lib,$(1),$(2)/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
 107EXPAND_MOZLIBNAME = $(foreach lib,$(1),$(DIST)/lib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
 108else
 109EXPAND_LIBNAME = $(addprefix -l,$(1))
 110EXPAND_LIBNAME_PATH = -L$(2) $(addprefix -l,$(1))
 111EXPAND_MOZLIBNAME = $(addprefix -l,$(1))
 112endif
 113
 114ifdef EXTRA_DSO_LIBS
 115EXTRA_DSO_LIBS	:= $(call EXPAND_MOZLIBNAME,$(EXTRA_DSO_LIBS))
 116endif
 117
 118#
 119# Library rules
 120#
 121# If BUILD_STATIC_LIBS or FORCE_STATIC_LIB is set, build a static library.
 122# Otherwise, build a shared library.
 123#
 124
 125ifndef LIBRARY
 126ifdef LIBRARY_NAME
 127ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
 128ifdef SHORT_LIBNAME
 129LIBRARY_NAME		:= $(SHORT_LIBNAME)
 130endif
 131endif
 132LIBRARY			:= $(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX)
 133endif
 134endif
 135
 136ifndef HOST_LIBRARY
 137ifdef HOST_LIBRARY_NAME
 138HOST_LIBRARY		:= $(LIB_PREFIX)$(HOST_LIBRARY_NAME).$(LIB_SUFFIX)
 139endif
 140endif
 141
 142ifdef LIBRARY
 143ifneq (_1,$(FORCE_SHARED_LIB)_$(BUILD_STATIC_LIBS))
 144ifdef MKSHLIB
 145
 146ifdef LIB_IS_C_ONLY
 147MKSHLIB			= $(MKCSHLIB)
 148endif
 149
 150ifdef MAKE_FRAMEWORK
 151SHARED_LIBRARY		:= $(LIBRARY_NAME)
 152else
 153SHARED_LIBRARY		:= $(DLL_PREFIX)$(LIBRARY_NAME)$(DLL_SUFFIX)
 154endif
 155
 156ifeq ($(OS_ARCH),OS2)
 157DEF_FILE		:= $(SHARED_LIBRARY:.dll=.def)
 158endif
 159
 160ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
 161IMPORT_LIBRARY		:= $(LIB_PREFIX)$(LIBRARY_NAME).$(IMPORT_LIB_SUFFIX)
 162endif
 163
 164ifdef MOZ_ENABLE_LIBXUL
 165EMBED_MANIFEST_AT=2
 166endif
 167
 168endif # MKSHLIB
 169endif # FORCE_SHARED_LIB && !BUILD_STATIC_LIBS
 170endif # LIBRARY
 171
 172ifeq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB))
 173LIBRARY			:= $(NULL)
 174endif
 175
 176ifeq (_1,$(FORCE_SHARED_LIB)_$(BUILD_STATIC_LIBS))
 177SHARED_LIBRARY		:= $(NULL)
 178DEF_FILE		:= $(NULL)
 179IMPORT_LIBRARY		:= $(NULL)
 180endif
 181
 182ifdef FORCE_STATIC_LIB
 183ifndef FORCE_SHARED_LIB
 184SHARED_LIBRARY		:= $(NULL)
 185DEF_FILE		:= $(NULL)
 186IMPORT_LIBRARY		:= $(NULL)
 187endif
 188endif
 189
 190ifdef FORCE_SHARED_LIB
 191ifndef FORCE_STATIC_LIB
 192LIBRARY			:= $(NULL)
 193endif
 194endif
 195
 196ifdef JAVA_LIBRARY_NAME
 197JAVA_LIBRARY := $(JAVA_LIBRARY_NAME).jar
 198endif
 199
 200ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
 201ifndef GNU_CC
 202
 203#
 204# All C++ files share a PDB file per directory. For parallel builds, this PDB
 205# file is shared and locked by MSPDBSRV.EXE, starting with MSVC8 SP1. If
 206# you're using MSVC 7.1 or MSVC8 without SP1, don't do parallel builds.
 207#
 208# The final PDB for libraries and programs is created by the linker and uses
 209# a different name from the single PDB file created by the compiler. See
 210# bug 462740.
 211#
 212COMPILE_PDBFILE = generated.pdb
 213LINK_PDBFILE = $(basename $(@F)).pdb
 214ifdef MOZ_DEBUG
 215CODFILE=$(basename $(@F)).cod
 216endif
 217
 218ifdef MOZ_MAPINFO
 219ifdef LIBRARY_NAME
 220MAPFILE=$(LIBRARY_NAME).map
 221else
 222MAPFILE=$(basename $(@F)).map
 223endif # LIBRARY_NAME
 224endif # MOZ_MAPINFO
 225
 226ifdef DEFFILE
 227OS_LDFLAGS += -DEF:$(DEFFILE)
 228EXTRA_DEPS += $(DEFFILE)
 229endif
 230
 231ifdef MAPFILE
 232OS_LDFLAGS += -MAP:$(MAPFILE)
 233#CFLAGS += -Fm$(MAPFILE)
 234#CXXFLAGS += -Fm$(MAPFILE)
 235endif
 236
 237#ifdef CODFILE
 238#CFLAGS += -Fa$(CODFILE) -FAsc
 239#CFLAGS += -Fa$(CODFILE) -FAsc
 240#endif
 241
 242endif # !GNU_CC
 243
 244ifdef ENABLE_CXX_EXCEPTIONS
 245ifdef GNU_CC
 246CXXFLAGS		+= -fexceptions
 247else
 248ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER)))
 249CXXFLAGS		+= -GX
 250else
 251CXXFLAGS		+= -EHsc
 252endif # _MSC_VER
 253endif # GNU_CC
 254endif # ENABLE_CXX_EXCEPTIONS
 255endif # WINNT
 256
 257ifeq (,$(filter-out WINNT WINCE,$(HOST_OS_ARCH)))
 258HOST_PDBFILE=$(basename $(@F)).pdb
 259endif
 260
 261ifndef TARGETS
 262TARGETS			= $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
 263endif
 264
 265ifndef OBJS
 266_OBJS			= \
 267	$(JRI_STUB_CFILES) \
 268	$(addsuffix .$(OBJ_SUFFIX), $(JMC_GEN)) \
 269	$(CSRCS:.c=.$(OBJ_SUFFIX)) \
 270	$(patsubst %.cc,%.$(OBJ_SUFFIX),$(CPPSRCS:.cpp=.$(OBJ_SUFFIX))) \
 271	$(CMSRCS:.m=.$(OBJ_SUFFIX)) \
 272	$(CMMSRCS:.mm=.$(OBJ_SUFFIX)) \
 273	$(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX))
 274OBJS	= $(strip $(_OBJS))
 275endif
 276
 277ifndef HOST_OBJS
 278_HOST_OBJS		= \
 279        $(addprefix host_,$(HOST_CSRCS:.c=.$(OBJ_SUFFIX))) \
 280	$(addprefix host_,$(patsubst %.cc,%.$(OBJ_SUFFIX),$(HOST_CPPSRCS:.cpp=.$(OBJ_SUFFIX)))) \
 281	$(addprefix host_,$(HOST_CMSRCS:.m=.$(OBJ_SUFFIX))) \
 282	$(addprefix host_,$(HOST_CMMSRCS:.mm=.$(OBJ_SUFFIX)))
 283HOST_OBJS = $(strip $(_HOST_OBJS))
 284endif
 285
 286LIBOBJS			:= $(addprefix \", $(OBJS))
 287LIBOBJS			:= $(addsuffix \", $(LIBOBJS))
 288
 289ifndef MOZ_AUTO_DEPS
 290ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
 291MDDEPFILES		= $(addprefix $(MDDEPDIR)/,$(OBJS:.$(OBJ_SUFFIX)=.pp))
 292ifndef NO_GEN_XPT
 293MDDEPFILES		+= $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.xpt)) \
 294			   $(addprefix $(MDDEPDIR)/,$(SDK_XPIDLSRCS:.idl=.xpt))
 295endif
 296endif
 297endif
 298
 299ALL_TRASH = \
 300	$(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
 301	$(filter-out $(ASFILES),$(OBJS:.$(OBJ_SUFFIX)=.s)) $(OBJS:.$(OBJ_SUFFIX)=.ii) \
 302	$(OBJS:.$(OBJ_SUFFIX)=.i) \
 303	$(HOST_PROGOBJS) $(HOST_OBJS) $(IMPORT_LIBRARY) $(DEF_FILE)\
 304	$(EXE_DEF_FILE) so_locations _gen _stubs $(wildcard *.res) $(wildcard *.RES) \
 305	$(wildcard *.pdb) $(CODFILE) $(MAPFILE) $(IMPORT_LIBRARY) \
 306	$(SHARED_LIBRARY:$(DLL_SUFFIX)=.exp) $(wildcard *.ilk) \
 307	$(PROGRAM:$(BIN_SUFFIX)=.exp) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.exp) \
 308	$(PROGRAM:$(BIN_SUFFIX)=.lib) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.lib) \
 309	$(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.$(OBJ_SUFFIX)) \
 310	$(wildcard gts_tmp_*) $(LIBRARY:%.a=.%.timestamp)
 311ALL_TRASH_DIRS = \
 312	$(GARBAGE_DIRS) /no-such-file
 313
 314ifdef QTDIR
 315GARBAGE                 += $(MOCSRCS)
 316endif
 317
 318ifdef SIMPLE_PROGRAMS
 319GARBAGE			+= $(SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX))
 320endif
 321
 322ifdef HOST_SIMPLE_PROGRAMS
 323GARBAGE			+= $(HOST_SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX))
 324endif
 325
 326#
 327# the Solaris WorkShop template repository cache.  it occasionally can get
 328# out of sync, so targets like clobber should kill it.
 329#
 330ifeq ($(OS_ARCH),SunOS)
 331ifeq ($(GNU_CXX),)
 332GARBAGE_DIRS += SunWS_cache
 333endif
 334endif
 335
 336ifeq ($(OS_ARCH),OpenVMS)
 337GARBAGE			+= $(wildcard *.*_defines)
 338ifdef SHARED_LIBRARY
 339VMS_SYMVEC_FILE		= $(SHARED_LIBRARY:$(DLL_SUFFIX)=_symvec.opt)
 340ifdef MOZ_DEBUG
 341VMS_SYMVEC_FILE_MODULE	= $(topsrcdir)/build/unix/vms/$(notdir $(SHARED_LIBRARY:$(DLL_SUFFIX)=_dbg_symvec.opt))
 342else
 343VMS_SYMVEC_FILE_MODULE	= $(topsrcdir)/build/unix/vms/$(notdir $(SHARED_LIBRARY:$(DLL_SUFFIX)=_symvec.opt))
 344endif
 345VMS_SYMVEC_FILE_COMP	= $(topsrcdir)/build/unix/vms/component_symvec.opt
 346GARBAGE			+= $(VMS_SYMVEC_FILE)
 347ifdef IS_COMPONENT
 348DSO_LDOPTS := $(filter-out -auto_symvec,$(DSO_LDOPTS)) $(VMS_SYMVEC_FILE)
 349endif
 350endif
 351endif
 352
 353XPIDL_GEN_DIR		= _xpidlgen
 354
 355ifdef MOZ_UPDATE_XTERM
 356# Its good not to have a newline at the end of the titlebar string because it
 357# makes the make -s output easier to read.  Echo -n does not work on all
 358# platforms, but we can trick sed into doing it.
 359UPDATE_TITLE = sed -e "s!Y!$@ in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$(dir)!" $(MOZILLA_DIR)/config/xterm.str;
 360UPDATE_TITLE_export = sed -e "s!Y!export in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$*!" $(MOZILLA_DIR)/config/xterm.str;
 361UPDATE_TITLE_libs = sed -e "s!Y!libs in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$*!" $(MOZILLA_DIR)/config/xterm.str;
 362UPDATE_TITLE_tools = sed -e "s!Y!tools in $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$*!" $(MOZILLA_DIR)/config/xterm.str;
 363endif
 364
 365LOOP_OVER_DIRS = \
 366    @$(EXIT_ON_ERROR) \
 367    $(foreach dir,$(DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true
 368
 369# we only use this for the makefiles target and other stuff that doesn't matter
 370LOOP_OVER_PARALLEL_DIRS = \
 371    @$(EXIT_ON_ERROR) \
 372    $(foreach dir,$(PARALLEL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true
 373
 374LOOP_OVER_STATIC_DIRS = \
 375    @$(EXIT_ON_ERROR) \
 376    $(foreach dir,$(STATIC_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true
 377
 378LOOP_OVER_TOOL_DIRS = \
 379    @$(EXIT_ON_ERROR) \
 380    $(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) $@; ) true
 381
 382ifdef PARALLEL_DIRS
 383# create a bunch of fake targets for order-only processing
 384PARALLEL_DIRS_export = $(addsuffix _export,$(PARALLEL_DIRS))
 385PARALLEL_DIRS_libs = $(addsuffix _libs,$(PARALLEL_DIRS))
 386PARALLEL_DIRS_tools = $(addsuffix _tools,$(PARALLEL_DIRS))
 387
 388.PHONY: $(PARALLEL_DIRS_export) $(PARALLEL_DIRS_libs) $(PARALLEL_DIRS_tools)
 389endif
 390
 391#
 392# Now we can differentiate between objects used to build a library, and
 393# objects used to build an executable in the same directory.
 394#
 395ifndef PROGOBJS
 396PROGOBJS		= $(OBJS)
 397endif
 398
 399ifndef HOST_PROGOBJS
 400HOST_PROGOBJS		= $(HOST_OBJS)
 401endif
 402
 403# MAKE_DIRS: List of directories to build while looping over directories.
 404# A Makefile that needs $(MDDEPDIR) created but doesn't set any of these
 405# variables we know to check can just set NEED_MDDEPDIR explicitly.
 406ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS)$(NEED_MDDEPDIR))
 407MAKE_DIRS		+= $(CURDIR)/$(MDDEPDIR)
 408GARBAGE_DIRS		+= $(MDDEPDIR)
 409endif
 410
 411#
 412# Tags: emacs (etags), vi (ctags)
 413# TAG_PROGRAM := ctags -L -
 414#
 415TAG_PROGRAM		= xargs etags -a
 416
 417#
 418# Turn on C++ linking if we have any .cpp or .mm files
 419# (moved this from config.mk so that config.mk can be included 
 420#  before the CPPSRCS are defined)
 421#
 422ifneq ($(CPPSRCS)$(CMMSRCS),)
 423CPP_PROG_LINK		= 1
 424endif
 425
 426#
 427# Make sure to wrap static libs inside linker specific flags to turn on & off
 428# inclusion of all symbols inside the static libs
 429#
 430ifndef NO_LD_ARCHIVE_FLAGS
 431ifdef SHARED_LIBRARY_LIBS
 432EXTRA_DSO_LDOPTS := $(MKSHLIB_FORCE_ALL) $(SHARED_LIBRARY_LIBS) $(MKSHLIB_UNFORCE_ALL) $(EXTRA_DSO_LDOPTS)
 433endif
 434endif
 435
 436#
 437# This will strip out symbols that the component should not be 
 438# exporting from the .dynsym section.
 439#
 440ifdef IS_COMPONENT
 441EXTRA_DSO_LDOPTS += $(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
 442endif # IS_COMPONENT
 443
 444#
 445# Enforce the requirement that MODULE_NAME must be set 
 446# for components in static builds
 447#
 448ifdef IS_COMPONENT
 449ifdef EXPORT_LIBRARY
 450ifndef FORCE_SHARED_LIB
 451ifndef MODULE_NAME
 452$(error MODULE_NAME is required for components which may be used in static builds)
 453endif
 454endif
 455endif
 456endif
 457
 458#
 459# MacOS X specific stuff
 460#
 461
 462ifeq ($(OS_ARCH),Darwin)
 463ifdef SHARED_LIBRARY
 464ifdef IS_COMPONENT
 465EXTRA_DSO_LDOPTS	+= -bundle
 466else
 467EXTRA_DSO_LDOPTS	+= -dynamiclib -install_name @executable_path/$(SHARED_LIBRARY) -compatibility_version 1 -current_version 1 -single_module
 468endif
 469endif
 470endif
 471
 472#
 473# On NetBSD a.out systems, use -Bsymbolic.  This fixes what would otherwise be
 474# fatal symbol name clashes between components.
 475#
 476ifeq ($(OS_ARCH),NetBSD)
 477ifeq ($(DLL_SUFFIX),.so.1.0)
 478ifdef IS_COMPONENT
 479EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
 480endif
 481endif
 482endif
 483
 484ifeq ($(OS_ARCH),FreeBSD)
 485ifdef IS_COMPONENT
 486EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
 487endif
 488endif
 489
 490ifeq ($(OS_ARCH),NetBSD)
 491ifneq (,$(filter arc cobalt hpcmips mipsco newsmips pmax sgimips,$(OS_TEST)))
 492ifeq ($(MODULE),layout)
 493OS_CFLAGS += -Wa,-xgot
 494OS_CXXFLAGS += -Wa,-xgot
 495endif
 496endif
 497endif
 498
 499ifeq ($(OS_ARCH),Linux)
 500ifneq (,$(filter mips mipsel,$(OS_TEST)))
 501ifeq ($(MODULE),layout)
 502OS_CFLAGS += -Wa,-xgot
 503OS_CXXFLAGS += -Wa,-xgot
 504endif
 505endif
 506endif
 507
 508#
 509# HP-UXBeOS specific section: for COMPONENTS only, add -Bsymbolic flag
 510# which uses internal symbols first
 511#
 512ifeq ($(OS_ARCH),HP-UX)
 513ifdef IS_COMPONENT
 514ifeq ($(GNU_CC)$(GNU_CXX),)
 515EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
 516ifneq ($(HAS_EXTRAEXPORTS),1)
 517MKSHLIB  += -Wl,+eNSGetModule -Wl,+eerrno
 518MKCSHLIB += +eNSGetModule +eerrno
 519ifneq ($(OS_TEST),ia64)
 520MKSHLIB  += -Wl,+e_shlInit
 521MKCSHLIB += +e_shlInit
 522endif # !ia64
 523endif # !HAS_EXTRAEXPORTS
 524endif # non-gnu compilers
 525endif # IS_COMPONENT
 526endif # HP-UX
 527
 528ifeq ($(OS_ARCH),AIX)
 529ifdef IS_COMPONENT
 530ifneq ($(HAS_EXTRAEXPORTS),1)
 531MKSHLIB += -bE:$(MOZILLA_DIR)/build/unix/aix.exp -bnoexpall
 532MKCSHLIB += -bE:$(MOZILLA_DIR)/build/unix/aix.exp -bnoexpall
 533endif # HAS_EXTRAEXPORTS
 534endif # IS_COMPONENT
 535endif # AIX
 536
 537#
 538# OSF1: add -B symbolic flag for components
 539#
 540ifeq ($(OS_ARCH),OSF1)
 541ifdef IS_COMPONENT
 542ifeq ($(GNU_CC)$(GNU_CXX),)
 543EXTRA_DSO_LDOPTS += -B symbolic
 544endif  
 545endif  
 546endif
 547
 548#
 549# Linux: add -Bsymbolic flag for components
 550# 
 551ifeq ($(OS_ARCH),Linux)
 552ifdef IS_COMPONENT
 553EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
 554endif
 555endif 
 556
 557#
 558# MINGW32
 559#
 560ifeq ($(OS_ARCH),WINNT)
 561ifdef GNU_CC
 562ifndef IS_COMPONENT
 563DSO_LDOPTS += -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
 564endif
 565endif
 566endif
 567
 568ifeq ($(USE_TVFS),1)
 569IFLAGS1 = -rb
 570IFLAGS2 = -rb
 571else
 572IFLAGS1 = -m 644
 573IFLAGS2 = -m 755
 574endif
 575
 576ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
 577OUTOPTION = -Fo# eol
 578else
 579OUTOPTION = -o # eol
 580endif # WINNT && !GNU_CC
 581ifneq (,$(filter WINCE,$(OS_ARCH)))
 582OUTOPTION = -Fo# eol
 583endif
 584
 585ifeq ($(OS_TARGET), WINCE)
 586OUTOPTION = -Fo# eol
 587HOST_OUTOPTION = -Fo# eol
 588else
 589
 590ifeq (,$(CROSS_COMPILE))
 591HOST_OUTOPTION = $(OUTOPTION)
 592else
 593HOST_OUTOPTION = -o # eol
 594endif
 595
 596endif
 597################################################################################
 598
 599# SUBMAKEFILES: List of Makefiles for next level down.
 600#   This is used to update or create the Makefiles before invoking them.
 601SUBMAKEFILES += $(addsuffix /Makefile, $(DIRS) $(TOOL_DIRS) $(PARALLEL_DIRS))
 602
 603# The root makefile doesn't want to do a plain export/libs, because
 604# of the tiers and because of libxul. Suppress the default rules in favor
 605# of something else. Makefiles which use this var *must* provide a sensible
 606# default rule before including rules.mk
 607ifndef SUPPRESS_DEFAULT_RULES
 608ifdef TIERS
 609
 610DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_dirs))
 611STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs))
 612
 613default all alldep::
 614	$(EXIT_ON_ERROR) \
 615	$(foreach tier,$(TIERS),$(MAKE) tier_$(tier); ) true
 616
 617else
 618
 619default all::
 620	@$(EXIT_ON_ERROR) \
 621	$(foreach dir,$(STATIC_DIRS),$(MAKE) -C $(dir); ) true
 622	$(MAKE) export
 623	$(MAKE) libs
 624	$(MAKE) tools
 625
 626# Do depend as well
 627alldep:: 
 628	$(MAKE) export
 629	$(MAKE) depend
 630	$(MAKE) libs
 631	$(MAKE) tools
 632
 633endif # TIERS
 634endif # SUPPRESS_DEFAULT_RULES
 635
 636ifeq ($(filter s,$(MAKEFLAGS)),)
 637ECHO := echo
 638QUIET :=
 639else
 640ECHO := true
 641QUIET := -q
 642endif
 643
 644MAKE_TIER_SUBMAKEFILES = +$(if $(tier_$*_dirs),$(MAKE) $(addsuffix /Makefile,$(tier_$*_dirs)))
 645
 646export_tier_%: 
 647	@$(ECHO) "$@"
 648	@$(MAKE_TIER_SUBMAKEFILES)
 649	@$(EXIT_ON_ERROR) \
 650	$(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) export; ) true
 651
 652libs_tier_%:
 653	@$(ECHO) "$@"
 654	@$(MAKE_TIER_SUBMAKEFILES)
 655	@$(EXIT_ON_ERROR) \
 656	$(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) libs; ) true
 657
 658tools_tier_%:
 659	@$(ECHO) "$@"
 660	@$(MAKE_TIER_SUBMAKEFILES)
 661	@$(EXIT_ON_ERROR) \
 662	$(foreach dir,$(tier_$*_dirs),$(MAKE) -C $(dir) tools; ) true
 663
 664$(foreach tier,$(TIERS),tier_$(tier))::
 665	@$(ECHO) "$@: $($@_staticdirs) $($@_dirs)"
 666	@$(EXIT_ON_ERROR) \
 667	$(foreach dir,$($@_staticdirs),$(MAKE) -C $(dir); ) true
 668	$(MAKE) export_$@
 669	$(MAKE) libs_$@
 670
 671# Do everything from scratch
 672everything::
 673	$(MAKE) clean
 674	$(MAKE) alldep
 675
 676# Add dummy depend target for tinderboxes
 677depend::
 678
 679ifdef ALL_PLATFORMS
 680all_platforms:: $(NFSPWD)
 681	@d=`$(NFSPWD)`;							\
 682	if test ! -d LOGS; then rm -rf LOGS; mkdir LOGS; else true; fi;	\
 683	for h in $(PLATFORM_HOSTS); do					\
 684		echo "On $$h: $(MAKE) $(ALL_PLATFORMS) >& LOGS/$$h.log";\
 685		rsh $$h -n "(chdir $$d;					\
 686			     $(MAKE) $(ALL_PLATFORMS) >& LOGS/$$h.log;	\
 687			     echo DONE) &" 2>&1 > LOGS/$$h.pid &	\
 688		sleep 1;						\
 689	done
 690
 691$(NFSPWD):
 692	cd $(@D); $(MAKE) $(@F)
 693endif
 694
 695# Target to only regenerate makefiles
 696makefiles: $(SUBMAKEFILES)
 697ifneq (,$(DIRS)$(TOOL_DIRS)$(PARALLEL_DIRS))
 698	+$(LOOP_OVER_PARALLEL_DIRS)
 699	+$(LOOP_OVER_DIRS)
 700	+$(LOOP_OVER_TOOL_DIRS)
 701endif
 702
 703ifdef PARALLEL_DIRS
 704export:: $(PARALLEL_DIRS_export)
 705
 706$(PARALLEL_DIRS_export): %_export: %/Makefile
 707	+@$(UPDATE_TITLE_export) $(MAKE) -C $* export
 708endif
 709
 710export:: $(SUBMAKEFILES) $(MAKE_DIRS) $(if $(EXPORTS)$(XPIDLSRCS)$(SDK_HEADERS)$(SDK_XPIDLSRCS),$(PUBLIC)) $(if $(SDK_HEADERS)$(SDK_XPIDLSRCS),$(SDK_PUBLIC)) $(if $(XPIDLSRCS),$(IDL_DIR)) $(if $(SDK_XPIDLSRCS),$(SDK_IDL_DIR))
 711	+$(LOOP_OVER_DIRS)
 712	+$(LOOP_OVER_TOOL_DIRS)
 713
 714ifdef PARALLEL_DIRS
 715tools:: $(PARALLEL_DIRS_tools)
 716
 717$(PARALLEL_DIRS_tools): %_tools: %/Makefile
 718	+@$(UPDATE_TITLE_tools) $(MAKE) -C $* tools
 719endif
 720
 721tools:: $(SUBMAKEFILES) $(MAKE_DIRS)
 722	+$(LOOP_OVER_DIRS)
 723ifdef TOOL_DIRS
 724	@$(EXIT_ON_ERROR) \
 725	$(foreach dir,$(TOOL_DIRS),$(UPDATE_TITLE) $(MAKE) -C $(dir) libs; ) true
 726endif
 727
 728#
 729# Rule to create list of libraries for final link
 730#
 731export::
 732ifdef LIBRARY_NAME
 733ifdef EXPORT_LIBRARY
 734ifdef IS_COMPONENT
 735ifdef BUILD_STATIC_LIBS
 736	@$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(LIBRARY_NAME)
 737ifdef MODULE_NAME
 738	@$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMP_NAMES) $(MODULE_NAME)
 739endif
 740endif
 741else
 742	$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(LIBRARY_NAME)
 743endif # IS_COMPONENT
 744endif # EXPORT_LIBRARY
 745endif # LIBRARY_NAME
 746
 747# Create dependencies on static (and shared EXTRA_DSO_LIBS) libraries
 748LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(LIBS))
 749HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(HOST_LIBS))
 750DSO_LDOPTS_DEPS = $(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS))
 751
 752##############################################
 753ifdef PARALLEL_DIRS
 754libs:: $(PARALLEL_DIRS_libs)
 755
 756$(PARALLEL_DIRS_libs): %_libs: %/Makefile
 757	+@$(UPDATE_TITLE_libs) $(MAKE) -C $* libs
 758endif
 759
 760libs:: $(SUBMAKEFILES) $(MAKE_DIRS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(HOST_PROGRAM) $(PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
 761ifndef NO_DIST_INSTALL
 762ifdef LIBRARY
 763ifdef EXPORT_LIBRARY # Stage libs that will be linked into a static build
 764ifdef IS_COMPONENT
 765	$(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib/components
 766else
 767	$(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib
 768endif
 769endif # EXPORT_LIBRARY
 770ifdef DIST_INSTALL
 771ifdef IS_COMPONENT
 772	$(error Shipping static component libs makes no sense.)
 773else
 774	$(INSTALL) $(IFLAGS1) $(LIBRARY) $(DIST)/lib
 775endif
 776endif # DIST_INSTALL
 777endif # LIBRARY
 778ifdef SHARED_LIBRARY
 779ifdef IS_COMPONENT
 780	$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
 781	$(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
 782ifdef BEOS_ADDON_WORKAROUND
 783	( cd $(FINAL_TARGET)/components && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
 784endif
 785else # ! IS_COMPONENT
 786ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
 787	$(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(DIST)/lib
 788else
 789	$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DIST)/lib
 790endif
 791	$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)
 792ifdef BEOS_ADDON_WORKAROUND
 793	( cd $(FINAL_TARGET) && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
 794endif
 795endif # IS_COMPONENT
 796endif # SHARED_LIBRARY
 797ifdef PROGRAM
 798	$(INSTALL) $(IFLAGS2) $(PROGRAM) $(FINAL_TARGET)
 799endif
 800ifdef SIMPLE_PROGRAMS
 801	$(INSTALL) $(IFLAGS2) $(SIMPLE_PROGRAMS) $(FINAL_TARGET)
 802endif
 803ifdef HOST_PROGRAM
 804	$(INSTALL) $(IFLAGS2) $(HOST_PROGRAM) $(DIST)/host/bin
 805endif
 806ifdef HOST_SIMPLE_PROGRAMS
 807	$(INSTALL) $(IFLAGS2) $(HOST_SIMPLE_PROGRAMS) $(DIST)/host/bin
 808endif
 809ifdef HOST_LIBRARY
 810	$(INSTALL) $(IFLAGS1) $(HOST_LIBRARY) $(DIST)/host/lib
 811endif
 812ifdef JAVA_LIBRARY
 813ifdef IS_COMPONENT
 814	$(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)/components
 815else
 816	$(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)
 817endif
 818endif # JAVA_LIBRARY
 819endif # !NO_DIST_INSTALL
 820	+$(LOOP_OVER_DIRS)
 821
 822##############################################
 823
 824ifndef NO_PROFILE_GUIDED_OPTIMIZE
 825ifneq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
 826ifeq ($(OS_ARCH)_$(GNU_CC)$(INTERNAL_TOOLS), WINNT_)
 827# Force re-linking when building with PGO, since
 828# the MSVC linker does all the work.  We force re-link
 829# in both stages so you can do depend builds with PGO.
 830ifdef SHARED_LIBRARY
 831$(SHARED_LIBRARY): FORCE
 832BINARY_BASENAME = $(SHARED_LIBRARY:$(DLL_SUFFIX)=)
 833endif
 834ifdef PROGRAM
 835$(PROGRAM): FORCE
 836BINARY_BASENAME = $(PROGRAM:$(BIN_SUFFIX)=)
 837endif
 838
 839ifdef MOZ_PROFILE_USE
 840# In the second pass, we need to merge the pgc files into the pgd file.
 841# The compiler would do this for us automatically if they were in the right
 842# place, but they're in dist/bin.
 843ifdef BINARY_BASENAME
 844export::
 845	$(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
 846	  $(BINARY_BASENAME) $(DIST)/bin
 847endif
 848endif # MOZ_PROFILE_USE
 849endif # WINNT_
 850endif # MOZ_PROFILE_GENERATE || MOZ_PROFILE_USE
 851endif # NO_PROFILE_GUIDED_OPTIMIZE
 852
 853##############################################
 854
 855checkout:
 856	$(MAKE) -C $(topsrcdir) -f client.mk checkout
 857
 858run_viewer: $(FINAL_TARGET)/viewer
 859	cd $(FINAL_TARGET); \
 860	MOZILLA_FIVE_HOME=`pwd` \
 861	LD_LIBRARY_PATH=".:$(LIBS_PATH):$$LD_LIBRARY_PATH" \
 862	viewer
 863
 864clean clobber realclean clobber_all:: $(SUBMAKEFILES)
 865	-rm -f $(ALL_TRASH)
 866	-rm -rf $(ALL_TRASH_DIRS)
 867	+-$(LOOP_OVER_PARALLEL_DIRS)
 868	+-$(LOOP_OVER_DIRS)
 869	+-$(LOOP_OVER_STATIC_DIRS)
 870	+-$(LOOP_OVER_TOOL_DIRS)
 871
 872distclean:: $(SUBMAKEFILES)
 873	+-$(LOOP_OVER_PARALLEL_DIRS)
 874	+-$(LOOP_OVER_DIRS)
 875	+-$(LOOP_OVER_STATIC_DIRS)
 876	+-$(LOOP_OVER_TOOL_DIRS)
 877	-rm -rf $(ALL_TRASH_DIRS) 
 878	-rm -f $(ALL_TRASH)  \
 879	Makefile .HSancillary \
 880	$(wildcard *.$(OBJ_SUFFIX)) $(wildcard *.ho) $(wildcard host_*.o*) \
 881	$(wildcard *.$(LIB_SUFFIX)) $(wildcard *$(DLL_SUFFIX)) \
 882	$(wildcard *.$(IMPORT_LIB_SUFFIX))
 883ifeq ($(OS_ARCH),OS2)
 884	-rm -f $(PROGRAM:.exe=.map)
 885endif
 886
 887alltags:
 888	rm -f TAGS
 889	find $(topsrcdir) -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' -o -name '*.idl' \) -print | $(TAG_PROGRAM)
 890
 891#
 892# PROGRAM = Foo
 893# creates OBJS, links with LIBS to create Foo
 894#
 895$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) $(EXE_DEF_FILE) $(RESFILE) Makefile Makefile.in
 896ifeq (WINCE,$(OS_ARCH))
 897	$(LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
 898else
 899ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
 900	$(LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
 901ifdef MSMANIFEST_TOOL
 902	@if test -f $@.manifest; then \
 903		if test -f "$(srcdir)/$@.manifest"; then \
 904			mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
 905		else \
 906			mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
 907		fi; \
 908		rm -f $@.manifest; \
 909	fi
 910endif	# MSVC with manifest tool
 911else
 912ifeq ($(CPP_PROG_LINK),1)
 913	$(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(EXE_DEF_FILE)
 914else # ! CPP_PROG_LINK
 915	$(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
 916endif # CPP_PROG_LINK
 917endif # WINNT && !GNU_CC
 918endif # WINCE
 919
 920ifdef ENABLE_STRIP
 921	$(STRIP) $@
 922endif
 923ifdef MOZ_POST_PROGRAM_COMMAND
 924	$(MOZ_POST_PROGRAM_COMMAND) $@
 925endif
 926ifeq ($(OS_ARCH),BeOS)
 927ifdef BEOS_PROGRAM_RESOURCE
 928	xres -o $@ $(BEOS_PROGRAM_RESOURCE)
 929	mimeset $@
 930endif
 931endif # BeOS
 932
 933$(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) Makefile Makefile.in
 934ifeq (WINCE,$(OS_ARCH))
 935	$(HOST_LD) -NOLOGO -OUT:$@ $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 936else
 937ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
 938	$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 939ifdef MSMANIFEST_TOOL
 940	@if test -f $@.manifest; then \
 941		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
 942		rm -f $@.manifest; \
 943	fi
 944endif	# MSVC with manifest tool
 945else
 946ifeq ($(CPP_PROG_LINK),1)
 947	$(HOST_CXX) -o $@ $(HOST_CXXFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 948else
 949	$(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 950endif # CPP_PROG_LINK
 951endif
 952endif
 953
 954#
 955# This is an attempt to support generation of multiple binaries
 956# in one directory, it assumes everything to compile Foo is in
 957# Foo.o (from either Foo.c or Foo.cpp).
 958#
 959# SIMPLE_PROGRAMS = Foo Bar
 960# creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
 961#
 962$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
 963ifeq (WINCE,$(OS_ARCH))
 964	$(LD) -nologo  -entry:main -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
 965else
 966ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
 967	$(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
 968ifdef MSMANIFEST_TOOL
 969	@if test -f $@.manifest; then \
 970		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
 971		rm -f $@.manifest; \
 972	fi
 973endif	# MSVC with manifest tool
 974else
 975ifeq ($(CPP_PROG_LINK),1)
 976	$(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS)
 977else
 978	$(CC) $(WRAP_MALLOC_CFLAGS) $(CFLAGS) $(OUTOPTION)$@ $< $(WIN32_EXE_LDFLAGS) $(SOLARIS_JEMALLOC_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS)
 979endif # CPP_PROG_LINK
 980endif # WINNT && !GNU_CC
 981endif # WINCE
 982
 983ifdef ENABLE_STRIP
 984	$(STRIP) $@
 985endif
 986ifdef MOZ_POST_PROGRAM_COMMAND
 987	$(MOZ_POST_PROGRAM_COMMAND) $@
 988endif
 989
 990$(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(OBJ_SUFFIX) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) Makefile Makefile.in
 991ifeq (WINCE,$(OS_ARCH))
 992	$(HOST_LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 993else
 994ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
 995	$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 996else
 997ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX))
 998	$(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXXFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 999else
1000	$(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_CFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
1001endif
1002endif
1003endif
1004
1005#
1006# Purify target.  Solaris/sparc only to start.
1007# Purify does not recognize "egcs" or "c++" so we go with 
1008# "gcc" and "g++" for now.
1009#
1010pure:	$(PROGRAM)
1011ifeq ($(CPP_PROG_LINK),1)
1012	$(PURIFY) $(CCC) -o $^.pure $(CXXFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1013else
1014	$(PURIFY) $(CC) -o $^.pure $(CFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1015endif
1016ifndef NO_DIST_INSTALL
1017	$(INSTALL) $(IFLAGS2) $^.pure $(FINAL_TARGET)
1018endif
1019
1020quantify: $(PROGRAM)
1021ifeq ($(CPP_PROG_LINK),1)
1022	$(QUANTIFY) $(CCC) -o $^.quantify $(CXXFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1023else
1024	$(QUANTIFY) $(CC) -o $^.quantify $(CFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
1025endif
1026ifndef NO_DIST_INSTALL
1027	$(INSTALL) $(IFLAGS2) $^.quantify $(FINAL_TARGET)
1028endif
1029
1030#
1031# This allows us to create static versions of the shared libraries
1032# that are built using other static libraries.  Confused...?
1033#
1034ifdef SHARED_LIBRARY_LIBS
1035ifeq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
1036ifneq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB))
1037LOBJS	+= $(SHARED_LIBRARY_LIBS)
1038endif
1039else
1040ifneq (,$(filter OSF1 BSD_OS FreeBSD NetBSD OpenBSD SunOS Darwin,$(OS_ARCH)))
1041CLEANUP1	:= | egrep -v '(________64ELEL_|__.SYMDEF)'
1042CLEANUP2	:= rm -f ________64ELEL_ __.SYMDEF
1043else
1044CLEANUP2	:= true
1045endif
1046SUB_LOBJS	= $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
1047endif
1048endif
1049ifdef MOZILLA_PROBE_LIBS
1050PROBE_LOBJS	= $(shell for lib in $(MOZILLA_PROBE_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
1051endif
1052ifdef DTRACE_PROBE_OBJ
1053EXTRA_DEPS += $(DTRACE_PROBE_OBJ)
1054endif
1055
1056$(LIBRARY): $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) Makefile Makefile.in
1057	rm -f $@
1058ifneq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
1059ifdef SHARED_LIBRARY_LIBS
1060	@rm -f $(SUB_LOBJS)
1061	@for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1062endif
1063endif
1064	$(AR) $(AR_FLAGS) $(OBJS) $(LOBJS) $(SUB_LOBJS)
1065	$(RANLIB) $@
1066	@rm -f foodummyfilefoo $(SUB_LOBJS)
1067
1068ifeq (,$(filter-out WINNT WINCE, $(OS_ARCH)))
1069$(IMPORT_LIBRARY): $(SHARED_LIBRARY)
1070endif
1071
1072ifeq ($(OS_ARCH),OS2)
1073$(DEF_FILE): $(OBJS) $(SHARED_LIBRARY_LIBS)
1074	rm -f $@
1075	echo LIBRARY $(LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@
1076	echo PROTMODE >> $@
1077	echo CODE    LOADONCALL MOVEABLE DISCARDABLE >> $@
1078	echo DATA    PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
1079	echo EXPORTS >> $@
1080ifeq ($(IS_COMPONENT),1)
1081ifeq ($(HAS_EXTRAEXPORTS),1)
1082ifndef MOZ_OS2_USE_DECLSPEC
1083	$(FILTER) $(OBJS) $(SHARED_LIBRARY_LIBS) >> $@
1084endif	
1085else
1086	echo    _NSGetModule >> $@
1087endif
1088else
1089ifndef MOZ_OS2_USE_DECLSPEC
1090	$(FILTER) $(OBJS) $(SHARED_LIBRARY_LIBS) >> $@
1091endif	
1092endif
1093	$(ADD_TO_DEF_FILE)
1094
1095ifdef MOZ_OS2_USE_DECLSPEC
1096$(IMPORT_LIBRARY): $(SHARED_LIBRARY)
1097else
1098$(IMPORT_LIBRARY): $(DEF_FILE)
1099endif
1100	rm -f $@
1101	$(IMPLIB) $@ $^
1102	$(RANLIB) $@
1103endif # OS/2
1104
1105$(HOST_LIBRARY): $(HOST_OBJS) Makefile
1106	rm -f $@
1107	$(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
1108	$(HOST_RANLIB) $@
1109
1110ifdef NO_LD_ARCHIVE_FLAGS
1111SUB_SHLOBJS = $(SUB_LOBJS)
1112endif
1113
1114ifdef HAVE_DTRACE
1115ifndef XP_MACOSX
1116ifdef DTRACE_PROBE_OBJ
1117ifndef DTRACE_LIB_DEPENDENT
1118$(DTRACE_PROBE_OBJ): $(OBJS)
1119	dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(OBJS)
1120endif
1121endif
1122endif
1123endif
1124
1125# On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
1126# so instead of deleting .o files after repacking them into a dylib, we make
1127# symlinks back to the originals. The symlinks are a no-op for stabs debugging,
1128# so no need to conditionalize on OS version or debugging format.
1129
1130$(SHARED_LIBRARY): $(OBJS) $(LOBJS) $(DEF_FILE) $(RESFILE) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(DSO_LDOPTS_DEPS) Makefile Makefile.in
1131ifndef INCREMENTAL_LINKER
1132	rm -f $@
1133endif
1134ifeq ($(OS_ARCH),OpenVMS)
1135	@if test ! -f $(VMS_SYMVEC_FILE); then \
1136	  if test -f $(VMS_SYMVEC_FILE_MODULE); then \
1137	    echo Creating specific component options file $(VMS_SYMVEC_FILE); \
1138	    cp $(VMS_SYMVEC_FILE_MODULE) $(VMS_SYMVEC_FILE); \
1139	  fi; \
1140	fi
1141ifdef IS_COMPONENT
1142	@if test ! -f $(VMS_SYMVEC_FILE); then \
1143	  echo Creating generic component options file $(VMS_SYMVEC_FILE); \
1144	  cp $(VMS_SYMVEC_FILE_COMP) $(VMS_SYMVEC_FILE); \
1145	fi
1146endif
1147endif # OpenVMS
1148ifdef NO_LD_ARCHIVE_FLAGS
1149ifdef SHARED_LIBRARY_LIBS
1150	@rm -f $(SUB_SHLOBJS)
1151	@for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1152ifeq ($(OS_ARCH),Darwin)
1153	@echo Making symlinks to the original object files in the archive libraries $(SHARED_LIBRARY_LIBS)
1154	@for lib in $(SHARED_LIBRARY_LIBS); do \
1155		libdir=`echo $$lib|sed -e 's,/[^/]*\.a,,'`; \
1156		ofiles=`$(AR_LIST) $${lib}`; \
1157		for ofile in $$ofiles; do \
1158			if [ -f $$libdir/$$ofile ]; then \
1159				rm -f $$ofile; \
1160				ln -s $$libdir/$$ofile $$ofile; \
1161			fi; \
1162		done; \
1163	done
1164endif
1165endif # SHARED_LIBRARY_LIBS
1166endif # NO_LD_ARCHIVE_FLAGS
1167ifdef DTRACE_LIB_DEPENDENT
1168	@rm -f $(PROBE_LOBJS)
1169	@for lib in $(MOZILLA_PROBE_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
1170ifndef XP_MACOSX
1171	dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o  $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS)
1172endif
1173	@for lib in $(MOZILLA_PROBE_LIBS); do \
1174		ofiles=`$(AR_LIST) $${lib}`; \
1175		$(AR_DELETE) $${lib} $$ofiles; \
1176	done
1177	$(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
1178	@rm -f $(PROBE_LOBJS)
1179	@rm -f $(DTRACE_PROBE_OBJ)
1180	@for lib in $(MOZILLA_PROBE_LIBS); do \
1181		if [ -L $${lib} ]; then rm -f `readlink $${lib}`; fi; \
1182	done
1183	@rm -f $(MOZILLA_PROBE_LIBS)
1184
1185else # ! DTRACE_LIB_DEPENDENT
1186	$(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
1187endif # DTRACE_LIB_DEPENDENT
1188
1189ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
1190ifdef MSMANIFEST_TOOL
1191ifdef EMBED_MANIFEST_AT
1192	@if test -f $@.manifest; then \
1193		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
1194		rm -f $@.manifest; \
1195	fi
1196endif   # EMBED_MANIFEST_AT
1197endif	# MSVC with manifest tool
1198endif	# WINNT && !GCC
1199ifeq ($(OS_ARCH),Darwin)
1200else # non-Darwin
1201	@rm -f $(SUB_SHLOBJS)
1202endif # Darwin
1203	@rm -f foodummyfilefoo $(DELETE_AFTER_LINK)
1204	chmod +x $@
1205ifdef ENABLE_STRIP
1206	$(STRIP) $@
1207endif
1208ifdef MOZ_POST_DSO_LIB_COMMAND
1209	$(MOZ_POST_DSO_LIB_COMMAND) $@
1210endif
1211
1212ifdef MOZ_AUTO_DEPS
1213ifdef COMPILER_DEPEND
1214ifeq (__SunOS,$(GNU_CC)_$(GNU_CXX)_$(OS_ARCH))
1215_MDDEPFILE = $(MDDEPDIR)/$(@F).pp
1216
1217define MAKE_DEPS_AUTO_CC
1218if test -d $(@D); then \
1219	echo "Building deps for $< using Sun Studio cc"; \
1220	$(CC) $(COMPILE_CFLAGS) -xM  $< >$(_MDDEPFILE) ; \
1221fi
1222endef
1223define MAKE_DEPS_AUTO_CXX
1224if test -d $(@D); then \
1225	echo "Building deps for $< using Sun Studio CC"; \
1226	$(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \
1227fi
1228endef
1229endif # Sun Studio on Solaris
1230else # COMPILER_DEPEND
1231#
1232# Generate dependencies on the fly
1233#
1234_MDDEPFILE = $(MDDEPDIR)/$(@F).pp
1235
1236define MAKE_DEPS_AUTO
1237if test -d $(@D); then \
1238	echo "Building deps for $<"; \
1239	$(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f- $(DEFINES) $(ACDEFINES) $(INCLUDES) $< 2>/dev/null | sed -e "s|^[^ ]*/||" > $(_MDDEPFILE) ; \
1240fi
1241endef
1242
1243MAKE_DEPS_AUTO_CC = $(MAKE_DEPS_AUTO)
1244MAKE_DEPS_AUTO_CXX = $(MAKE_DEPS_AUTO)
1245
1246endif # COMPILER_DEPEND
1247
1248endif # MOZ_AUTO_DEPS
1249
1250ifdef MOZ_MEMORY
1251ifeq ($(OS_ARCH),SunOS)
1252SOLARIS_JEMALLOC_LDFLAGS = $(call EXPAND_LIBNAME_PATH,jemalloc,$(DIST)/lib)
1253endif
1254endif
1255
1256# Rules for building native targets must come first because of the host_ prefix
1257host_%.$(OBJ_SUFFIX): %.c Makefile Makefile.in
1258	$(REPORT_BUILD)
1259	$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1260
1261host_%.$(OBJ_SUFFIX): %.cpp Makefile Makefile.in
1262	$(REPORT_BUILD)
1263	$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1264
1265host_%.$(OBJ_SUFFIX): %.cc Makefile Makefile.in
1266	$(REPORT_BUILD)
1267	$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1268
1269host_%.$(OBJ_SUFFIX): %.m Makefile Makefile.in
1270	$(REPORT_BUILD)
1271	$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1272
1273host_%.$(OBJ_SUFFIX): %.mm Makefile Makefile.in
1274	$(REPORT_BUILD)
1275	$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
1276
1277%: %.c Makefile Makefile.in
1278	$(REPORT_BUILD)
1279	@$(MAKE_DEPS_AUTO_CC)
1280	$(ELOG) $(CC) $(CFLAGS) $(LDFLAGS) $(OUTOPTION)$@ $(_VPATH_SRCS)
1281
1282%.$(OBJ_SUFFIX): %.c Makefile Makefile.in
1283	$(REPORT_BUILD)
1284	@$(MAKE_DEPS_AUTO_CC)
1285	$(ELOG) $(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $(_VPATH_SRCS)
1286
1287moc_%.cpp: %.h Makefile Makefile.in
1288	$(MOC) $< $(OUTOPTION)$@ 
1289
1290ifdef ASFILES
1291# The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
1292# a '-c' flag.
1293%.$(OBJ_SUFFIX): %.$(ASM_SUFFIX) Makefile Makefile.in
1294	$(AS) -o $@ $(ASFLAGS) $(AS_DASH_C_FLAG) $(_VPATH_SRCS)
1295endif
1296
1297%.$(OBJ_SUFFIX): %.S Makefile Makefile.in
1298	$(AS) -o $@ $(ASFLAGS) -c $<
1299
1300%: %.cpp Makefile Makefile.in
1301	@$(MAKE_DEPS_AUTO_CXX)
1302	$(CCC) $(OUTOPTION)$@ $(CXXFLAGS) $(_VPATH_SRCS) $(LDFLAGS)
1303
1304#
1305# Please keep the next two rules in sync.
1306#
1307%.$(OBJ_SUFFIX): %.cc Makefile Makefile.in
1308	$(REPORT_BUILD)
1309	@$(MAKE_DEPS_AUTO_CXX)
1310	$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1311
1312%.$(OBJ_SUFFIX): %.cpp Makefile Makefile.in
1313	$(REPORT_BUILD)
1314	@$(MAKE_DEPS_AUTO_CXX)
1315ifdef STRICT_CPLUSPLUS_SUFFIX
1316	echo "#line 1 \"$*.cpp\"" | cat - $*.cpp > t_$*.cc
1317	$(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) t_$*.cc
1318	rm -f t_$*.cc
1319else
1320	$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1321endif #STRICT_CPLUSPLUS_SUFFIX
1322
1323$(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.mm Makefile Makefile.in
1324	$(REPORT_BUILD)
1325	@$(MAKE_DEPS_AUTO_CXX)
1326	$(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(_VPATH_SRCS)
1327
1328$(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.m Makefile Makefile.in
1329	$(REPORT_BUILD)
1330	@$(MAKE_DEPS_AUTO_CC)
1331	$(ELOG) $(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $(_VPATH_SRCS)
1332
1333%.s: %.cpp
1334	$(CCC) -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1335
1336%.s: %.cc
1337	$(CCC) -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS)
1338
1339%.s: %.c
1340	$(CC) -S $(COMPILE_CFLAGS) $(_VPATH_SRCS)
1341
1342%.i: %.cpp
1343	$(CCC) -C -E $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) > $*.i
1344
1345%.i: %.cc
1346	$(CCC) -C -E $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) > $*.i
1347
1348%.i: %.c
1349	$(CC) -C -E $(COMPILE_CFLAGS) $(_VPATH_SRCS) > $*.i
1350
1351%.i: %.mm
1352	$(CCC) -C -E $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(_VPATH_SRCS) > $*.i
1353
1354%.res: %.rc
1355	@echo Creating Resource file: $@
1356ifeq ($(OS_ARCH),OS2)
1357	$(RC) $(RCFLAGS:-D%=-d %) -i $(subst /,\,$(srcdir)) -r $< $@
1358else
1359ifdef GNU_CC
1360	$(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) $(OUTOPTION)$@ $(_VPATH_SRCS)
1361else
1362	$(RC) $(RCFLAGS) -r $(DEFINES) $(INCLUDES) $(OUTOPTION)$@ $(_VPATH_SRCS)
1363endif
1364endif
1365
1366# need 3 separate lines for OS/2
1367%: %.pl
1368	rm -f $@
1369	cp $< $@
1370	chmod +x $@
1371
1372%: %.sh
1373	rm -f $@; cp $< $@; chmod +x $@
1374
1375# Cancel these implicit rules
1376#
1377%: %,v
1378
1379%: RCS/%,v
1380
1381%: s.%
1382
1383%: SCCS/s.%
1384
1385###############################################################################
1386# Java rules
1387###############################################################################
1388ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
1389SEP := ;
1390else
1391SEP := :
1392endif
1393
1394EMPTY :=
1395SPACE := $(EMPTY) $(EMPTY)
1396
1397# Cygwin and MSYS have their own special path form, but javac expects the source
1398# and class paths to be in the DOS form (i.e. e:/builds/...).  This function
1399# does the appropriate conversion on Windows, but is a noop on other systems.
1400ifeq (,$(filter-out WINNT WINCE, $(HOST_OS_ARCH)))
1401ifdef CYGWIN_WRAPPER
1402normalizepath = $(foreach p,$(1),$(shell cygpath -m $(p)))
1403else
1404# assume MSYS
1405#  We use 'pwd -W' to get DOS form of the path.  However, since the given path
1406#  could be a file or a non-existent path, we cannot call 'pwd -W' directly
1407#  on the path.  Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
1408#  on it, then merge with the rest of the path.
1409root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\1|")
1410non-root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\2|")
1411normalizepath = $(foreach p,$(1),$(if $(filter /%,$(1)),$(shell cd $(call root-path,$(1)) && pwd -W)$(call non-root-path,$(1)),$(1)))
1412endif
1413else
1414normalizepath = $(1)
1415endif
1416
1417_srcdir = $(call normalizepath,$(srcdir))
1418ifdef JAVA_SOURCEPATH
1419SP = $(subst $(SPACE),$(SEP),$(call normalizepath,$(strip $(JAVA_SOURCEPATH))))
1420_JAVA_SOURCEPATH = ".$(SEP)$(_srcdir)$(SEP)$(SP)"
1421else
1422_JAVA_SOURCEPATH = ".$(SEP)$(_srcdir)"
1423endif
1424
1425ifdef JAVA_CLASSPATH
1426CP = $(subst $(SPACE),$(SEP),$(call normalizepath,$(strip $(JAVA_CLASSPATH))))
1427_JAVA_CLASSPATH = ".$(SEP)$(CP)"
1428else
1429_JAVA_CLASSPATH = .
1430endif
1431
1432_JAVA_DIR = _java
1433$(_JAVA_DIR)::
1434	$(NSINSTALL) -D $@
1435
1436$(_JAVA_DIR)/%.class: %.java Makefile Makefile.in $(_JAVA_DIR)
1437	$(CYGWIN_WRAPPER) $(JAVAC) $(JAVAC_FLAGS) -classpath $(_JAVA_CLASSPATH) \
1438			-sourcepath $(_JAVA_SOURCEPATH) -d $(_JAVA_DIR) $(_VPATH_SRCS)
1439
1440$(JAVA_LIBRARY): $(addprefix $(_JAVA_DIR)/,$(JAVA_SRCS:.java=.class)) Makefile Makefile.in
1441	$(JAR) cf $@ -C $(_JAVA_DIR) .
1442
1443GARBAGE_DIRS += $(_JAVA_DIR)
1444
1445###############################################################################
1446# Update Makefiles
1447###############################################################################
1448
1449# In GNU make 3.80, makefiles must use the /cygdrive syntax, even if we're
1450# processing them with AS perl. See bug 232003
1451ifdef AS_PERL
1452CYGWIN_TOPSRCDIR = -nowrap -p $(topsrcdir) -wrap
1453endif
1454
1455# Note: Passing depth to make-makefile is optional.
1456#       It saves the script some work, though.
1457Makefile: Makefile.in
1458	@$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR)
1459
1460ifdef SUBMAKEFILES
1461# VPATH does not work on some machines in this case, so add $(srcdir)
1462$(SUBMAKEFILES): % : $(srcdir)/%.in
1463	$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR) $@
1464endif
1465
1466ifdef AUTOUPDATE_CONFIGURE
1467$(topsrcdir)/configure: $(topsrcdir)/configure.in
1468	(cd $(topsrcdir) && $(AUTOCONF)) && (cd $(DEPTH) && ./config.status --recheck)
1469endif
1470
1471###############################################################################
1472# Bunch of things that extend the 'export' rule (in order):
1473###############################################################################
1474
1475################################################################################
1476# Copy each element of EXPORTS to $(PUBLIC)
1477
1478ifneq ($(EXPORTS)$(XPIDLSRCS)$(SDK_HEADERS)$(SDK_XPIDLSRCS),)
1479$(SDK_PUBLIC) $(PUBLIC)::
1480	$(NSINSTALL) -D $@
1481endif
1482
1483ifdef MOZ_JAVAXPCOM
1484ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1485$(JAVA_DIST_DIR)::
1486	$(NSINSTALL) -D $@
1487endif
1488endif
1489
1490ifneq ($(XPI_NAME),)
1491$(FINAL_TARGET):
1492	$(NSINSTALL) -D $@
1493
1494export:: $(FINAL_TARGET)
1495endif
1496
1497ifndef NO_DIST_INSTALL
1498ifneq ($(EXPORTS),)
1499export:: $(EXPORTS) $(PUBLIC)
1500	$(INSTALL) $(IFLAGS1) $^
1501endif 
1502
1503ifneq ($(SDK_HEADERS),)
1504export:: $(SDK_HEADERS) $(SDK_PUBLIC)
1505	$(INSTALL) $(IFLAGS1) $^
1506
1507export:: $(SDK_HEADERS) $(PUBLIC)
1508	$(INSTALL) $(IFLAGS1) $^
1509endif 
1510endif # NO_DIST_INSTALL
1511
1512################################################################################
1513# Copy each element of PREF_JS_EXPORTS
1514
1515ifdef GRE_MODULE
1516PREF_DIR = greprefs
1517else
1518ifneq (,$(XPI_NAME)$(LIBXUL_SDK))
1519PREF_DIR = defaults/preferences
1520else
1521PREF_DIR = defaults/pref
1522endif
1523endif
1524
1525ifneq ($(PREF_JS_EXPORTS),)
1526# on win32, pref files need CRLF line endings... see bug 206029
1527ifeq (WINNT,$(OS_ARCH))
1528PREF_PPFLAGS = --line-endings=crlf
1529endif
1530
1531ifndef NO_DIST_INSTALL
1532$(FINAL_TARGET)/$(PREF_DIR):
1533	$(NSINSTALL) -D $@
1534
1535libs:: $(FINAL_TARGET)/$(PREF_DIR) $(PREF_JS_EXPORTS)
1536	$(EXIT_ON_ERROR)  \
1537	for i in $(PREF_JS_EXPORTS); do \
1538	  dest=$(FINAL_TARGET)/$(PREF_DIR)/`basename $$i`; \
1539	  $(RM) -f $$dest; \
1540	  $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
1541	done
1542endif
1543endif
1544
1545################################################################################
1546# Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
1547
1548ifneq ($(AUTOCFG_JS_EXPORTS),)
1549$(FINAL_TARGET)/defaults/autoconfig::
1550	$(NSINSTALL) -D $@
1551
1552ifndef NO_DIST_INSTALL
1553export:: $(AUTOCFG_JS_EXPORTS) $(FINAL_TARGET)/defaults/autoconfig
1554	$(INSTALL) $(IFLAGS1) $^
1555endif
1556
1557endif 
1558################################################################################
1559# Export the elements of $(XPIDLSRCS) & $(SDK_XPIDLSRCS), 
1560# generating .h and .xpt files and moving them to the appropriate places.
1561
1562ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1563
1564export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))
1565
1566ifndef XPIDL_MODULE
1567XPIDL_MODULE		= $(MODULE)
1568endif
1569
1570ifeq ($(XPIDL_MODULE),) # we need $(XPIDL_MODULE) to make $(XPIDL_MODULE).xpt
1571export:: FORCE
1572	@echo
1573	@echo "*** Error processing XPIDLSRCS:"
1574	@echo "Please define MODULE or XPIDL_MODULE when defining XPIDLSRCS,"
1575	@echo "so we have a module name to use when creating MODULE.xpt."
1576	@echo; sleep 2; false
1577endif
1578
1579$(SDK_IDL_DIR) $(IDL_DIR)::
1580	$(NSINSTALL) -D $@
1581
1582# generate .h files from into $(XPIDL_GEN_DIR), then export to $(PUBLIC);
1583# warn against overriding existing .h file. 
1584$(XPIDL_GEN_DIR)/.done:
1585	@if test ! -d $(XPIDL_GEN_DIR); then echo Creating $(XPIDL_GEN_DIR)/.done; rm -rf $(XPIDL_GEN_DIR); mkdir $(XPIDL_GEN_DIR); fi
1586	@touch $@
1587
1588# don't depend on $(XPIDL_GEN_DIR), because the modification date changes
1589# with any addition to the directory, regenerating all .h files -> everything.
1590
1591$(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
1592	$(REPORT_BUILD)
1593	$(ELOG) $(XPIDL_COMPILE) -m header -w $(XPIDL_FLAGS) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
1594	@if test -n "$(findstring $*.h, $(EXPORTS) $(SDK_HEADERS))"; \
1595	  then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
1596
1597ifndef NO_GEN_XPT
1598# generate intermediate .xpt files into $(XPIDL_GEN_DIR), then link
1599# into $(XPIDL_MODULE).xpt and export it to $(FINAL_TARGET)/components.
1600$(XPIDL_GEN_DIR)/%.xpt: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
1601	$(REPORT_BUILD)
1602	$(ELOG) $(XPIDL_COMPILE) -m typelib -w $(XPIDL_FLAGS) -e $@ -d $(MDDEPDIR)/$*.pp $(_VPATH_SRCS)
1603
1604# no need to link together if XPIDLSRCS contains only XPIDL_MODULE
1605ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))
1606$(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS) $(SDK_XPIDLSRCS)) Makefile.in Makefile $(XPIDL_LINK)
1607	$(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS) $(SDK_XPIDLSRCS)) 
1608endif # XPIDL_MODULE.xpt != XPIDLSRCS
1609
1610libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
1611ifndef NO_DIST_INSTALL
1612	$(INSTALL) $(IFLAGS1) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(FINAL_TARGET)/components
1613endif
1614
1615endif # NO_GEN_XPT
1616
1617GARBAGE_DIRS		+= $(XPIDL_GEN_DIR)
1618
1619endif # XPIDLSRCS || SDK_XPIDLSRCS
1620
1621ifneq ($(XPIDLSRCS),)
1622# export .idl files to $(IDL_DIR)
1623ifndef NO_DIST_INSTALL
1624export:: $(XPIDLSRCS) $(IDL_DIR)
1625	$(INSTALL) $(IFLAGS1) $^
1626
1627export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) $(PUBLIC)
1628	$(INSTALL) $(IFLAGS1) $^ 
1629endif # NO_DIST_INSTALL
1630
1631endif # XPIDLSRCS
1632
1633
1634
1635#
1636# General rules for exporting idl files.
1637#
1638# WORK-AROUND ONLY, for mozilla/tools/module-deps/bootstrap.pl build.
1639# Bug to fix idl dependency problems w/o this extra build pass is
1640#   http://bugzilla.mozilla.org/show_bug.cgi?id=145777
1641#
1642$(IDL_DIR)::
1643	$(NSINSTALL) -D $@
1644
1645export-idl:: $(SUBMAKEFILES) $(MAKE_DIRS)
1646
1647ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1648ifndef NO_DIST_INSTALL
1649export-idl:: $(XPIDLSRCS) $(SDK_XPIDLSRCS) $(IDL_DIR)
1650	$(INSTALL) $(IFLAGS1) $^
1651endif
1652endif
1653	+$(LOOP_OVER_PARALLEL_DIRS)
1654	+$(LOOP_OVER_DIRS)
1655	+$(LOOP_OVER_TOOL_DIRS)
1656
1657
1658
1659
1660ifneq ($(SDK_XPIDLSRCS),)
1661# export .idl files to $(IDL_DIR) & $(SDK_IDL_DIR)
1662ifndef NO_DIST_INSTALL
1663export:: $(SDK_XPIDLSRCS) $(IDL_DIR)
1664	$(INSTALL) $(IFLAGS1) $^
1665
1666export:: $(SDK_XPIDLSRCS) $(SDK_IDL_DIR)
1667	$(INSTALL) $(IFLAGS1) $^
1668
1669export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(SDK_XPIDLSRCS)) $(PUBLIC)
1670	$(INSTALL) $(IFLAGS1) $^
1671
1672export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(SDK_XPIDLSRCS)) $(SDK_PUBLIC)
1673	$(INSTALL) $(IFLAGS1) $^
1674endif
1675
1676endif # SDK_XPIDLSRCS
1677
1678
1679
1680ifdef MOZ_JAVAXPCOM
1681ifneq ($(XPIDLSRCS)$(SDK_XPIDLSRCS),)
1682
1683JAVA_XPIDLSRCS = $(XPIDLSRCS) $(SDK_XPIDLSRCS)
1684
1685# A single IDL file can contain multiple interfaces, which result in multiple
1686# Java interface files.  So use hidden dependency files.
1687JAVADEPFILES = $(addprefix $(JAVA_GEN_DIR)/.,$(JAVA_XPIDLSRCS:.idl=.java.pp))
1688
1689$(JAVA_GEN_DIR):
1690	$(NSINSTALL) -D $@
1691GARBAGE_DIRS += $(JAVA_GEN_DIR)
1692
1693# generate .java files into _javagen/[package name dirs]
1694_JAVA_GEN_DIR = $(JAVA_GEN_DIR)/$(JAVA_IFACES_PKG_NAME)
1695$(_JAVA_GEN_DIR):
1696	$(NSINSTALL) -D $@
1697
1698$(JAVA_GEN_DIR)/.%.java.pp: %.idl $(XPIDL_COMPILE) $(_JAVA_GEN_DIR)
1699	$(REPORT_BUILD)
1700	$(ELOG) $(XPIDL_COMPILE) -m java -w -I$(srcdir) -I$(IDL_DIR) -o $(_JAVA_GEN_DIR)/$* $(_VPATH_SRCS)
1701	@touch $@
1702
1703# "Install" generated Java interfaces.  We segregate them based on the XPI_NAME.
1704# If XPI_NAME is not set, install into the "default" directory.
1705ifneq ($(XPI_NAME),)
1706JAVA_INSTALL_DIR = $(JAVA_DIST_DIR)/$(XPI_NAME)
1707else
1708JAVA_INSTALL_DIR = $(JAVA_DIST_DIR)/default
1709endif
1710
1711$(JAVA_INSTALL_DIR):
1712	$(NSINSTALL) -D $@
1713
1714export:: $(JAVA_DIST_DIR) $(JAVADEPFILES) $(JAVA_INSTALL_DIR)
1715	(cd $(JAVA_GEN_DIR) && tar $(TAR_CREATE_FLAGS) - .) | (cd $(JAVA_INSTALL_DIR) && tar -xf -)
1716
1717endif # XPIDLSRCS || SDK_XPIDLSRCS
1718endif # MOZ_JAVAXPCOM
1719
1720################################################################################
1721# Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
1722ifdef EXTRA_CO

Large files files are truncated, but you can click here to view the full file