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 usr/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 usr/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 #
  23 # Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
  24 #
  25 
  26 .KEEP_STATE:
  27 .KEEP_STATE_FILE: .make.state.$(MACH)
  28 
  29 
  30 include         $(SRC)/cmd/sgs/Makefile.var
  31 
  32 SRCBASE =       ../../../..
  33 
  34 i386_ARCH =     intel
  35 sparc_ARCH =    sparc
  36 
  37 ARCH =          $($(MACH)_ARCH)
  38 
  39 # Establish any global flags.
  40 
  41 # Setting DEBUG = -DDEBUG (or "make DEBUG=-DDEBUG ...") enables ASSERT()
  42 # checking.  This is automatically enabled for DEBUG builds, not for non-debug
  43 # builds.  Unset the global C99_DISABLE flag to insure we uncover all compiler
  44 # warnings/errors.
  45 DEBUG =
  46 $(NOT_RELEASE_BUILD)DEBUG = -DDEBUG
  47 
  48 C99_DISABLE =   $(C99_ENABLE)
  49 
  50 CFLAGS +=       $(CCVERBOSE) $(DEBUG) $(XFFLAG)
  51 CFLAGS64 +=     $(CCVERBOSE) $(DEBUG) $(XFFLAG)
  52 
  53 CERRWARN +=     -_gcc=-Wno-type-limits
  54 CERRWARN +=     -_gcc=-Wno-parentheses
  55 CERRWARN +=     -_gcc=-Wno-unused-value
  56 
  57 #
  58 # Location of the shared elfcap code
  59 #
  60 ELFCAP=         $(SRC)/common/elfcap
  61 
  62 # Reassign CPPFLAGS so that local search paths are used before any parent
  63 # $ROOT paths.
  64 CPPFLAGS =      -I. -I../common -I../../include -I../../include/$(MACH) \
  65                 $(CPPFLAGS.master) -I$(ELFCAP)
  66 
  67 # PICS64 is unique to our environment
  68 $(PICS64) :=    sparc_CFLAGS += -xregs=no%appl -K pic
  69 $(PICS64) :=    sparcv9_CFLAGS += -xregs=no%appl -K pic
  70 $(PICS64) :=    CPPFLAGS += -DPIC -D_REENTRANT
  71 
  72 LDFLAGS +=      $(ZIGNORE)
  73 DYNFLAGS +=     $(ZIGNORE)
  74 
  75 # Establish the local tools, proto and package area.
  76 
  77 SGSHOME =       $(SRC)/cmd/sgs
  78 SGSPROTO =      $(SGSHOME)/proto/$(MACH)
  79 SGSTOOLS =      $(SGSHOME)/tools
  80 SGSMSGID =      $(SGSHOME)/messages
  81 SGSMSGDIR =     $(SGSHOME)/messages/$(MACH)
  82 SGSONLD =       $(ROOT)/opt/SUNWonld
  83 SGSRPATH =      /usr/lib
  84 SGSRPATH64 =    $(SGSRPATH)/$(MACH64)
  85 
  86 #
  87 # Macros to be used to include link against libconv and include vernote.o
  88 #
  89 VERSREF =       -ulink_ver_string
  90 
  91 LDLIBDIR =      -L$(SGSHOME)/libld/$(MACH)
  92 LDLIBDIR64 =    -L$(SGSHOME)/libld/$(MACH64)
  93 
  94 CONVLIBDIR =    -L$(SGSHOME)/libconv/$(MACH)
  95 CONVLIBDIR64 =  -L$(SGSHOME)/libconv/$(MACH64)
  96 
  97 ELFLIBDIR =     -L$(SGSHOME)/libelf/$(MACH)
  98 ELFLIBDIR64 =   -L$(SGSHOME)/libelf/$(MACH64)
  99 
 100 LDDBGLIBDIR =   -L$(SGSHOME)/liblddbg/$(MACH)
 101 LDDBGLIBDIR64 = -L$(SGSHOME)/liblddbg/$(MACH64)
 102 
 103 
 104 # The cmd/Makefile.com and lib/Makefile.com define TEXT_DOMAIN.  We don't need
 105 # this definition as the sgs utilities obtain their domain via sgsmsg(1l).
 106 
 107 DTEXTDOM =
 108 
 109 # Define any generic sgsmsg(1l) flags.  The default message generation system
 110 # is to use gettext(3i), add the -C flag to switch to catgets(3c).
 111 
 112 SGSMSG =                $(SGSTOOLS)/$(MACH)/sgsmsg
 113 SGSMSG_PIGLATIN_NL =    perl $(SGSTOOLS)/common/sgsmsg_piglatin_nl.pl
 114 CHKMSG =                $(SGSTOOLS)/chkmsg.sh
 115 
 116 SGSMSGVFLAG =
 117 SGSMSGFLAGS =   $(SGSMSGVFLAG) -i $(SGSMSGID)/sgs.ident
 118 CHKMSGFLAGS =   $(SGSMSGTARG:%=-m %) $(SGSMSGCHK:%=-m %)
 119 
 120 # Native targets should use the minimum of ld(1) flags to allow building on
 121 # previous releases.  We use mapfiles to scope, but don't bother versioning.
 122 
 123 native :=       DYNFLAGS = -R$(SGSPROTO) -L$(SGSPROTO) $(ZNOVERSION)
 124 
 125 # Comment out the following two lines to have the sgs built from the system
 126 # link-editor, rather than the local proto link-editor.
 127 CC_USE_PROTO =  -Yl,$(SGSPROTO)
 128 LD_USE_PROTO =  $(SGSPROTO)/
 129 
 130 #
 131 # lint-related stuff
 132 #
 133 LIBNAME32 =     $(LIBNAME:%=%32)
 134 LIBNAME64 =     $(LIBNAME:%=%64)
 135 LIBNAMES =      $(LIBNAME32) $(LIBNAME64)
 136 
 137 SGSLINTOUT =    lint.out
 138 LINTOUT1 =      lint.out.1
 139 LINTOUT32 =     lint.out.32
 140 LINTOUT64 =     lint.out.64
 141 LINTOUTS =      $(SGSLINTOUT) $(LINTOUT1) $(LINTOUT32) $(LINTOUT64)
 142 
 143 LINTLIBSRC =    $(LINTLIB:%.ln=%)
 144 LINTLIB32 =     $(LINTLIB:%.ln=%32.ln)
 145 LINTLIB64 =     $(LINTLIB:%.ln=%64.ln)
 146 LINTLIBS =      $(LINTLIB32) $(LINTLIB64)
 147 
 148 LINTFLAGS =     -m -errtags=yes -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
 149 LINTFLAGS64 =   -m -errtags=yes -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED \
 150                     $(VAR_LINTFLAGS64)
 151 
 152 #
 153 # When building a lint library, no other lint libraries are verified as
 154 # dependencies, nor is the stardard C lint library processed.  All dependency
 155 # verification is carried out through linting the sources themselves.
 156 #
 157 $(LINTLIB) :=   LINTFLAGS += -n
 158 $(LINTLIB) :=   LINTFLAGS64 += -n
 159 
 160 $(LINTLIB32) := LINTFLAGS += -n
 161 $(LINTLIB32) := LINTFLAGS64 += -n
 162 $(LINTLIB64) := LINTFLAGS += -n
 163 $(LINTLIB64) := LINTFLAGS64 += -n
 164 
 165 #
 166 # These libraries have two resulting lint libraries.  If a dependency is
 167 # declared using these variables, the substitution for the 32/64 versions at
 168 # lint time happens automatically (see Makefile.targ).
 169 #
 170 LD_LIB =        -lld
 171 LD_LIB32 =      -lld32
 172 LD_LIB64 =      -lld64
 173 
 174 LDDBG_LIB =     -llddbg
 175 LDDBG_LIB32 =   -llddbg32
 176 LDDBG_LIB64 =   -llddbg64
 177 
 178 CONV_LIB =      -lconv
 179 CONV_LIB32 =    -lconv32
 180 CONV_LIB64 =    -lconv64