Makefile.master
changeset 0 6a0a40c21448
child 143 b2e21d6a21b8
equal deleted inserted replaced
-1:000000000000 0:6a0a40c21448
       
     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)/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)/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 2006 Sun Microsystems, Inc.  All rights reserved.
       
    23 # Use is subject to license terms.
       
    24 #
       
    25 # ident	"@(#)Makefile.master	1.0	06/03/07 SMI"
       
    26 #
       
    27 
       
    28 MACH :sh= echo ${MACH-`uname -p`}
       
    29 MACH64:sh = isainfo -k
       
    30 
       
    31 #
       
    32 # Global path variables - change these to suit your own build environment
       
    33 #
       
    34 
       
    35 # Base directory where compilers are located.
       
    36 SPRO_VROOT=             /opt/SUNWspro
       
    37 
       
    38 # List of all our locales - if you need to add/remove any, do it here
       
    39 
       
    40 ALL_LOCALES = ar_EG ar_SA bg_BG ca cs_CZ da_DK da_DK de_DE de_AT de_CH de_LU el_GR el_CY \
       
    41 en_AU en_CA en_GB en_IE en_MT en_NZ en_US es_ES es_AR es_BO es_CL es_CO es_CR es_EC es_GT \
       
    42 es_MX es_NI es_PA es_PE es_PY es_SV es_UY es_VE et_EE fi_FI fr_FR fr_BE fr_CA fr_CH fr_LU \
       
    43 he_IL hi_IN hr_HR hu_HU is_IS it_IT ja_JP ko_KR lt_LT lv_LV mk_MK nb_NO nl_NL nl_BE nn_NO \
       
    44 no_NO no_NY pl_PL pt_PT pt_BR ro_RO ru_RU sh_BA sk_SK sl_SI sq_AL sr_CS sr_SP sr_YU sv_SE \
       
    45 ta_IN th_TH tr_TR zh_CN zh_HK zh_TW iconv
       
    46 
       
    47 # Method version - the suffix for all shared objects
       
    48 METHOD_VERSION = 3
       
    49 
       
    50 #
       
    51 # End global variables - you shouldn't need to change anything from here down
       
    52 #
       
    53 
       
    54 
       
    55 # the location of the built pkgs
       
    56 DEST = $(SRC)/dist/$(MACH)
       
    57 
       
    58 # the location of the built binary-only tarballs
       
    59 TB_DEST = $(SRC)/dist/closed_tarballs
       
    60 
       
    61 # the location of the pkg building files
       
    62 ROOT = $(SRC)/proto/$(MACH)
       
    63 PKGROOT = $(ROOT)/pkgroot
       
    64 FILEROOT = $(ROOT)/fileroot
       
    65 
       
    66 
       
    67 # BUILD_TOOLS is the root of all tools including compilers.
       
    68 # ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.
       
    69 
       
    70 BUILD_TOOLS=            /ws/onnv-tools
       
    71 ONBLD_TOOLS=            $(BUILD_TOOLS)/onbld
       
    72 
       
    73 JAVA_ROOT=      /usr/java
       
    74 
       
    75 SFW_ROOT=       /usr/sfw
       
    76 SFWINCDIR=      $(SFW_ROOT)/include
       
    77 SFWLIBDIR=      $(SFW_ROOT)/lib
       
    78 SFWLIBDIR64=    $(SFW_ROOT)/lib/$(MACH64)
       
    79 
       
    80 RPCGEN=         /usr/bin/rpcgen
       
    81 STABS=          $(ONBLD_TOOLS)/bin/$(MACH)/stabs
       
    82 ECHO=           echo
       
    83 INS=            /usr/sbin/install -f
       
    84 INSDIR=		/usr/sbin/install -d	
       
    85 TRUE=           true
       
    86 TR = 		/usr/bin/tr
       
    87 SYMLINK=        /usr/bin/ln -s
       
    88 LN=             /usr/bin/ln
       
    89 CHMOD=          /usr/bin/chmod
       
    90 CHOWN=          $(TRUE)
       
    91 CHGRP=          $(TRUE)
       
    92 COMPRESS=	/usr/bin/compress
       
    93 MV=             /usr/bin/mv -f
       
    94 RM=             /usr/bin/rm -f
       
    95 GREP=           /usr/bin/grep
       
    96 SED=            /usr/bin/sed
       
    97 NAWK=           /usr/bin/nawk
       
    98 CP=             /usr/bin/cp -f
       
    99 MCS=            /usr/ccs/bin/mcs
       
   100 CAT=            /usr/bin/cat
       
   101 M4=             /usr/ccs/bin/m4
       
   102 STRIP=          /usr/ccs/bin/strip
       
   103 LEX=            /usr/ccs/bin/lex
       
   104 YACC=           /usr/ccs/bin/yacc
       
   105 CPP=            /usr/lib/cpp
       
   106 JAVAC=          $(JAVA_ROOT)/bin/javac
       
   107 JAVAH=          $(JAVA_ROOT)/bin/javah
       
   108 JAVADOC=        $(JAVA_ROOT)/bin/javadoc
       
   109 RMIC=           $(JAVA_ROOT)/bin/rmic
       
   110 JAR=            $(JAVA_ROOT)/bin/jar
       
   111 GENOFFSETS=     $(ONBLD_TOOLS)/bin/genoffsets
       
   112 CTFCVTPTBL=     $(ONBLD_TOOLS)/bin/ctfcvtptbl
       
   113 CTFFINDMOD=     $(ONBLD_TOOLS)/bin/ctffindmod
       
   114 XREF=           $(ONBLD_TOOLS)/bin/xref
       
   115 FIND=           /usr/bin/find
       
   116 PERL=           /usr/bin/perl
       
   117 SORT=           /usr/bin/sort
       
   118 TOUCH=          /usr/bin/touch
       
   119 WC=             /usr/bin/wc
       
   120 XARGS=          /usr/bin/xargs
       
   121 ELFSIGN=        /usr/bin/elfsign
       
   122 PKGMK= 		pkgmk
       
   123 TAR=		/usr/bin/tar -cf
       
   124 LD=		/usr/ccs/bin/ld
       
   125 BDFTOPCF =	/usr/openwin/bin/bdftopcf
       
   126 
       
   127 # MACH must be set in the shell environment per uname -p on the build host
       
   128 # More specific architecture variables should be set in lower makefiles.
       
   129 #
       
   130 # MACH64 is derived from MACH, and BUILD64 is set to `#' for
       
   131 # architectures on which we do not build 64-bit versions.
       
   132 # (There are no such architectures at the moment.)
       
   133 #
       
   134 # Set BUILD64=# in the environment to disable 64-bit amd64
       
   135 # builds on i386 machines.
       
   136 
       
   137 MACH64_1=	$(MACH:sparc=sparcv9)
       
   138 MACH64=		$(MACH64_1:i386=amd64)
       
   139 
       
   140 MACH32_1=	$(MACH:sparc=sparcv7)
       
   141 MACH32=		$(MACH32_1:i386=i86)
       
   142 
       
   143 sparc_BUILD64=
       
   144 i386_BUILD64=
       
   145 BUILD64=	$($(MACH)_BUILD64)
       
   146 
       
   147 #
       
   148 # C compiler mode. Future compilers may change the default on us,
       
   149 # so force extended ANSI mode globally. Lower level makefiles can
       
   150 # override this by setting CCMODE.
       
   151 #
       
   152 CCMODE=			-Xa
       
   153 CCMODE64=		-Xa
       
   154 
       
   155 #
       
   156 # C compiler verbose mode. This is so we can enable it globally,
       
   157 # but turn it off in the lower level makefiles of things we cannot
       
   158 # (or aren't going to) fix.
       
   159 #
       
   160 CCVERBOSE=		-v
       
   161 
       
   162 # set this to the secret flag "-Wc,-Qiselect-v9abiwarn=1" to get warnings
       
   163 # from the compiler about places the -xarch=v9 may differ from -xarch=v9c.
       
   164 V9ABIWARN=
       
   165 
       
   166 # set this to the secret flag "-Wc,-Qiselect-regsym=0" to disable register
       
   167 # symbols (used to detect conflicts between objects that use global registers)
       
   168 # we disable this now for safety, and because genunix doesn't link with
       
   169 # this feature (the v9 default) enabled.
       
   170 #
       
   171 # REGSYM is separate since the C++ driver syntax is different.
       
   172 CCREGSYM=		-Wc,-Qiselect-regsym=0
       
   173 CCCREGSYM=		-Qoption cg -Qiselect-regsym=0
       
   174 
       
   175 #
       
   176 # generate 32-bit addresses in the v9 kernel. Saves memory.
       
   177 CCABS32=		-Wc,-xcode=abs32
       
   178 
       
   179 # One optimization the compiler might perform is to turn this:
       
   180 #	#pragma weak foo
       
   181 #	extern int foo;
       
   182 #	if (&foo)
       
   183 #		foo = 5;
       
   184 # into
       
   185 #	foo = 5;
       
   186 # Since we do some of this (foo might be referenced in common kernel code
       
   187 # but provided only for some cpu modules or platforms), we disable this
       
   188 # optimization.
       
   189 # 
       
   190 sparc_CCUNBOUND	= -Wd,-xsafe=unboundsym
       
   191 i386_CCUNBOUND	=
       
   192 CCUNBOUND	= $($(MACH)_CCUNBOUND)
       
   193 
       
   194 #
       
   195 # compiler '-xarch' flag. This is here to centralize it and make it
       
   196 # overridable for testing.
       
   197 sparc_XARCH=		-xarch=v8
       
   198 sparcv9_XARCH=		-xarch=v9
       
   199 i386_XARCH=
       
   200 amd64_XARCH=		-xarch=amd64 -Ui386 -U__i386
       
   201 
       
   202 # assembler '-xarch' flag.  Different from compiler '-xarch' flag.
       
   203 sparc_AS_XARCH=		-xarch=v8
       
   204 sparcv9_AS_XARCH=	-xarch=v9
       
   205 i386_AS_XARCH=
       
   206 amd64_AS_XARCH=		-xarch=amd64 -P -Ui386 -U__i386
       
   207 
       
   208 #
       
   209 # These flags define what we need to be 'standalone' i.e. -not- part
       
   210 # of the rather more cosy userland environment.  This basically means
       
   211 # the kernel.
       
   212 #
       
   213 # XX64	future versions of gcc will make -mcmodel=kernel imply -mno-red-zone
       
   214 #
       
   215 sparc_STAND_FLAGS=	-_gcc=-ffreestanding
       
   216 sparcv9_STAND_FLAGS=	-_gcc=-ffreestanding
       
   217 i386_STAND_FLAGS=	-_gcc=-ffreestanding
       
   218 amd64_STAND_FLAGS=	-Wu,-xmodel=kernel
       
   219 
       
   220 SAVEARGS=		-Wu,-save_args
       
   221 amd64_STAND_FLAGS	+= $(SAVEARGS)
       
   222 
       
   223 STAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
       
   224 STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
       
   225 
       
   226 #
       
   227 # disable the incremental linker
       
   228 ILDOFF=			-xildoff
       
   229 #
       
   230 XDEPEND=		-xdepend
       
   231 XFFLAG=			-xF
       
   232 XESS=			-xs
       
   233 XSTRCONST=		-xstrconst 
       
   234 
       
   235 #
       
   236 # turn warnings into errors (C)
       
   237 CERRWARN = -errtags=yes -errwarn=%all
       
   238 CERRWARN += -erroff=E_EMPTY_TRANSLATION_UNIT
       
   239 CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
       
   240 
       
   241 #
       
   242 # turn warnings into errors (C++)
       
   243 CCERRWARN=		-xwe
       
   244 
       
   245 # C99 mode
       
   246 C99_ENABLE=	-xc99=%all
       
   247 C99_DISABLE=	-xc99=%none
       
   248 C99MODE=	$(C99_DISABLE)
       
   249 C99LMODE=	$(C99MODE:-xc99%=-Xc99%)
       
   250 
       
   251 # In most places, assignments to these macros should be appended with +=
       
   252 # (CPPFLAGS.master allows values to be prepended to CPPFLAGS).
       
   253 sparc_CFLAGS=	$(sparc_XARCH)
       
   254 sparcv9_CFLAGS=	$(sparcv9_XARCH) -dalign $(CCVERBOSE) $(V9ABIWARN) $(CCREGSYM)
       
   255 i386_CFLAGS=	$(i386_XARCH)
       
   256 amd64_CFLAGS=	$(amd64_XARCH)
       
   257 
       
   258 sparc_ASFLAGS=	$(sparc_AS_XARCH)
       
   259 sparcv9_ASFLAGS=$(sparcv9_AS_XARCH)
       
   260 i386_ASFLAGS=	$(i386_AS_XARCH)
       
   261 amd64_ASFLAGS=	$(amd64_AS_XARCH)
       
   262 
       
   263 #
       
   264 sparc_COPTFLAG=		-xO3
       
   265 sparcv9_COPTFLAG=	-xO3
       
   266 i386_COPTFLAG=		-xO3
       
   267 amd64_COPTFLAG=		-xO3
       
   268 
       
   269 COPTFLAG= $($(MACH)_COPTFLAG)
       
   270 COPTFLAG64= $($(MACH64)_COPTFLAG)
       
   271 
       
   272 #
       
   273 # tradeoff time for space (smaller is better)
       
   274 #
       
   275 sparc_SPACEFLAG		= -xspace -W0,-Lt -W2,-Rcond_elim
       
   276 sparcv9_SPACEFLAG	= -xspace -W0,-Lt -W2,-Rcond_elim
       
   277 i386_SPACEFLAG		= -xspace
       
   278 amd64_SPACEFLAG		=
       
   279 
       
   280 SPACEFLAG		= $($(MACH)_SPACEFLAG)
       
   281 SPACEFLAG64		= $($(MACH64)_SPACEFLAG)
       
   282 
       
   283 sparc_XREGSFLAG		= -xregs=no%appl
       
   284 sparcv9_XREGSFLAG	= -xregs=no%appl
       
   285 i386_XREGSFLAG		=
       
   286 amd64_XREGSFLAG		=
       
   287 
       
   288 XREGSFLAG		= $($(MACH)_XREGSFLAG)
       
   289 XREGSFLAG64		= $($(MACH64)_XREGSFLAG)
       
   290 
       
   291 CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \
       
   292 		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND)
       
   293 CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
       
   294 		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND)
       
   295 NATIVE_CFLAGS=	$(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
       
   296 		$(ILDOFF) $(CERRWARN) $(C99MODE) $($(NATIVE_MACH)_CCUNBOUND)
       
   297 
       
   298 DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"	# For messaging.
       
   299 DTS_ERRNO=-D_TS_ERRNO
       
   300 CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
       
   301 	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
       
   302 CPPFLAGS=	$(CPPFLAGS.master)
       
   303 AS_CPPFLAGS=	$(CPPFLAGS.master)
       
   304 JAVAFLAGS=	-deprecation
       
   305 #
       
   306 # This is overwritten by local Makefile when PROG is a list.
       
   307 #
       
   308 POFILE= $(PROG).po
       
   309 
       
   310 sparc_CCFLAGS=		-cg92 -compat=4 \
       
   311 			-Qoption ccfe -messages=no%anachronism \
       
   312 			$(CCERRWARN)
       
   313 sparcv9_CCFLAGS=	$(sparcv9_XARCH) -dalign -compat=5 \
       
   314 			-Qoption ccfe -messages=no%anachronism \
       
   315 			-Qoption ccfe -features=no%conststrings \
       
   316 			$(CCCREGSYM) \
       
   317 			$(CCERRWARN)
       
   318 i386_CCFLAGS=		-compat=4 \
       
   319 			-Qoption ccfe -messages=no%anachronism \
       
   320 			-Qoption ccfe -features=no%conststrings \
       
   321 			$(CCERRWARN)
       
   322 amd64_CCFLAGS=		$(amd64_XARCH) -compat=5 \
       
   323 			-Qoption ccfe -messages=no%anachronism \
       
   324 			-Qoption ccfe -features=no%conststrings \
       
   325 			$(CCERRWARN)
       
   326 
       
   327 sparc_CCOPTFLAG=	-O
       
   328 sparcv9_CCOPTFLAG=	-O
       
   329 i386_CCOPTFLAG=		-O
       
   330 amd64_CCOPTFLAG=	-O
       
   331 
       
   332 CCOPTFLAG=	$($(MACH)_CCOPTFLAG)
       
   333 CCOPTFLAG64=	$($(MACH64)_CCOPTFLAG)
       
   334 CCFLAGS=	$(CCOPTFLAG) $($(MACH)_CCFLAGS)
       
   335 CCFLAGS64=	$(CCOPTFLAG64) $($(MACH64)_CCFLAGS)
       
   336 
       
   337 # For some future builds, NATIVE_MACH and MACH might be different.
       
   338 # Therefore, NATIVE_MACH needs to be redefined in the
       
   339 # environment as `uname -p` to override this macro.
       
   340 #
       
   341 # For now at least, we cross-compile amd64 on i386 machines.
       
   342 NATIVE_MACH=	$(MACH:amd64=i386)
       
   343 
       
   344 # Define native compilation macros
       
   345 #
       
   346 
       
   347 # Specify platform compiler versions for languages
       
   348 # that we use (currently only c and c++).
       
   349 #
       
   350 sparc_CC=		$(SPRO_VROOT)/bin/cc
       
   351 sparc_CCC=		$(SPRO_VROOT)/bin/CC
       
   352 sparc_CPP=		/usr/ccs/lib/cpp
       
   353 sparc_LD=		/usr/ccs/bin/ld
       
   354 sparc_LINT=		$(SPRO_VROOT)/bin/lint
       
   355 
       
   356 sparcv9_CC=		$(SPRO_VROOT)/bin/cc
       
   357 sparcv9_CCC=		$(SPRO_VROOT)/bin/CC
       
   358 sparcv9_CPP=		/usr/ccs/lib/cpp
       
   359 sparcv9_LD=		/usr/ccs/bin/ld
       
   360 sparcv9_LINT=		$(SPRO_VROOT)/bin/lint
       
   361 
       
   362 # We compile 32-bit objects with cc by default
       
   363 i386_CC=		$(SPRO_VROOT)/bin/cc
       
   364 i386_CCC=		$(SPRO_VROOT)/bin/CC
       
   365 i386_CPP=		/usr/ccs/lib/cpp
       
   366 i386_LD=		/usr/ccs/bin/ld
       
   367 i386_LINT=		$(SPRO_VROOT)/bin/lint
       
   368 
       
   369 # We compile 64-bit objects with cc by default
       
   370 amd64_CC=		$(SPRO_VROOT)/bin/cc
       
   371 amd64_CCC=		$(SPRO_VROOT)/bin/CC
       
   372 amd64_CPP=		/usr/ccs/lib/cpp
       
   373 amd64_LD=		/usr/ccs/bin/ld
       
   374 amd64_LINT=		$(SPRO_VROOT)/bin/lint
       
   375 
       
   376 NATIVECC=		$($(NATIVE_MACH)_CC)
       
   377 NATIVECCC=		$($(NATIVE_MACH)_CCC)
       
   378 NATIVECPP=		$($(NATIVE_MACH)_CPP)
       
   379 NATIVELD=		$($(NATIVE_MACH)_LD)
       
   380 NATIVELINT=		$($(NATIVE_MACH)_LINT)
       
   381 
       
   382 #
       
   383 # Makefile.master.64 overrides these settings
       
   384 #
       
   385 CC=			$(NATIVECC)
       
   386 CCC=			$(NATIVECCC)
       
   387 CPP=			$(NATIVECPP)
       
   388 LD=			$(NATIVELD)
       
   389 LINT=			$(NATIVELINT)
       
   390 
       
   391 #
       
   392 # Optimization CFLAG
       
   393 #
       
   394 
       
   395 CFLAG_OPT =    -D_REENTRANT
       
   396 
       
   397 CFLAG_OPT +=    $(SPACEFLAG) $(C99MODE) $(ILDOFF) $(CCUNBOUND)
       
   398 
       
   399 CFLAG_OPT_64:sh=if [ "`isainfo -k`" = "sparcv9" ]; then \
       
   400 			echo "-xarch=v9 -dalign -D`/usr/bin/uname -p`" ;\
       
   401 		elif [ "`isainfo -k`" = "amd64" ]; then \
       
   402 			echo "-xarch=amd64" ;\
       
   403 		else \
       
   404 			echo ""; \
       
   405 		fi
       
   406 
       
   407 CFLAG_OPT_64 += $(CFLAG_OPT)
       
   408 
       
   409