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 2009 Sun Microsystems, Inc.  All rights reserved.
  23 # Use is subject to license terms.
  24 #
  25 #       This makefile drives the production of all implementation architecture
  26 #       dependent modules for the sun4u architecture.
  27 #
  28 
  29 UTSBASE = ..
  30 
  31 include Makefile.sun4u
  32 
  33 #
  34 #       The following are SPARC specific (rather than sun4u) specific modules
  35 #       which are required for the sun4u kernel to completely lint. They are
  36 #       not involved in the build in any other way. In order to minimize
  37 #       build time, it is assumed that they are up to date. But since sun4u
  38 #       is really a separate architecture we cannot use the v7 sparc modules.
  39 #
  40 SPARC_LIB_DIR    = $(UTSBASE)/sparc/lint-libs/$(OBJS_DIR)
  41 
  42 SPARC_LINTS      =
  43 
  44 #
  45 #
  46 #
  47 LINT_LIBS        = $(LINT_LIB) \
  48                    $(LINT_KMODS:%=$(LINT_LIB_DIR)/llib-l%.ln) \
  49                    $(SPARC_LINTS:%=$(SPARC_LIB_DIR)/llib-l%.ln)
  50 
  51 
  52 def             :=      TARGET= def
  53 def.prereq      :=      TARGET= def
  54 all             :=      TARGET= all
  55 all.prereq      :=      TARGET= all
  56 install         :=      TARGET= install
  57 install.prereq  :=      TARGET= all
  58 install_h       :=      TARGET= install_h
  59 install_h.prere :=      TARGET= install_h
  60 clean           :=      TARGET= clean
  61 clobber         :=      TARGET= clobber
  62 lint            :=      TARGET= lint
  63 lint.prereq     :=      TARGET= lint
  64 lintlib         :=      TARGET= lintlib
  65 modlintlib      :=      TARGET= modlintlib
  66 modlist         :=      TARGET= modlist
  67 modlist modlist.sparc :=        NO_STATE= -K $$MODSTATE$$$$
  68 clean.lint      :=      TARGET= clean.lint
  69 check           :=      TARGET= check
  70 
  71 .KEEP_STATE:
  72 
  73 .PARALLEL:      $(PARALLEL_KMODS) $(XMODS) \
  74                 $(IMPLEMENTATIONS) \
  75                 modlist modlist.sparc
  76 
  77 # Override for CPU_KMODS... they cannot be built
  78 # in parallel
  79 .NO_PARALLEL:   $(CPU_KMODS)
  80 
  81 def all clean clobber clean.lint: genassym unix .WAIT \
  82         $(KMODS) $(XMODS) \
  83         $(IMPLEMENTATIONS)
  84 
  85 # list the modules under sun4u.
  86 modlist: unix $(KMODS) $(XMODS) \
  87         $(IMPLEMENTATIONS:.WAIT=)
  88 
  89 # list the modules for Install -k sun4u.
  90 modlist.karch: modlist modlist.sparc
  91 
  92 modlist.sparc:
  93         @cd $(SRC)/uts/sparc; pwd; $(MAKE) $(NO_STATE) modlist
  94 
  95 install: install_platforms genassym unix .WAIT $(KMODS) \
  96         $(XMODS) $(IMPLEMENTATIONS)
  97 
  98 lintlib:        unix
  99 
 100 modlintlib:     $(LINT_KMODS)
 101 
 102 genassym unix $(KMODS): FRC
 103         @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET)
 104 
 105 #
 106 # Privilege constants
 107 #
 108 # NOTE: The rules for generating priv_const.c file are shared between all
 109 # processor architectures and should be kept in sync. If they are changed in
 110 # this file make sure that x86 rules are updated as well.
 111 #
 112 PRIVS_C = $(UTSBASE)/common/os/priv_const.c
 113 
 114 $(PRIVS_C): $(PRIVS_AWK) $(PRIVS_DEF)
 115         $(NAWK) -f $(PRIVS_AWK) < $(PRIVS_DEF) cfile=$@
 116 
 117 
 118 #
 119 # Prerequisites
 120 #
 121 # The uts/Makefile defines build parallelism for sun4 platforms such that sparc,
 122 # sun4u and sun4v are all built in parallel. Also this Makefile specifies that
 123 # all IMPLEMENTATIONS sun4u sub-platforms are built in parallel. This requires
 124 # building certain parts before the parallel build can start. The uts/Makefile
 125 # appends the '.prereq' string to the original target and executes this Makefile
 126 # to build any prerequisites needed before the full parallel build can start.
 127 # After that make continues with normal targets.
 128 #
 129 # Any build prerequisites for sun4 and IMPLEMENTATIONS builds should be
 130 # described here.
 131 #
 132 # genassym is used to build dtrace and genunix, so it should be built first.
 133 #
 134 # priv_const.c is required to build genunix.
 135 #
 136 # genunix is used by everyone to ctfmerge with. Genunix is merged with sparc/ip
 137 #   so as a side effect this dependency builds sparc/ip as part of the
 138 #   prerequisites.
 139 #
 140 # unix is not required by itself but several sun4u platforms require
 141 #   sun4u/platmod to be present. The easiest way to achieve this is to build
 142 #   sun4u/unix first since sun4u/unix Makefile builds sun4u/platform correctly.
 143 #   This causes full sun4u/unix to be built before all sun4u platforms and
 144 #   before uts/sun4v and uts/sparc, but it acceptable since it is not spending
 145 #   too much time building sun4u/unix.
 146 #
 147 all.prereq def.prereq install.prereq: genassym genunix unix
 148 
 149 #
 150 # Various sun4u platforms expect proto/root_sparc/platform/sun4u/include to be
 151 # present. This is handled by running make install_h in sun4u/unix directory
 152 # first.
 153 #
 154 install_h.prereq: FRC
 155         @cd sys; pwd; $(MAKE) $(TARGET)
 156 
 157 #
 158 # sun4u/unix and sun4u/genunix should be linted first since sparc does global
 159 # cross-check with these lint libraries. The sun4u/unix and sun4u/genunix can be
 160 # linted in parallel.
 161 #
 162 LINT_PREREQ = unix.lint genunix.lint
 163 lint.prereq: $(LINT_PREREQ)
 164 
 165 .PARALLEL:  $(LINT_PREREQ)
 166 
 167 $(LINT_PREREQ):
 168         @cd $(@:%.lint=%); pwd; $(MAKE) $(TARGET)
 169 
 170 #
 171 # Nothing to do with any other prerequisites
 172 #
 173 %.prereq:
 174 
 175 #
 176 # Platform inter-dependencies
 177 #
 178 lw8: serengeti
 179 
 180 quasar: darwin
 181 
 182 #
 183 # The genunix requires priv_const.c file to be generated first.
 184 #
 185 genunix: $(PRIVS_C)
 186 
 187 #
 188 # Rules
 189 #
 190 
 191 $(IMPLEMENTATIONS):     FRC
 192         @cd $@; pwd; THISIMPL=$@ $(MAKE) $(NO_STATE) $(TARGET)
 193 
 194 $(XMODS):       FRC
 195         @if [ -f $@/Makefile  ]; then \
 196                 cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET); \
 197         else \
 198                 true; \
 199         fi
 200 
 201 install_h check: install_platforms $(IMPLEMENTATIONS) \
 202         @cd sys; pwd; $(MAKE) $(TARGET)
 203         @cd vm; pwd; $(MAKE) $(TARGET)
 204 
 205 #
 206 # Rules for the /platforms directories.  This is hardwired here because
 207 # the first stage of the project (KBI) only implements the userland
 208 # changes, but the only reasonable place to record the aliases is
 209 # here in kernel land.
 210 #
 211 $(ROOT_PLAT_DIRS): $(ROOT_PLAT_DIR)
 212         -$(INS.dir)
 213 
 214 #
 215 # create directories in /usr/platform/ for the implementations that are
 216 # defined in $(IMPLEMENTED_PLATFORM)
 217 #       (eg. SUNW,Ultra-1)
 218 #
 219 # Foreach $(IMPLEMENTED_PLATFORM) there can be a list of $(LINKED_PLATFORMS)
 220 # that are linked to it.
 221 #
 222 $(USR_PLAT_DIR)/$(IMPLEMENTED_PLATFORM):        $(USR_PLAT_DIR)
 223         -$(INS.dir)
 224 
 225 #
 226 # create the links in /usr/platform/ foreach $(LINKED_PLATFORMS)
 227 # to it's corresponding $(IMPLEMENTED_PLATFORM).
 228 #
 229 PLATFORMS       = $(LINKED_PLATFORMS)
 230 
 231 $(USR_PLAT_DIRS): $(USR_PLAT_DIR)
 232         $(INS.slink3)
 233 
 234 PLATFORMS       += $(IMPLEMENTED_PLATFORM)
 235 
 236 #
 237 # Make the /platforms directories.  This is hardwired here because
 238 # the first stage of the project (KBI) only implements the userland
 239 # changes, but the only reasonable place to record the aliases is
 240 # here in kernel land.
 241 #
 242 install_platforms:      $(ROOT_PSM_DIR) $(USR_PSM_DIR) \
 243                         $(ROOT_PLAT_DIRS) $(USR_PLAT_DIRS) \
 244                         $(USR_DESKTOP_DIR) $(USR_DESKTOP_INC_DIR) \
 245                         $(USR_DESKTOP_SBIN_DIR) $(USR_DESKTOP_LIB_DIR)
 246 
 247 #
 248 # rules for making include, sbin, lib dirs/links in
 249 # /usr/platform/$(PLATFORM)/ for desktop platforms
 250 #
 251 $(USR_DESKTOP_INC_DIR):         $(USR_DESKTOP_DIR)
 252         $(INS.slink4)
 253 
 254 $(USR_DESKTOP_SBIN_DIR):        $(USR_DESKTOP_DIR)
 255         $(INS.slink5)
 256 
 257 $(USR_DESKTOP_LIB_DIR):         $(USR_DESKTOP_DIR)
 258         -$(INS.dir)
 259 
 260 #
 261 #       Full kernel lint target.
 262 #
 263 LINT_TARGET     = globallint
 264 
 265 globallint:
 266         @pwd
 267         @-$(ECHO) "\nSUN4U KERNEL: global crosschecks:"
 268         @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2)
 269 
 270 lint:   lintlib .WAIT modlintlib .WAIT $(SPARC_LINTS) $(LINT_DEPS) \
 271         $(IMPLEMENTATIONS) $(CPU_KMODS)
 272 
 273 include ../Makefile.targ
 274 
 275 #
 276 # Cross-reference customization: build a cross-reference over all of the
 277 # sun4u-related directories.
 278 #
 279 XRDIRS  = ../sun4u ../sun4 ../sfmmu ../sparc ../sun ../common
 280 XRPRUNE = i86pc
 281 
 282 cscope.out tags: FRC
 283         $(XREF) -x $@