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

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs · Makefile · 884 lines · 564 code · 131 blank · 189 comment · 4 complexity · b7fdea2a535331533b4f52a8d98babed MD5 · raw file

  1. #
  2. # ***** BEGIN LICENSE BLOCK *****
  3. # Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. #
  5. # The contents of this file are subject to the Mozilla Public License Version
  6. # 1.1 (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. # http://www.mozilla.org/MPL/
  9. #
  10. # Software distributed under the License is distributed on an "AS IS" basis,
  11. # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. # for the specific language governing rights and limitations under the
  13. # License.
  14. #
  15. # The Original Code is mozilla.org code.
  16. #
  17. # The Initial Developer of the Original Code is
  18. # Netscape Communications Corporation.
  19. # Portions created by the Initial Developer are Copyright (C) 1998
  20. # the Initial Developer. All Rights Reserved.
  21. #
  22. # Contributor(s):
  23. # Benjamin Smedberg <benjamin@smedbergs.us>
  24. #
  25. # Alternatively, the contents of this file may be used under the terms of
  26. # either of the GNU General Public License Version 2 or later (the "GPL"),
  27. # or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28. # in which case the provisions of the GPL or the LGPL are applicable instead
  29. # of those above. If you wish to allow use of your version of this file only
  30. # under the terms of either the GPL or the LGPL, and not to allow others to
  31. # use your version of this file under the terms of the MPL, indicate your
  32. # decision by deleting the provisions above and replace them with the notice
  33. # and other provisions required by the GPL or the LGPL. If you do not delete
  34. # the provisions above, a recipient may use your version of this file under
  35. # the terms of any one of the MPL, the GPL or the LGPL.
  36. #
  37. # ***** END LICENSE BLOCK *****
  38. #
  39. # config.mk
  40. #
  41. # Determines the platform and builds the macros needed to load the
  42. # appropriate platform-specific .mk file, then defines all (most?)
  43. # of the generic macros.
  44. #
  45. # Define an include-at-most-once flag
  46. INCLUDED_CONFIG_MK = 1
  47. EXIT_ON_ERROR = set -e; # Shell loops continue past errors without this.
  48. ifndef topsrcdir
  49. topsrcdir = $(DEPTH)
  50. endif
  51. ifndef INCLUDED_AUTOCONF_MK
  52. include $(DEPTH)/config/autoconf.mk
  53. endif
  54. ifndef INCLUDED_INSURE_MK
  55. ifdef MOZ_INSURIFYING
  56. include $(topsrcdir)/config/insure.mk
  57. endif
  58. endif
  59. COMMA = ,
  60. # Sanity check some variables
  61. CHECK_VARS := \
  62. XPI_NAME \
  63. LIBRARY_NAME \
  64. MODULE \
  65. DEPTH \
  66. SHORT_LIBNAME \
  67. XPI_PKGNAME \
  68. INSTALL_EXTENSION_ID \
  69. $(NULL)
  70. # checks for internal spaces or trailing spaces in the variable
  71. # named by $x
  72. check-variable = $(if $(filter-out 0 1,$(words $($(x))z)),$(error Spaces are not allowed in $(x)))
  73. $(foreach x,$(CHECK_VARS),$(check-variable))
  74. # FINAL_TARGET specifies the location into which we copy end-user-shipped
  75. # build products (typelibs, components, chrome).
  76. #
  77. # It will usually be the well-loved $(DIST)/bin, today, but can also be an
  78. # XPI-contents staging directory for ambitious and right-thinking extensions.
  79. FINAL_TARGET = $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin)
  80. # MAKE_JARS_TARGET is a staging area for make-jars.pl. When packaging in
  81. # the jar format, make-jars leaves behind a directory structure that's not
  82. # needed in $(FINAL_TARGET). For both, flat, and symlink, the directory
  83. # structure contains the chrome, so leave it in $(FINAL_TARGET).
  84. ifeq (jar,$(MOZ_CHROME_FILE_FORMAT))
  85. MAKE_JARS_TARGET = $(if $(XPI_NAME),$(FINAL_TARGET).stage,$(DIST)/chrome-stage)
  86. else
  87. MAKE_JARS_TARGET = $(FINAL_TARGET)
  88. endif
  89. #
  90. # The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
  91. # Since the longest of these is 5 characters without the suffix,
  92. # be sure to not set VERSION_NUMBER to anything longer than 3
  93. # characters for Win16's sake.
  94. #
  95. VERSION_NUMBER = 50
  96. ifeq ($(HOST_OS_ARCH),WINNT)
  97. win_srcdir := $(subst $(topsrcdir),$(WIN_TOP_SRC),$(srcdir))
  98. BUILD_TOOLS = $(WIN_TOP_SRC)/build/unix
  99. else
  100. win_srcdir := $(srcdir)
  101. BUILD_TOOLS = $(topsrcdir)/build/unix
  102. endif
  103. CONFIG_TOOLS = $(MOZ_BUILD_ROOT)/config
  104. AUTOCONF_TOOLS = $(topsrcdir)/build/autoconf
  105. ifeq ($(OS_ARCH),QNX)
  106. ifeq ($(OS_TARGET),NTO)
  107. LD := qcc -Vgcc_ntox86 -nostdlib
  108. else
  109. LD := $(CC)
  110. endif
  111. endif
  112. ifeq ($(OS_ARCH),BeOS)
  113. BEOS_ADDON_WORKAROUND = 1
  114. endif
  115. #
  116. # Strip off the excessively long version numbers on these platforms,
  117. # but save the version to allow multiple versions of the same base
  118. # platform to be built in the same tree.
  119. #
  120. ifneq (,$(filter FreeBSD HP-UX IRIX Linux NetBSD OpenBSD OSF1 SunOS,$(OS_ARCH)))
  121. OS_RELEASE := $(basename $(OS_RELEASE))
  122. # Allow the user to ignore the OS_VERSION, which is usually irrelevant.
  123. ifdef WANT_MOZILLA_CONFIG_OS_VERSION
  124. OS_VERS := $(suffix $(OS_RELEASE))
  125. OS_VERSION := $(shell echo $(OS_VERS) | sed 's/-.*//')
  126. endif
  127. endif
  128. OS_CONFIG := $(OS_ARCH)$(OS_RELEASE)
  129. FINAL_LINK_LIBS = $(DEPTH)/config/final-link-libs
  130. FINAL_LINK_COMPS = $(DEPTH)/config/final-link-comps
  131. FINAL_LINK_COMP_NAMES = $(DEPTH)/config/final-link-comp-names
  132. MOZ_UNICHARUTIL_LIBS = $(LIBXUL_DIST)/lib/$(LIB_PREFIX)unicharutil_s.$(LIB_SUFFIX)
  133. MOZ_WIDGET_SUPPORT_LIBS = $(DIST)/lib/$(LIB_PREFIX)widgetsupport_s.$(LIB_SUFFIX)
  134. ifdef MOZ_MEMORY
  135. ifneq ($(OS_ARCH),WINNT)
  136. JEMALLOC_LIBS = $(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME,jemalloc) $(MKSHLIB_UNFORCE_ALL)
  137. endif
  138. endif
  139. # determine debug-related options
  140. _DEBUG_CFLAGS :=
  141. _DEBUG_LDFLAGS :=
  142. ifndef MOZ_DEBUG
  143. # global debugging is disabled
  144. # check if it was explicitly enabled for this module
  145. ifneq (, $(findstring $(MODULE), $(MOZ_DEBUG_MODULES)))
  146. MOZ_DEBUG:=1
  147. endif
  148. else
  149. # global debugging is enabled
  150. # check if it was explicitly disabled for this module
  151. ifneq (, $(findstring ^$(MODULE), $(MOZ_DEBUG_MODULES)))
  152. MOZ_DEBUG:=
  153. endif
  154. endif
  155. ifdef MOZ_DEBUG
  156. _DEBUG_CFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
  157. XULPPFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
  158. else
  159. _DEBUG_CFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
  160. XULPPFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
  161. endif
  162. # determine if -g should be passed to the compiler, based on
  163. # the current module, and the value of MOZ_DBGRINFO_MODULES
  164. ifdef MOZ_DEBUG
  165. MOZ_DBGRINFO_MODULES += ALL_MODULES
  166. pattern := ALL_MODULES ^ALL_MODULES
  167. else
  168. MOZ_DBGRINFO_MODULES += ^ALL_MODULES
  169. pattern := ALL_MODULES ^ALL_MODULES
  170. endif
  171. ifdef MODULE
  172. # our current Makefile specifies a module name - add it to our pattern
  173. pattern += $(MODULE) ^$(MODULE)
  174. endif
  175. # start by finding the first relevant module name
  176. # (remember that the order of the module names in MOZ_DBGRINFO_MODULES
  177. # is reversed from the order the user specified to configure -
  178. # this allows the user to put general names at the beginning
  179. # of the list, and to override them with explicit module names later
  180. # in the list)
  181. first_match:=$(firstword $(filter $(pattern), $(MOZ_DBGRINFO_MODULES)))
  182. ifeq ($(first_match), $(MODULE))
  183. # the user specified explicitly that
  184. # this module should be compiled with -g
  185. _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS)
  186. _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
  187. else
  188. ifeq ($(first_match), ^$(MODULE))
  189. # the user specified explicitly that this module
  190. # should not be compiled with -g (nothing to do)
  191. else
  192. ifeq ($(first_match), ALL_MODULES)
  193. # the user didn't mention this module explicitly,
  194. # but wanted all modules to be compiled with -g
  195. _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS)
  196. _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
  197. else
  198. ifeq ($(first_match), ^ALL_MODULES)
  199. # the user didn't mention this module explicitly,
  200. # but wanted all modules to be compiled without -g (nothing to do)
  201. endif
  202. endif
  203. endif
  204. endif
  205. # append debug flags
  206. # (these might have been above when processing MOZ_DBGRINFO_MODULES)
  207. OS_CFLAGS += $(_DEBUG_CFLAGS)
  208. OS_CXXFLAGS += $(_DEBUG_CFLAGS)
  209. OS_LDFLAGS += $(_DEBUG_LDFLAGS)
  210. # MOZ_PROFILE equivs for win32
  211. ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
  212. ifdef MOZ_DEBUG
  213. ifneq (,$(MOZ_BROWSE_INFO)$(MOZ_BSCFILE))
  214. OS_CFLAGS += -FR
  215. OS_CXXFLAGS += -FR
  216. endif
  217. else # ! MOZ_DEBUG
  218. # MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
  219. # Used for generating an optimized build with debugging symbols.
  220. # Used in the Windows nightlies to generate symbols for crash reporting.
  221. ifdef MOZ_DEBUG_SYMBOLS
  222. OS_CXXFLAGS += -Zi -UDEBUG -DNDEBUG
  223. OS_CFLAGS += -Zi -UDEBUG -DNDEBUG
  224. OS_LDFLAGS += -DEBUG -OPT:REF -OPT:nowin98
  225. endif
  226. ifdef MOZ_QUANTIFY
  227. # -FIXED:NO is needed for Quantify to work, but it increases the size
  228. # of executables, so only use it if building for Quantify.
  229. WIN32_EXE_LDFLAGS += -FIXED:NO
  230. # We need -OPT:NOICF to prevent identical methods from being merged together.
  231. # Otherwise, Quantify doesn't know which method was actually called when it's
  232. # showing you the profile.
  233. OS_LDFLAGS += -OPT:NOICF
  234. endif
  235. #
  236. # Handle trace-malloc in optimized builds.
  237. # No opt to give sane callstacks.
  238. #
  239. ifdef NS_TRACE_MALLOC
  240. MOZ_OPTIMIZE_FLAGS=-Zi -Od -UDEBUG -DNDEBUG
  241. OS_LDFLAGS = -DEBUG -PDB:NONE -OPT:REF -OPT:nowin98
  242. endif # NS_TRACE_MALLOC
  243. endif # MOZ_DEBUG
  244. endif # WINNT && !GNU_CC
  245. #
  246. # Build using PIC by default
  247. # Do not use PIC if not building a shared lib (see exceptions below)
  248. #
  249. ifndef BUILD_STATIC_LIBS
  250. _ENABLE_PIC=1
  251. endif
  252. ifneq (,$(FORCE_SHARED_LIB)$(FORCE_USE_PIC))
  253. _ENABLE_PIC=1
  254. endif
  255. # In Firefox, all components are linked into either libxul or the static
  256. # meta-component, and should be compiled with PIC.
  257. ifdef MOZ_META_COMPONENT
  258. _ENABLE_PIC=1
  259. endif
  260. # If module is going to be merged into the nsStaticModule,
  261. # make sure that the entry points are translated and
  262. # the module is built static.
  263. ifdef IS_COMPONENT
  264. ifdef EXPORT_LIBRARY
  265. ifneq (,$(BUILD_STATIC_LIBS))
  266. ifdef MODULE_NAME
  267. DEFINES += -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1
  268. FORCE_STATIC_LIB=1
  269. endif
  270. endif
  271. endif
  272. endif
  273. # Determine if module being compiled is destined
  274. # to be merged into libxul
  275. ifdef MOZ_ENABLE_LIBXUL
  276. ifdef LIBXUL_LIBRARY
  277. ifdef IS_COMPONENT
  278. ifdef MODULE_NAME
  279. DEFINES += -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1
  280. else
  281. $(error Component makefile does not specify MODULE_NAME.)
  282. endif
  283. endif
  284. FORCE_STATIC_LIB=1
  285. _ENABLE_PIC=1
  286. SHORT_LIBNAME=
  287. endif
  288. endif
  289. # If we are building this component into an extension/xulapp, it cannot be
  290. # statically linked. In the future we may want to add a xulapp meta-component
  291. # build option.
  292. ifdef XPI_NAME
  293. _ENABLE_PIC=1
  294. ifdef IS_COMPONENT
  295. EXPORT_LIBRARY=
  296. FORCE_STATIC_LIB=
  297. FORCE_SHARED_LIB=1
  298. endif
  299. endif
  300. #
  301. # Disable PIC if necessary
  302. #
  303. ifndef _ENABLE_PIC
  304. DSO_CFLAGS=
  305. ifeq ($(OS_ARCH)_$(HAVE_GCC3_ABI),Darwin_1)
  306. DSO_PIC_CFLAGS=-mdynamic-no-pic
  307. else
  308. DSO_PIC_CFLAGS=
  309. endif
  310. endif
  311. # This comes from configure
  312. ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE
  313. NO_PROFILE_GUIDED_OPTIMIZE = 1
  314. endif
  315. # Enable profile-based feedback
  316. ifndef NO_PROFILE_GUIDED_OPTIMIZE
  317. ifdef MOZ_PROFILE_GENERATE
  318. # No sense in profiling tools
  319. ifndef INTERNAL_TOOLS
  320. OS_CFLAGS += $(PROFILE_GEN_CFLAGS)
  321. OS_CXXFLAGS += $(PROFILE_GEN_CFLAGS)
  322. OS_LDFLAGS += $(PROFILE_GEN_LDFLAGS)
  323. ifeq (WINNT,$(OS_ARCH))
  324. AR_FLAGS += -LTCG
  325. endif
  326. endif # INTERNAL_TOOLS
  327. endif # MOZ_PROFILE_GENERATE
  328. ifdef MOZ_PROFILE_USE
  329. ifndef INTERNAL_TOOLS
  330. OS_CFLAGS += $(PROFILE_USE_CFLAGS)
  331. OS_CXXFLAGS += $(PROFILE_USE_CFLAGS)
  332. OS_LDFLAGS += $(PROFILE_USE_LDFLAGS)
  333. ifeq (WINNT,$(OS_ARCH))
  334. AR_FLAGS += -LTCG
  335. endif
  336. endif # INTERNAL_TOOLS
  337. endif # MOZ_PROFILE_USE
  338. endif # NO_PROFILE_GUIDED_OPTIMIZE
  339. # Does the makefile specifies the internal XPCOM API linkage?
  340. ifneq (,$(MOZILLA_INTERNAL_API)$(LIBXUL_LIBRARY))
  341. DEFINES += -DMOZILLA_INTERNAL_API
  342. endif
  343. # Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're
  344. # building libxul libraries
  345. ifdef MOZ_ENABLE_LIBXUL
  346. ifdef LIBXUL_LIBRARY
  347. DEFINES += \
  348. -D_IMPL_NS_COM \
  349. -DEXPORT_XPT_API \
  350. -DEXPORT_XPTC_API \
  351. -D_IMPL_NS_COM_OBSOLETE \
  352. -D_IMPL_NS_GFX \
  353. -D_IMPL_NS_WIDGET \
  354. -DIMPL_XREAPI \
  355. -DIMPL_NS_NET \
  356. -DIMPL_THEBES \
  357. $(NULL)
  358. ifndef MOZ_NATIVE_ZLIB
  359. DEFINES += -DZLIB_INTERNAL
  360. endif
  361. endif
  362. endif
  363. # Force _all_ exported methods to be |_declspec(dllexport)| when we're
  364. # building them into the executable.
  365. ifeq (,$(filter-out WINNT WINCE OS2, $(OS_ARCH)))
  366. ifdef BUILD_STATIC_LIBS
  367. DEFINES += \
  368. -D_IMPL_NS_GFX \
  369. -D_IMPL_NS_MSG_BASE \
  370. -D_IMPL_NS_WIDGET \
  371. $(NULL)
  372. endif
  373. endif
  374. # Flags passed to make-jars.pl
  375. MAKE_JARS_FLAGS = \
  376. -t $(topsrcdir) \
  377. -f $(MOZ_CHROME_FILE_FORMAT) \
  378. $(NULL)
  379. ifdef USE_EXTENSION_MANIFEST
  380. MAKE_JARS_FLAGS += -e
  381. endif
  382. ifdef BOTH_MANIFESTS
  383. MAKE_JARS_FLAGS += --both-manifests
  384. endif
  385. TAR_CREATE_FLAGS = -cvhf
  386. ifeq ($(OS_ARCH),BSD_OS)
  387. TAR_CREATE_FLAGS = -cvLf
  388. endif
  389. ifeq ($(OS_ARCH),OS2)
  390. TAR_CREATE_FLAGS = -cvf
  391. endif
  392. #
  393. # Personal makefile customizations go in these optional make include files.
  394. #
  395. MY_CONFIG := $(DEPTH)/config/myconfig.mk
  396. MY_RULES := $(DEPTH)/config/myrules.mk
  397. #
  398. # Default command macros; can be overridden in <arch>.mk.
  399. #
  400. CCC = $(CXX)
  401. NFSPWD = $(CONFIG_TOOLS)/nfspwd
  402. PURIFY = purify $(PURIFYOPTIONS)
  403. QUANTIFY = quantify $(QUANTIFYOPTIONS)
  404. ifdef CROSS_COMPILE
  405. XPIDL_COMPILE = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/host/bin/host_xpidl$(HOST_BIN_SUFFIX)
  406. XPIDL_LINK = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/host/bin/host_xpt_link$(HOST_BIN_SUFFIX)
  407. else
  408. XPIDL_COMPILE = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpidl$(BIN_SUFFIX)
  409. XPIDL_LINK = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpt_link$(BIN_SUFFIX)
  410. endif
  411. # Java macros
  412. JAVA_GEN_DIR = _javagen
  413. JAVA_DIST_DIR = $(DEPTH)/$(JAVA_GEN_DIR)
  414. JAVA_IFACES_PKG_NAME = org/mozilla/interfaces
  415. REQ_INCLUDES = -I$(srcdir) -I. $(foreach d,$(REQUIRES),-I$(DIST)/include/$d) -I$(DIST)/include
  416. ifdef LIBXUL_SDK
  417. REQ_INCLUDES_SDK = $(foreach d,$(REQUIRES),-I$(LIBXUL_SDK)/include/$d) -I$(LIBXUL_SDK)/include
  418. endif
  419. INCLUDES = $(LOCAL_INCLUDES) $(REQ_INCLUDES) $(REQ_INCLUDES_SDK) -I$(PUBLIC) $(OS_INCLUDES)
  420. ifndef MOZILLA_INTERNAL_API
  421. INCLUDES += -I$(LIBXUL_DIST)/sdk/include
  422. endif
  423. # The entire tree should be subject to static analysis using the XPCOM
  424. # script. Additional scripts may be added by specific subdirectories.
  425. DEHYDRA_SCRIPT = $(topsrcdir)/xpcom/analysis/static-checking.js
  426. DEHYDRA_MODULES = \
  427. $(topsrcdir)/xpcom/analysis/final.js \
  428. $(NULL)
  429. TREEHYDRA_MODULES = \
  430. $(topsrcdir)/xpcom/analysis/outparams.js \
  431. $(topsrcdir)/xpcom/analysis/stack.js \
  432. $(topsrcdir)/xpcom/analysis/flow.js \
  433. $(NULL)
  434. DEHYDRA_ARGS = \
  435. --topsrcdir=$(topsrcdir) \
  436. --objdir=$(DEPTH) \
  437. --dehydra-modules=$(subst $(NULL) ,$(COMMA),$(strip $(DEHYDRA_MODULES))) \
  438. --treehydra-modules=$(subst $(NULL) ,$(COMMA),$(strip $(TREEHYDRA_MODULES))) \
  439. $(NULL)
  440. DEHYDRA_FLAGS = -fplugin=$(DEHYDRA_PATH) -fplugin-arg='$(DEHYDRA_SCRIPT) $(DEHYDRA_ARGS)'
  441. ifdef DEHYDRA_PATH
  442. OS_CXXFLAGS += $(DEHYDRA_FLAGS)
  443. endif
  444. CFLAGS = $(OS_CFLAGS)
  445. CXXFLAGS = $(OS_CXXFLAGS)
  446. LDFLAGS = $(OS_LDFLAGS) $(MOZ_FIX_LINK_PATHS)
  447. # Allow each module to override the *default* optimization settings
  448. # by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
  449. # arguments to --enable-optimize
  450. ifdef MOZ_OPTIMIZE
  451. ifeq (1,$(MOZ_OPTIMIZE))
  452. ifdef MODULE_OPTIMIZE_FLAGS
  453. CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
  454. CXXFLAGS += $(MODULE_OPTIMIZE_FLAGS)
  455. else
  456. CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
  457. CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
  458. endif # MODULE_OPTIMIZE_FLAGS
  459. else
  460. CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
  461. CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
  462. endif # MOZ_OPTIMIZE == 1
  463. LDFLAGS += $(MOZ_OPTIMIZE_LDFLAGS)
  464. endif # MOZ_OPTIMIZE
  465. ifdef CROSS_COMPILE
  466. HOST_CFLAGS += $(HOST_OPTIMIZE_FLAGS)
  467. else
  468. ifdef MOZ_OPTIMIZE
  469. ifeq (1,$(MOZ_OPTIMIZE))
  470. ifdef MODULE_OPTIMIZE_FLAGS
  471. HOST_CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
  472. else
  473. HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
  474. endif # MODULE_OPTIMIZE_FLAGS
  475. else
  476. HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
  477. endif # MOZ_OPTIMIZE == 1
  478. endif # MOZ_OPTIMIZE
  479. endif # CROSS_COMPILE
  480. ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
  481. #// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
  482. #// DLL version of the RTL is used...
  483. #//
  484. #//------------------------------------------------------------------------
  485. ifdef USE_STATIC_LIBS
  486. RTL_FLAGS=-MT # Statically linked multithreaded RTL
  487. ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
  488. ifndef MOZ_NO_DEBUG_RTL
  489. RTL_FLAGS=-MTd # Statically linked multithreaded MSVC4.0 debug RTL
  490. endif
  491. endif # MOZ_DEBUG || NS_TRACE_MALLOC
  492. else # !USE_STATIC_LIBS
  493. RTL_FLAGS=-MD # Dynamically linked, multithreaded RTL
  494. ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
  495. ifndef MOZ_NO_DEBUG_RTL
  496. RTL_FLAGS=-MDd # Dynamically linked, multithreaded MSVC4.0 debug RTL
  497. endif
  498. endif # MOZ_DEBUG || NS_TRACE_MALLOC
  499. endif # USE_STATIC_LIBS
  500. endif # WINNT && !GNU_CC
  501. ifeq ($(OS_ARCH),Darwin)
  502. # Darwin doesn't cross-compile, so just set both types of flags here.
  503. HOST_CMFLAGS += -fobjc-exceptions
  504. HOST_CMMFLAGS += -fobjc-exceptions
  505. OS_COMPILE_CMFLAGS += -fobjc-exceptions
  506. OS_COMPILE_CMMFLAGS += -fobjc-exceptions
  507. endif
  508. COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS) $(PROFILER_CFLAGS) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS)
  509. COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS) $(PROFILER_CFLAGS) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
  510. COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
  511. COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)
  512. ifndef CROSS_COMPILE
  513. HOST_CFLAGS += $(RTL_FLAGS)
  514. endif
  515. #
  516. # Name of the binary code directories
  517. #
  518. # Override defaults
  519. # We need to know where to find the libraries we
  520. # put on the link line for binaries, and should
  521. # we link statically or dynamic? Assuming dynamic for now.
  522. ifneq (WINNT_,$(OS_ARCH)_$(GNU_CC))
  523. ifneq (,$(filter-out WINCE,$(OS_ARCH)))
  524. LIBS_DIR = -L$(DIST)/bin -L$(DIST)/lib
  525. ifdef LIBXUL_SDK
  526. LIBS_DIR += -L$(LIBXUL_SDK)/bin -L$(LIBXUL_SDK)/lib
  527. endif
  528. endif
  529. endif
  530. # Default location of include files
  531. IDL_DIR = $(DIST)/idl
  532. ifdef MODULE
  533. PUBLIC = $(DIST)/include/$(MODULE)
  534. else
  535. PUBLIC = $(DIST)/include
  536. endif
  537. XPIDL_FLAGS = -I$(srcdir) -I$(IDL_DIR)
  538. ifdef LIBXUL_SDK
  539. XPIDL_FLAGS += -I$(LIBXUL_SDK)/idl
  540. endif
  541. SDK_PUBLIC = $(DIST)/sdk/include
  542. SDK_IDL_DIR = $(DIST)/sdk/idl
  543. SDK_LIB_DIR = $(DIST)/sdk/lib
  544. SDK_BIN_DIR = $(DIST)/sdk/bin
  545. DEPENDENCIES = .md
  546. MOZ_COMPONENT_LIBS=$(XPCOM_LIBS) $(MOZ_COMPONENT_NSPR_LIBS)
  547. ifdef GC_LEAK_DETECTOR
  548. XPCOM_LIBS += -lboehm
  549. endif
  550. ifeq (xpconnect, $(findstring xpconnect, $(BUILD_MODULES)))
  551. DEFINES += -DXPCONNECT_STANDALONE
  552. endif
  553. ifeq ($(OS_ARCH),OS2)
  554. ELF_DYNSTR_GC = echo
  555. else
  556. ELF_DYNSTR_GC = :
  557. endif
  558. ifndef CROSS_COMPILE
  559. ifdef USE_ELF_DYNSTR_GC
  560. ifdef MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
  561. ELF_DYNSTR_GC = $(DEPTH)/config/elf-dynstr-gc
  562. endif
  563. endif
  564. endif
  565. ifeq ($(OS_ARCH),Darwin)
  566. ifdef NEXT_ROOT
  567. export NEXT_ROOT
  568. PBBUILD = NEXT_ROOT= $(PBBUILD_BIN)
  569. else # NEXT_ROOT
  570. PBBUILD = $(PBBUILD_BIN)
  571. endif # NEXT_ROOT
  572. PBBUILD_SETTINGS = GCC_VERSION="$(GCC_VERSION)" SYMROOT=build ARCHS="$(OS_TEST)"
  573. ifdef MACOS_SDK_DIR
  574. PBBUILD_SETTINGS += SDKROOT="$(MACOS_SDK_DIR)"
  575. endif # MACOS_SDK_DIR
  576. ifdef MACOSX_DEPLOYMENT_TARGET
  577. export MACOSX_DEPLOYMENT_TARGET
  578. PBBUILD_SETTINGS += MACOSX_DEPLOYMENT_TARGET="$(MACOSX_DEPLOYMENT_TARGET)"
  579. endif # MACOSX_DEPLOYMENT_TARGET
  580. ifdef MOZ_OPTIMIZE
  581. ifeq (2,$(MOZ_OPTIMIZE))
  582. # Only override project defaults if the config specified explicit settings
  583. PBBUILD_SETTINGS += GCC_MODEL_TUNING= OPTIMIZATION_CFLAGS="$(MOZ_OPTIMIZE_FLAGS)"
  584. endif # MOZ_OPTIMIZE=2
  585. endif # MOZ_OPTIMIZE
  586. ifeq (1,$(HAS_XCODE_2_1))
  587. # Xcode 2.1 puts its build products in a directory corresponding to the
  588. # selected build style/configuration.
  589. XCODE_PRODUCT_DIR = build/$(BUILDSTYLE)
  590. else
  591. XCODE_PRODUCT_DIR = build
  592. endif # HAS_XCODE_2_1=1
  593. endif # OS_ARCH=Darwin
  594. ifdef MOZ_NATIVE_MAKEDEPEND
  595. MKDEPEND_DIR =
  596. MKDEPEND = $(CYGWIN_WRAPPER) $(MOZ_NATIVE_MAKEDEPEND)
  597. else
  598. MKDEPEND_DIR = $(CONFIG_TOOLS)/mkdepend
  599. MKDEPEND = $(CYGWIN_WRAPPER) $(MKDEPEND_DIR)/mkdepend$(BIN_SUFFIX)
  600. endif
  601. # Set link flags according to whether we want a console.
  602. ifdef MOZ_WINCONSOLE
  603. ifeq ($(MOZ_WINCONSOLE),1)
  604. ifeq ($(OS_ARCH),OS2)
  605. BIN_FLAGS += -Zlinker -PM:VIO
  606. endif
  607. ifeq ($(OS_ARCH),WINNT)
  608. ifdef GNU_CC
  609. WIN32_EXE_LDFLAGS += -mconsole
  610. else
  611. WIN32_EXE_LDFLAGS += -SUBSYSTEM:CONSOLE
  612. endif
  613. endif
  614. else # MOZ_WINCONSOLE
  615. ifeq ($(OS_ARCH),OS2)
  616. BIN_FLAGS += -Zlinker -PM:PM
  617. endif
  618. ifeq ($(OS_ARCH),WINNT)
  619. ifdef GNU_CC
  620. WIN32_EXE_LDFLAGS += -mwindows
  621. else
  622. WIN32_EXE_LDFLAGS += -SUBSYSTEM:WINDOWS
  623. endif
  624. endif
  625. endif
  626. endif
  627. # Flags needed to link against the component library
  628. ifdef MOZ_COMPONENTLIB
  629. MOZ_COMPONENTLIB_EXTRA_DSO_LIBS = mozcomps xpcom_compat
  630. # Tell the linker where NSS is, if we're building crypto
  631. ifeq ($(OS_ARCH),Darwin)
  632. ifeq (,$(findstring crypto,$(MOZ_META_COMPONENTS)))
  633. MOZ_COMPONENTLIB_EXTRA_LIBS = $(foreach library, $(patsubst -l%, $(LIB_PREFIX)%$(DLL_SUFFIX), $(filter -l%, $(NSS_LIBS))), -dylib_file @executable_path/$(library):$(DIST)/bin/$(library))
  634. endif
  635. endif
  636. endif
  637. # If we're building a component on MSVC, we don't want to generate an
  638. # import lib, because that import lib will collide with the name of a
  639. # static version of the same library.
  640. ifeq ($(GNU_LD)$(OS_ARCH),WINNT)
  641. ifdef IS_COMPONENT
  642. LDFLAGS += -IMPLIB:fake.lib
  643. DELETE_AFTER_LINK = fake.lib fake.exp
  644. endif
  645. endif
  646. #
  647. # Include any personal overrides the user might think are needed.
  648. #
  649. -include $(topsrcdir)/$(MOZ_BUILD_APP)/app-config.mk
  650. -include $(MY_CONFIG)
  651. ######################################################################
  652. # Now test variables that might have been set or overridden by $(MY_CONFIG).
  653. DEFINES += -DOSTYPE=\"$(OS_CONFIG)\"
  654. DEFINES += -DOSARCH=$(OS_ARCH)
  655. # For profiling
  656. ifdef ENABLE_EAZEL_PROFILER
  657. ifndef INTERNAL_TOOLS
  658. ifneq ($(LIBRARY_NAME), xpt)
  659. ifneq (, $(findstring $(shell $(topsrcdir)/build/unix/print-depth-path.sh | awk -F/ '{ print $$2; }'), $(MOZ_PROFILE_MODULES)))
  660. PROFILER_CFLAGS = $(EAZEL_PROFILER_CFLAGS) -DENABLE_EAZEL_PROFILER
  661. PROFILER_LIBS = $(EAZEL_PROFILER_LIBS)
  662. endif
  663. endif
  664. endif
  665. endif
  666. ######################################################################
  667. GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB
  668. ifeq ($(OS_ARCH),Darwin)
  669. ifndef NSDISTMODE
  670. NSDISTMODE=absolute_symlink
  671. endif
  672. PWD := $(shell pwd)
  673. endif
  674. ifdef NSINSTALL_BIN
  675. NSINSTALL = $(CYGWIN_WRAPPER) $(NSINSTALL_BIN)
  676. else
  677. ifeq (WINNT,$(CROSS_COMPILE)$(OS_ARCH))
  678. NSINSTALL = $(CYGWIN_WRAPPER) $(MOZ_TOOLS_DIR)/bin/nsinstall
  679. else
  680. ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH))
  681. NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall
  682. else
  683. NSINSTALL = $(CONFIG_TOOLS)/nsinstall
  684. endif # OS2
  685. endif # WINNT
  686. endif # NSINSTALL_BIN
  687. ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
  688. INSTALL = $(NSINSTALL)
  689. else
  690. ifeq ($(NSDISTMODE),copy)
  691. # copy files, but preserve source mtime
  692. INSTALL = $(NSINSTALL) -t
  693. else
  694. ifeq ($(NSDISTMODE),absolute_symlink)
  695. # install using absolute symbolic links
  696. ifeq ($(OS_ARCH),Darwin)
  697. INSTALL = $(NSINSTALL) -L $(PWD)
  698. else
  699. INSTALL = $(NSINSTALL) -L `$(NFSPWD)`
  700. endif # Darwin
  701. else
  702. # install using relative symbolic links
  703. INSTALL = $(NSINSTALL) -R
  704. endif # absolute_symlink
  705. endif # copy
  706. endif # WINNT/OS2
  707. ifeq (,$(filter-out WINCE,$(OS_ARCH)))
  708. NSINSTALL = $(CYGWIN_WRAPPER) nsinstall
  709. INSTALL = $(CYGWIN_WRAPPER) nsinstall
  710. endif
  711. # Use nsinstall in copy mode to install files on the system
  712. SYSINSTALL = $(NSINSTALL) -t
  713. ifeq ($(OS_ARCH),WINNT)
  714. ifneq (,$(CYGDRIVE_MOUNT))
  715. export CYGDRIVE_MOUNT
  716. endif
  717. endif
  718. #
  719. # Localization build automation
  720. #
  721. # Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
  722. # MOZ_UI_LOCALE directly, but use an intermediate variable that can be
  723. # overridden by the command line. (Besides, AB_CD is prettier).
  724. AB_CD = $(MOZ_UI_LOCALE)
  725. ifndef L10NBASEDIR
  726. L10NBASEDIR = $(error L10NBASEDIR not defined by configure)
  727. endif
  728. EXPAND_LOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(topsrcdir)/$(1)/en-US,$(L10NBASEDIR)/$(AB_CD)/$(subst /locales,,$(1)))
  729. ifdef relativesrcdir
  730. LOCALE_SRCDIR = $(call EXPAND_LOCALE_SRCDIR,$(relativesrcdir))
  731. endif
  732. ifdef LOCALE_SRCDIR
  733. # if LOCALE_MERGEDIR is set, use mergedir first, then the localization,
  734. # and finally en-US
  735. ifdef LOCALE_MERGEDIR
  736. MAKE_JARS_FLAGS += -c $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))
  737. endif
  738. MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
  739. ifdef LOCALE_MERGEDIR
  740. MAKE_JARS_FLAGS += -c $(topsrcdir)/$(relativesrcdir)/en-US
  741. endif
  742. endif
  743. ifeq (,$(filter WINCE WINNT OS2,$(OS_ARCH)))
  744. RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh
  745. endif
  746. #
  747. # Java macros
  748. #
  749. # Make sure any compiled classes work with at least JVM 1.4
  750. JAVAC_FLAGS += -source 1.4
  751. ifdef MOZ_DEBUG
  752. JAVAC_FLAGS += -g
  753. endif