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