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