1 # 2 # CDDL HEADER START 3 # 4 # The contents of this file are subject to the terms of the 5 # Common Development and Distribution License (the "License"). 6 # You may not use this file except in compliance with the License. 7 # 8 # You can obtain a copy of the license at src/sun_nws/OPENSOLARIS.LICENSE 9 # or http://www.opensolaris.org/os/licensing. 10 # See the License for the specific language governing permissions 11 # and limitations under the License. 12 # 13 # When distributing Covered Code, include this CDDL HEADER in each 14 # file and include the License file at src/sun_nws/OPENSOLARIS.LICENSE. 15 # If applicable, add the following below this CDDL HEADER, with the 16 # fields enclosed by brackets "[]" replaced with your own identifying 17 # information: Portions Copyright [yyyy] [name of copyright owner] 18 # 19 # CDDL HEADER END 20 # 21 # 22 # Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 # Use is subject to license terms. 24 # 25 #ident "@(#)Makefile.cmds 1.14 08/04/29 SMI" 26 # 27 # src/sun_nws/Makefile.cmds 28 29 DEBUG = -g 30 # if NONDEBUG is set: 31 $(NONDEBUG)DEBUG = 32 33 # Pull dependancies from our ref gate, after searching locally 34 INCLUDES = -I$(HDRS) 35 INCLUDES += $(COMMON_INCLUDES) 36 INCLUDES += -Y I,$(ON_REF_GATE)/proto/root_$(MACH)/usr/include 37 38 CCINCLUDES = -I$(HDRS) 39 CCINCLUDES += $(COMMON_INCLUDES) 40 CCINCLUDES += -I$(ON_REF_GATE)/proto/root_sparc/usr/include 41 42 # 43 # C compiler mode. Future compilers may change the default on us, 44 # so force transition mode globally. Lower level makefiles can 45 # override this by setting CCMODE. 46 # 47 CCMODE= -Xa 48 CCMODE64= -Xa 49 50 # 51 # C compiler verbose mode. This is so we can enable it globally, 52 # but turn it off in the lower level makefiles of things we cannot 53 # (or aren't going to) fix. 54 # 55 CCVERBOSE= -v 56 57 # set this to the secret flag "-Wc,-Qiselect-regsym=0" to disable register 58 # symbols (used to detect conflicts between objects that use global registers) 59 # we disable this now for safety, and because genunix doesn't link with 60 # this feature (the v9 default) enabled. 61 # 62 CCREGSYM= -Wc,-Qiselect-regsym=0 63 64 # prevent static symbols being optimized out 65 CCSTATICSYM= -Wc,-Qassembler-ounrefsym=0 66 67 # generate 32-bit addresses in the v9 kernel. Saves memory. 68 CCABS32= -Wc,-xcode=abs32 69 70 # One optimization the compiler might perform is to turn this: 71 # #pragma weak foo 72 # extern int foo; 73 # if (&foo) 74 # foo = 5; 75 # into 76 # foo = 5; 77 # Since we do some of this (foo might be referenced in common kernel code 78 # but provided only for some cpu modules or platforms), we disable this 79 # optimization. 80 # 81 sparc_CCUNBOUND= -Wd,-xsafe=unboundsym 82 i386_CCUNBOUND= 83 CCUNBOUND= $($(MACH)_CCUNBOUND) 84 85 86 # 87 # compiler '-xarch' flag. This is here to centralize it and make it 88 # overridable for testing. 89 sparc_XARCH= -xarch=v8 90 sparcv9_XARCH= -xarch=v9 91 amd64_XARCH= -xarch=amd64 92 93 # 94 # disable the incremental linker 95 ILDOFF= -xildoff 96 97 # 98 # turn warnings into errors (C) 99 CERRWARN= -errtags=yes -errwarn=%all -erroff=E_EMPTY_TRANSLATION_UNIT \ 100 -erroff=E_STATEMENT_NOT_REACHED 101 102 # C99 mode 103 C99MODE= -xc99=%none 104 C99LMODE= -Xc99=%none 105 106 # In most places, assignments to these macros should be appended with += 107 # (CPPFLAGS.master allows values to be prepended to CPPFLAGS). 108 sparc_CFLAGS= $(sparc_XARCH) 109 sparcv9_CFLAGS= $(sparcv9_XARCH) -dalign $(CCVERBOSE) $(CCREGSYM) $(CCSTATICSYM) 110 i386_CFLAGS= 111 amd64_CFLAGS= $(amd64_XARCH) 112 113 # optimization level 114 sparc_COPTFLAG= -xO3 115 sparcv9_COPTFLAG= -xO3 116 i386_COPTFLAG= -O 117 amd64_COPTFLAG= -xO3 118 COPTFLAG= $($(MACH)_COPTFLAG) 119 COPTFLAG64= $($(MACH64)_COPTFLAG) 120 121 # 122 # Default debug format for Sun Studio 11 is dwarf, so force it to 123 # generate stabs. 124 # 125 DEBUGFORMAT= -xdebugformat=stabs 126 127 # 128 # Flags used to build in debug mode for ctf generation 129 # 130 CTF_STABS_FLAGS_sparc = -g -Wc,-Qiselect-T1 $(C99MODE) -W0,-noglobal 131 CTF_STABS_FLAGS_i386 = -g $(C99MODE) -W0,-noglobal 132 CTF_STABS_FLAGS = $(CTF_STABS_FLAGS_$(MACH)) $(DEBUGFORMAT) 133 134 # 135 # tradeoff time for space (smaller is better) 136 # 137 sparc_SPACEFLAG = -xspace -W0,-Lt 138 sparcv9_SPACEFLAG = -xspace -W0,-Lt 139 i386_SPACEFLAG = 140 amd64_SPACEFLAG = 141 SPACEFLAG = $($(MACH)_SPACEFLAG) 142 SPACEFLAG64 = $($(MACH64)_SPACEFLAG) 143 144 # 145 # The Sun Studio 11 compiler has changed the behaviour of integer 146 # wrap arounds and so a flag is needed to use the legacy behaviour 147 # (without this flag panics/hangs could be exposed within the source). 148 # 149 sparc_IROPTFLAG = -W2,-xwrap_int 150 sparcv9_IROPTFLAG = -W2,-xwrap_int 151 i386_IROPTFLAG = 152 amd64_IROPTFLAG = 153 154 IROPTFLAG = $($(MACH)_IROPTFLAG) 155 IROPTFLAG64 = $($(MACH64)_IROPTFLAG) 156 157 158 sparc_XREGSFLAG = -xregs=no%appl 159 sparcv9_XREGSFLAG = -xregs=no%appl 160 i386_XREGSFLAG = 161 amd64_XREGSFLAG = 162 XREGSFLAG = $($(MACH)_XREGSFLAG) 163 XREGSFLAG64 = $($(MACH64)_XREGSFLAG) 164 165 CFLAGS32= $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \ 166 $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG) 167 168 CFLAGS64= $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \ 169 $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG64) 170 171 # CPPFLAGS 172 TEXT_DOMAIN= SUNW_OST_OSCMD 173 DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\" 174 175 DTS_ERRNO=-D_TS_ERRNO 176 CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) 177 178 CPPFLAGS32 = $(CPPFLAGS.master) 179 180 CPPFLAGS64 = $(CPPFLAGS32) 181 182 # Lint Flags ?? 183 LFLAGS32 = $(CCMODE) 184 LFLAGS32 += -nsxmuF 185 LFLAGS32 += -errtags=yes 186 LFLAGS32 += -erroff=E_BAD_PTR_CAST_ALIGN 187 LFLAGS32 += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED 188 LFLAGS32 += -erroff=E_SUSPICIOUS_COMPARISON 189 LFLAGS32 += -erroff=E_CAST_UINT_TO_SIGNED_INT 190 LFLAGS32 += -erroff=E_PASS_UINT_TO_SIGNED_INT 191 LFLAGS32 += -erroff=E_INVALID_ANNOTATION_NAME 192 LFLAGS32 += -erroff=E_OLD_STYLE_DECL_OR_BAD_TYPE 193 LFLAGS32 += -erroff=E_NO_EXPLICIT_TYPE_GIVEN 194 LFLAGS32 += -erroff=E_STATIC_UNUSED 195 LFLAGS32 += -erroff=E_PTRDIFF_OVERFLOW 196 LFLAGS32 += -erroff=E_ASSIGN_NARROW_CONV 197 LFLAGS32 += $(C99LMODE) 198 199 LFLAGS64 = $(CCMODE64) 200 LFLAGS64 += -nsxmuF 201 LFLAGS64 += -errtags=yes 202 LFLAGS64 += -Xarch=v9 203 LFLAGS64 += -erroff=E_BAD_PTR_CAST_ALIGN 204 LFLAGS64 += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED 205 LFLAGS64 += -erroff=E_SUSPICIOUS_COMPARISON 206 LFLAGS64 += -erroff=E_CAST_UINT_TO_SIGNED_INT 207 LFLAGS64 += -erroff=E_PASS_UINT_TO_SIGNED_INT 208 LFLAGS64 += -erroff=E_INVALID_ANNOTATION_NAME 209 LFLAGS64 += -erroff=E_OLD_STYLE_DECL_OR_BAD_TYPE 210 LFLAGS64 += -erroff=E_NO_EXPLICIT_TYPE_GIVEN 211 LFLAGS64 += -erroff=E_STATIC_UNUSED 212 LFLAGS64 += -erroff=E_PTRDIFF_OVERFLOW 213 LFLAGS64 += -erroff=E_ASSIGN_NARROW_CONV 214 LFLAGS64 += -erroff=E_CAST_INT_TO_SMALL_INT 215 LFLAGS64 += -erroff=E_CAST_INT_CONST_TO_SMALL_INT 216 LFLAGS64 += -erroff=E_CAST_TO_PTR_FROM_INT 217 LFLAGS64 += -erroff=E_ASSIGN_INT_TO_SMALL_INT 218 LFLAGS64 += -erroff=E_ASSIGN_INT_FROM_BIG_CONST 219 LFLAGS64 += -erroff=E_CONST_PROMOTED_UNSIGNED_LL 220 LFLAGS64 += -erroff=E_CONST_PROMOTED_LONG_LONG 221 LFLAGS64 += -erroff=E_CONST_TRUNCATED_BY_ASSIGN 222 LFLAGS64 += -erroff=E_PASS_INT_FROM_BIG_CONST 223 LFLAGS64 += -erroff=E_COMP_INT_WITH_LARGE_INT 224 LFLAGS64 += -erroff=E_ASSIGN_UINT_TO_SIGNED_INT 225 LFLAGS64 += -erroff=E_PASS_INT_TO_SMALL_INT 226 LFLAGS64 += -erroff=E_PTR_CONV_LOSES_BITS 227 LFLAGS64 += (C99LMODE) 228 229 sparc_LDEF32 = -Dsparc 230 sparc_LDEF32 += -Dsun 231 sparc_LDEF32 += -Dunix 232 233 sparc_LDEF64 = $(sparc_LDEF32) 234 sparc_LDEF64 += -Xarch=v9 235 236 i386_LDEF32 = -D__i386 237 i386_LDEF32 += -Dsun 238 i386_LDEF32 += -Dunix 239 240 i386_LDEF64 = -D__x86 241 i386_LDEF64 += -Dsun 242 i386_LDEF64 += -Dunix 243 i386_LDEF64 += -Xarch=amd64 244 245 LDEF32 = $($(MACH)_LDEF32) 246 LDEF64 = $($(MACH)_LDEF64) 247 248 DEF_STRIPFLAG=-s 249 STRIPFLAG=$(DEF_STRIPFLAG) 250 251 LDFLAGS = $(STRIPFLAGS) 252 LDFLAGS += -M $(ON_REF_GATE)/usr/src/common/mapfiles/common/map.noexstk 253 LDFLAGS += -M $(ON_REF_GATE)/usr/src/common/mapfiles/$(MACH)/map.pagealign 254 255 LDFLAGS32 = -L$(PROJAREA)/liba5k/$(OBJ32) 256 LDFLAGS32 += -L$(PROJAREA)/libg_fc/$(OBJ32) 257 LDFLAGS32 += -L$(PROJAREA)/hbaapi/$(OBJ32) 258 LDFLAGS32 += -L$(PROJAREA)/ima/$(OBJ32) 259 LDFLAGS32 += -L$(PROJAREA)/mpapi/$(OBJ32) 260 LDFLAGS32 += -L$(PROJAREA)/libstmf/$(OBJ32) 261 LDFLAGS32 += $(LDFLAGS) 262 263 LDFLAGS64 = -L$(PROJAREA)/liba5k/$(OBJ64) 264 LDFLAGS64 += -L$(PROJAREA)/libg_fc/$(OBJ64) 265 LDFLAGS64 += -L$(PROJAREA)/hbaapi/$(OBJ64) 266 LDFLAGS64 += -L$(PROJAREA)/ima/$(OBJ64) 267 LDFLAGS64 += -L$(PROJAREA)/mpapi/$(OBJ64) 268 LDFLAGS32 += -L$(PROJAREA)/libstmf/$(OBJ32) 269 LDFLAGS64 += $(LDFLAGS) 270 271 LINK32 = $(CC) $(CFLAGS32) $(CPPFLAGS) $(INCLUDES) $(LDFLAGS32) -o $@ $(MODULE_OBJ_32) $(DTRACE_OBJ) $(LDLIBS) 272 LINK64 = $(CC) $(CFLAGS64) $(CPPFLAGS) $(INCLUDES) $(LDFLAGS64) -o $@ $(MODULE_OBJ_64) $(LDLIBS) 273