SunOS5.mk 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #
  2. # This Source Code Form is subject to the terms of the Mozilla Public
  3. # License, v. 2.0. If a copy of the MPL was not distributed with this
  4. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  5. include $(CORE_DEPTH)/coreconf/UNIX.mk
  6. # Sun's WorkShop defines v8, v8plus and v9 architectures.
  7. # gcc on Solaris defines v8 and v9 "cpus".
  8. # gcc's v9 is equivalent to Workshop's v8plus.
  9. # gcc's -m64 is equivalent to Workshop's v9
  10. ifeq ($(USE_64), 1)
  11. ifdef NS_USE_GCC
  12. ARCHFLAG=-m64
  13. else
  14. ifeq ($(OS_TEST),i86pc)
  15. ARCHFLAG=-xarch=amd64
  16. else
  17. ARCHFLAG=-xarch=v9
  18. endif
  19. endif
  20. else
  21. ifneq ($(OS_TEST),i86pc)
  22. ifdef NS_USE_GCC
  23. ARCHFLAG=-mcpu=v9
  24. else
  25. ARCHFLAG=-xarch=v8plus
  26. endif
  27. endif
  28. endif
  29. DEFAULT_COMPILER = cc
  30. ifdef NS_USE_GCC
  31. CC = gcc
  32. OS_CFLAGS += -Wall -Wno-format -Werror-implicit-function-declaration -Wno-switch
  33. OS_CFLAGS += -D__EXTENSIONS__
  34. CCC = g++
  35. CCC += -Wall -Wno-format
  36. ASFLAGS += -x assembler-with-cpp
  37. OS_CFLAGS += $(NOMD_OS_CFLAGS) $(ARCHFLAG)
  38. ifdef USE_MDUPDATE
  39. OS_CFLAGS += -MDupdate $(DEPENDENCIES)
  40. endif
  41. ifdef BUILD_OPT
  42. OPTIMIZER = -O2
  43. # Enable this for accurate dtrace profiling
  44. # OPTIMIZER += -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer
  45. endif
  46. else
  47. CC = cc
  48. CCC = CC
  49. ASFLAGS += -Wa,-P
  50. OS_CFLAGS += $(NOMD_OS_CFLAGS) $(ARCHFLAG)
  51. ifndef BUILD_OPT
  52. OS_CFLAGS += -xs
  53. else
  54. OPTIMIZER = -xO4
  55. endif
  56. ifdef USE_TCOV
  57. CC += -xprofile=tcov
  58. CCC += -xprofile=tcov
  59. endif
  60. endif
  61. RANLIB = echo
  62. CPU_ARCH = sparc
  63. OS_DEFINES += -DSVR4 -DSYSV -D__svr4 -D__svr4__ -DSOLARIS -D_REENTRANT
  64. ifeq ($(OS_TEST),i86pc)
  65. ifeq ($(USE_64),1)
  66. CPU_ARCH = x86_64
  67. else
  68. CPU_ARCH = x86
  69. OS_DEFINES += -Di386
  70. endif
  71. endif
  72. # Purify doesn't like -MDupdate
  73. NOMD_OS_CFLAGS += $(DSO_CFLAGS) $(OS_DEFINES) $(SOL_CFLAGS)
  74. MKSHLIB = $(CC) $(DSO_LDOPTS) $(RPATH)
  75. ifdef NS_USE_GCC
  76. ifeq (GNU,$(findstring GNU,$(shell `$(CC) -print-prog-name=ld` -v 2>&1)))
  77. GCC_USE_GNU_LD = 1
  78. endif
  79. endif
  80. ifdef MAPFILE
  81. ifdef NS_USE_GCC
  82. ifdef GCC_USE_GNU_LD
  83. MKSHLIB += -Wl,--version-script,$(MAPFILE)
  84. else
  85. MKSHLIB += -Wl,-M,$(MAPFILE)
  86. endif
  87. else
  88. MKSHLIB += -M $(MAPFILE)
  89. endif
  90. endif
  91. PROCESS_MAP_FILE = grep -v ';-' $< | \
  92. sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
  93. # ld options:
  94. # -G: produce a shared object
  95. # -z defs: no unresolved symbols allowed
  96. ifdef NS_USE_GCC
  97. ifeq ($(USE_64), 1)
  98. DSO_LDOPTS += -m64
  99. endif
  100. DSO_LDOPTS += -shared -h $(notdir $@)
  101. else
  102. ifeq ($(USE_64), 1)
  103. ifeq ($(OS_TEST),i86pc)
  104. DSO_LDOPTS +=-xarch=amd64
  105. else
  106. DSO_LDOPTS +=-xarch=v9
  107. endif
  108. endif
  109. DSO_LDOPTS += -G -h $(notdir $@)
  110. endif
  111. DSO_LDOPTS += -z combreloc -z defs -z ignore
  112. # -KPIC generates position independent code for use in shared libraries.
  113. # (Similarly for -fPIC in case of gcc.)
  114. ifdef NS_USE_GCC
  115. DSO_CFLAGS += -fPIC
  116. else
  117. DSO_CFLAGS += -KPIC
  118. endif
  119. NOSUCHFILE = /solaris-rm-f-sucks
  120. ifeq ($(BUILD_SUN_PKG), 1)
  121. # The -R '$ORIGIN' linker option instructs this library to search for its
  122. # dependencies in the same directory where it resides.
  123. ifeq ($(USE_64), 1)
  124. RPATH = -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
  125. else
  126. RPATH = -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps'
  127. endif
  128. else
  129. RPATH = -R '$$ORIGIN'
  130. endif
  131. OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc