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