|
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 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 |
|
50 else |
|
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 |
|
64 endif |
|
65 |
|
66 RANLIB = echo |
|
67 CPU_ARCH = sparc |
|
68 OS_DEFINES += -DSVR4 -DSYSV -D__svr4 -D__svr4__ -DSOLARIS -D_REENTRANT |
|
69 |
|
70 ifeq ($(OS_TEST),i86pc) |
|
71 ifeq ($(USE_64),1) |
|
72 CPU_ARCH = x86_64 |
|
73 else |
|
74 CPU_ARCH = x86 |
|
75 OS_DEFINES += -Di386 |
|
76 endif |
|
77 endif |
|
78 |
|
79 # Purify doesn't like -MDupdate |
|
80 NOMD_OS_CFLAGS += $(DSO_CFLAGS) $(OS_DEFINES) $(SOL_CFLAGS) |
|
81 |
|
82 MKSHLIB = $(CC) $(DSO_LDOPTS) $(RPATH) |
|
83 ifdef NS_USE_GCC |
|
84 ifeq (GNU,$(findstring GNU,$(shell `$(CC) -print-prog-name=ld` -v 2>&1))) |
|
85 GCC_USE_GNU_LD = 1 |
|
86 endif |
|
87 endif |
|
88 ifdef MAPFILE |
|
89 ifdef NS_USE_GCC |
|
90 ifdef GCC_USE_GNU_LD |
|
91 MKSHLIB += -Wl,--version-script,$(MAPFILE) |
|
92 else |
|
93 MKSHLIB += -Wl,-M,$(MAPFILE) |
|
94 endif |
|
95 else |
|
96 MKSHLIB += -M $(MAPFILE) |
|
97 endif |
|
98 endif |
|
99 PROCESS_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 |
|
105 ifdef NS_USE_GCC |
|
106 ifeq ($(USE_64), 1) |
|
107 DSO_LDOPTS += -m64 |
|
108 endif |
|
109 DSO_LDOPTS += -shared -h $(notdir $@) |
|
110 else |
|
111 ifeq ($(USE_64), 1) |
|
112 ifeq ($(OS_TEST),i86pc) |
|
113 DSO_LDOPTS +=-xarch=amd64 |
|
114 else |
|
115 DSO_LDOPTS +=-xarch=v9 |
|
116 endif |
|
117 endif |
|
118 DSO_LDOPTS += -G -h $(notdir $@) |
|
119 endif |
|
120 DSO_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.) |
|
124 ifdef NS_USE_GCC |
|
125 DSO_CFLAGS += -fPIC |
|
126 else |
|
127 DSO_CFLAGS += -KPIC |
|
128 endif |
|
129 |
|
130 NOSUCHFILE = /solaris-rm-f-sucks |
|
131 |
|
132 ifeq ($(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. |
|
135 ifeq ($(USE_64), 1) |
|
136 RPATH = -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64' |
|
137 else |
|
138 RPATH = -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps' |
|
139 endif |
|
140 else |
|
141 RPATH = -R '$$ORIGIN' |
|
142 endif |
|
143 |
|
144 OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc |