/security/coreconf/Linux.mk

http://github.com/zpao/v8monkey · Makefile · 207 lines · 122 code · 25 blank · 60 comment · 0 complexity · e315f1dae0ed4edc8ed944f551b49c8d 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 the Netscape security libraries.
  16. #
  17. # The Initial Developer of the Original Code is
  18. # Netscape Communications Corporation.
  19. # Portions created by the Initial Developer are Copyright (C) 1994-2000
  20. # the Initial Developer. All Rights Reserved.
  21. #
  22. # Contributor(s):
  23. #
  24. # Alternatively, the contents of this file may be used under the terms of
  25. # either the GNU General Public License Version 2 or later (the "GPL"), or
  26. # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27. # in which case the provisions of the GPL or the LGPL are applicable instead
  28. # of those above. If you wish to allow use of your version of this file only
  29. # under the terms of either the GPL or the LGPL, and not to allow others to
  30. # use your version of this file under the terms of the MPL, indicate your
  31. # decision by deleting the provisions above and replace them with the notice
  32. # and other provisions required by the GPL or the LGPL. If you do not delete
  33. # the provisions above, a recipient may use your version of this file under
  34. # the terms of any one of the MPL, the GPL or the LGPL.
  35. #
  36. # ***** END LICENSE BLOCK *****
  37. include $(CORE_DEPTH)/coreconf/UNIX.mk
  38. #
  39. # The default implementation strategy for Linux is now pthreads
  40. #
  41. USE_PTHREADS = 1
  42. ifeq ($(USE_PTHREADS),1)
  43. IMPL_STRATEGY = _PTH
  44. endif
  45. CC = gcc
  46. CCC = g++
  47. RANLIB = ranlib
  48. DEFAULT_COMPILER = gcc
  49. ifeq ($(OS_TEST),ppc64)
  50. CPU_ARCH = ppc
  51. ifeq ($(USE_64),1)
  52. ARCHFLAG = -m64
  53. endif
  54. else
  55. ifeq ($(OS_TEST),alpha)
  56. OS_REL_CFLAGS = -D_ALPHA_
  57. CPU_ARCH = alpha
  58. else
  59. ifeq ($(OS_TEST),x86_64)
  60. ifeq ($(USE_64),1)
  61. CPU_ARCH = x86_64
  62. else
  63. OS_REL_CFLAGS = -Di386
  64. CPU_ARCH = x86
  65. ARCHFLAG = -m32
  66. endif
  67. else
  68. ifeq ($(OS_TEST),sparc64)
  69. CPU_ARCH = sparc
  70. else
  71. ifeq (,$(filter-out arm% sa110,$(OS_TEST)))
  72. CPU_ARCH = arm
  73. else
  74. ifeq (,$(filter-out parisc%,$(OS_TEST)))
  75. CPU_ARCH = hppa
  76. else
  77. ifeq (,$(filter-out i%86,$(OS_TEST)))
  78. OS_REL_CFLAGS = -Di386
  79. CPU_ARCH = x86
  80. else
  81. ifeq ($(OS_TEST),sh4a)
  82. CPU_ARCH = sh4
  83. else
  84. # $(OS_TEST) == m68k, ppc, ia64, sparc, s390, s390x, mips, sh3, sh4
  85. CPU_ARCH = $(OS_TEST)
  86. endif
  87. endif
  88. endif
  89. endif
  90. endif
  91. endif
  92. endif
  93. endif
  94. LIBC_TAG = _glibc
  95. ifeq ($(OS_RELEASE),2.0)
  96. OS_REL_CFLAGS += -DLINUX2_0
  97. MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH)
  98. ifdef MAPFILE
  99. MKSHLIB += -Wl,--version-script,$(MAPFILE)
  100. endif
  101. PROCESS_MAP_FILE = grep -v ';-' $< | \
  102. sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
  103. endif
  104. ifdef BUILD_OPT
  105. ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
  106. OPTIMIZER = -Os
  107. else
  108. OPTIMIZER = -O2
  109. endif
  110. ifdef MOZ_DEBUG_SYMBOLS
  111. ifdef MOZ_DEBUG_FLAGS
  112. OPTIMIZER += $(MOZ_DEBUG_FLAGS)
  113. else
  114. OPTIMIZER += -gdwarf-2
  115. endif
  116. endif
  117. endif
  118. ifeq ($(USE_PTHREADS),1)
  119. OS_PTHREAD = -lpthread
  120. endif
  121. # See bug 537829, in particular comment 23.
  122. # Place -ansi and *_SOURCE before $(DSO_CFLAGS) so DSO_CFLAGS can override
  123. # -ansi on platforms like Android where the system headers are C99 and do
  124. # not build with -ansi.
  125. STANDARDS_CFLAGS = -ansi -D_POSIX_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE
  126. OS_CFLAGS = $(STANDARDS_CFLAGS) $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -Wall -Werror-implicit-function-declaration -Wno-switch -pipe -DLINUX -Dlinux -DHAVE_STRERROR
  127. OS_LIBS = $(OS_PTHREAD) -ldl -lc
  128. ifdef USE_PTHREADS
  129. DEFINES += -D_REENTRANT
  130. endif
  131. ARCH = linux
  132. DSO_CFLAGS = -fPIC
  133. DSO_LDOPTS = -shared $(ARCHFLAG)
  134. # The linker on Red Hat Linux 7.2 and RHEL 2.1 (GNU ld version 2.11.90.0.8)
  135. # incorrectly reports undefined references in the libraries we link with, so
  136. # we don't use -z defs there.
  137. ZDEFS_FLAG = -Wl,-z,defs
  138. DSO_LDOPTS += $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG))
  139. LDFLAGS += $(ARCHFLAG)
  140. # On Maemo, we need to use the -rpath-link flag for even the standard system
  141. # library directories.
  142. ifdef _SBOX_DIR
  143. LDFLAGS += -Wl,-rpath-link,/usr/lib:/lib
  144. endif
  145. # INCLUDES += -I/usr/include -Y/usr/include/linux
  146. G++INCLUDES = -I/usr/include/g++
  147. #
  148. # Always set CPU_TAG on Linux, WINCE.
  149. #
  150. CPU_TAG = _$(CPU_ARCH)
  151. #
  152. # On Linux 2.6 or later, build libfreebl3.so with no NSPR and libnssutil3.so
  153. # dependencies by default. Set FREEBL_NO_DEPEND to 0 in the environment to
  154. # override this.
  155. #
  156. ifeq (2.6,$(firstword $(sort 2.6 $(OS_RELEASE))))
  157. ifndef FREEBL_NO_DEPEND
  158. FREEBL_NO_DEPEND = 1
  159. FREEBL_LOWHASH = 1
  160. endif
  161. endif
  162. USE_SYSTEM_ZLIB = 1
  163. ZLIB_LIBS = -lz
  164. # The -rpath '$$ORIGIN' linker option instructs this library to search for its
  165. # dependencies in the same directory where it resides.
  166. ifeq ($(BUILD_SUN_PKG), 1)
  167. ifeq ($(USE_64), 1)
  168. RPATH = -Wl,-rpath,'$$ORIGIN:/opt/sun/private/lib64:/opt/sun/private/lib'
  169. else
  170. RPATH = -Wl,-rpath,'$$ORIGIN:/opt/sun/private/lib'
  171. endif
  172. endif
  173. OS_REL_CFLAGS += -DLINUX2_1
  174. MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH)
  175. ifdef MAPFILE
  176. MKSHLIB += -Wl,--version-script,$(MAPFILE)
  177. endif
  178. PROCESS_MAP_FILE = grep -v ';-' $< | \
  179. sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
  180. ifeq ($(OS_RELEASE),2.4)
  181. DEFINES += -DNO_FORK_CHECK
  182. endif