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