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 # Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
  23 # Copyright 2016 RackTop Systems.
  24 #
  25 
  26 include         $(SRC)/cmd/Makefile.cmd
  27 
  28 # Note: Why SUBDIRS-common isn't sorted alphabetically
  29 #
  30 # The items under SGS are not independent of each other.
  31 # They must be built in an order that ensures that
  32 # all dependencies of an item have been built before the
  33 # item itself.
  34 #
  35 SUBDIRS-common= libconv         \
  36                 .WAIT           \
  37                 libdl           \
  38                 libelf          \
  39                 liblddbg        \
  40                 .WAIT           \
  41                 libld           \
  42                 libldmake       \
  43                 libldstab       \
  44                 librtld         \
  45                 libcrle         \
  46                 .WAIT           \
  47                 0@0             \
  48                 ld              \
  49                 ldd             \
  50                 lddstub         \
  51                 rtld            \
  52                 link_audit      \
  53                 .WAIT           \
  54                 librtld_db      \
  55                 ldprof          \
  56                 pvs             \
  57                 crle            \
  58                 ar              \
  59                 dump            \
  60                 elfdump         \
  61                 elfedit         \
  62                 elfwrap         \
  63                 error           \
  64                 gprof           \
  65                 lari            \
  66                 lex             \
  67                 lorder          \
  68                 m4              \
  69                 mcs             \
  70                 moe             \
  71                 nm              \
  72                 prof            \
  73                 ranlib          \
  74                 size            \
  75                 symorder        \
  76                 tsort           \
  77                 unifdef         \
  78                 yacc
  79 
  80 SUBDIRS-i386=
  81 SUBDIRS-sparc=  rtld.4.x
  82 
  83 SUBDIRS=        $(SUBDIRS-common) $(SUBDIRS-$(MACH))
  84 
  85 # Messaging support
  86 #
  87 POSUBDIRS=      m4              nm      tsort           yacc
  88 POFILE=         sgs.po
  89 POFILES=        $(POSUBDIRS:%=%/%.po)
  90 
  91 MSGSUBDIRS=     ld              ldd             libld           liblddbg \
  92                 libldstab       librtld         rtld            libelf \
  93                 ldprof          libcrle         pvs             elfdump \
  94                 elfedit         crle            moe             lari \
  95                 librtld_db      elfwrap         ar
  96 
  97 MSGDIR=         messages
  98 
  99 
 100 all :=          TARGET= all
 101 install :=      TARGET= install
 102 clean :=        TARGET= clean
 103 clobber :=      TARGET= clobber
 104 delete :=       TARGET= delete
 105 lint :=         TARGET= lint
 106 _msg :=         TARGET= catalog
 107 _msg_gettext := TARGET= catalog
 108 _msg_sgsmsg :=  TARGET= catalog
 109 chkmsg :=       TARGET= chkmsg
 110 
 111 
 112 .KEEP_STATE:
 113 
 114 .PARALLEL:      $(SUBDIRS)
 115 
 116 all install:    native-add .WAIT $(SUBDIRS)
 117 
 118 include         $(SRC)/cmd/Makefile.targ
 119 
 120 # Messaging support
 121 #
 122 _msg: _msg_gettext _msg_sgsmsg
 123 
 124 _msg_gettext: $(MSGDOMAIN)/$(POFILE)
 125 
 126 _msg_sgsmsg: $(MSGDIR)
 127 
 128 $(MSGDOMAIN)/$(POFILE): \
 129                 $(MSGDOMAIN) $(POFILE)
 130 
 131 $(POFILE):      $(POSUBDIRS)
 132                 $(RM) $(POFILE)
 133                 cat $(POFILES) > $(POFILE)
 134 
 135 $(MSGDIR):      $(MSGSUBDIRS) FRC
 136                 @ cd $@; pwd; $(MAKE) $(TARGET)
 137 
 138 chkmsg:         libconv $(MSGSUBDIRS) FRC
 139 
 140 check:          chkmsg
 141 
 142 # built from lib/Makefile
 143 install_lib:    FRC
 144                 @ cd lex; pwd; $(MAKE) $@
 145                 @ cd yacc; pwd; $(MAKE) $@
 146 
 147 lint:           $(SUBDIRS)
 148 
 149 delete \
 150 clean clobber:  native-clobber .WAIT $(SUBDIRS) $(MSGDIR)
 151 
 152 $(SUBDIRS):     FRC
 153                 @ cd $@; pwd; $(MAKE) $(TARGET)
 154 
 155 
 156 # Integration of ld and ld.so.1 in some developement cycles requires that both
 157 # of these modules be built using the new ld.  This `native' target allows us
 158 # to build a local ld which will then be used to build the delivered version of
 159 # itself and ld.so.1.  Once this new functionality appears in the standard ld
 160 # this target can be disabled.
 161 
 162 native-add:     native-proto FRC
 163                 @ cd tools/$(MACH); pwd; $(MAKE) native
 164                 @ cd libconv/$(MACH); pwd; $(MAKE)
 165                 @ cd libelf/$(MACH); pwd; $(MAKE) native
 166                 @ cd liblddbg/$(MACH); pwd; $(MAKE) native
 167                 @ cd libldstab/$(MACH); pwd; $(MAKE) native
 168                 @ cd libld/$(MACH); pwd; $(MAKE) native
 169                 @ cd ld/$(MACH); pwd; $(MAKE) native
 170 
 171 native-clobber:
 172                 @ cd tools; pwd; $(MAKE) $(TARGET)
 173                 $(RM) -r proto/$(MACH)
 174 
 175 native-proto:
 176                 -@mkdir -p proto/$(MACH)
 177                 -@mkdir -p proto/$(MACH)/lib
 178                 -@mkdir -p proto/$(MACH)/usr
 179                 -@mkdir -p proto/$(MACH)/usr/bin
 180 
 181 FRC:
 182 
 183 #
 184 # Cross-reference customization: ignore the directories named by XRPRUNE,
 185 # and tweak the file globs slightly.
 186 #
 187 XRPRUNE=        rtld.4.x packages abi
 188 XRADD=          *.msg mapfile* llib-[a-z]*
 189 XRDEL=          Makefile* kobj_*
 190 
 191 #
 192 # Establish a set of directories for xref to search.  As there are duplicates
 193 # of things like headers, and only one file will be added to the xref database,
 194 # we want xref to list the source file.
 195 #
 196 XRDIRS=         . \
 197                 ../../common/elfcap \
 198                 ../../head \
 199                 ../../uts/common/krtld \
 200                 ../../uts/common/sys \
 201                 ../../uts/sparc/sys \
 202                 ../../uts/sparc/krtld \
 203                 ../../uts/intel/ia32/krtld \
 204                 ../../uts/intel/amd64/krtld
 205 
 206 xref:           FRC
 207                 @ $(RM) cscope.*
 208                 xref -p -x cscope