PageRenderTime 60ms CodeModel.GetById 15ms 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
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause

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

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