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 2010 Sun Microsystems, Inc.  All rights reserved.
  23 # Use is subject to license terms.
  24 #
  25 
  26 TOPDIR =        ../../../../..
  27 
  28 include $(TOPDIR)/uts/Makefile.uts
  29 
  30 all     :=      TARGET = all
  31 install :=      TARGET = install
  32 clean   :=      TARGET = clean
  33 
  34 TARG_MACH =     sparcv9
  35 TARG_MACH_DIR = sparcv9
  36 ARCHVERS =      v9
  37 PLATFORM =      sun4
  38 #ARCHMMU  =     sfmmu
  39 PROMVERS =      ieee1275
  40 ASFLAGS +=      $(sparcv9_XARCH)
  41 
  42 ARCH_C_SRC =    sun4u_memlist.c sun4x_standalloc.c sun4dep.c
  43 ARCH_S_SRC =    sparcv9_subr.s
  44 SRT0_S =        sun4u_srt0.s
  45 INLINES =
  46 
  47 LDFLAGS +=      -L$(TOPDIR)/psm/stand/lib/promif/$(TARG_MACH)/$(PROMVERS)/common
  48 
  49 #
  50 # The following libraries are build in LIBPLAT_DIR
  51 #
  52 LIBPLAT_DIR =   $(TOPDIR)/psm/stand/lib/promif/$(TARG_MACH)/$(PROMVERS)/$(PLATFORM)
  53 LIBPLAT_LIBS =  libplat.a
  54 LIBPLAT_L_LIBS= $(LIBPLAT_LIBS:lib%.a=llib-l%.ln)
  55 LIBPLAT_DEP =   $(LIBPLAT_DIR)/$(LIBPLAT_LIBS)
  56 LIBPLAT_DEP_L = $(LIBPLAT_DIR)/$(LIBPLAT_L_LIBS)
  57 
  58 #
  59 # Platform specific libraries
  60 #
  61 PSMLIBS +=      $(LIBPLAT_LIBS:lib%.a=-l%)
  62 PSMLIB_DIRS +=  $(LIBPLAT_DIR)
  63 
  64 include ../Makefile.com
  65 
  66 CPPINCS         += -I$(TOPDIR)/psm/stand/boot/sparc/sun4
  67 
  68 #
  69 # Set the choice of compiler. 
  70 
  71 include $(TOPDIR)/psm/Makefile.psm.64
  72 
  73 CFLAGS64        += -xchip=ultra $(CCABS32)
  74 
  75 #
  76 # XXX this totally sucks since it effectively turns off -errchk=longptr64,
  77 # which we really should be using.
  78 #
  79 LINTFLAGS64 = $(LINTFLAGS) -m64
  80 
  81 #
  82 # Cross-reference customization: include all boot-related source files.
  83 #
  84 STANDLIBDIR=    ../../../../../stand/lib
  85 STANDSYSDIR=    ../../../../../stand/sys
  86 PROMDIRS=       ../../../../promif
  87 NAMESDIRS=      ../../../lib/names/sparcv9 ../../../lib/names/sparc/common
  88 XRDIRS +=       ../../sparc/common ../../common $(STANDLIBDIR) \
  89                 $(STANDSYSDIR) $(PROMDIRS) $(NAMESDIRS)
  90 XRPRUNE =       i86pc i386
  91 
  92 
  93 #############################
  94 #
  95 #  WANboot booter
  96 #
  97 # Libraries used to build wanboot
  98 #
  99 # EXPORT DELETE START
 100 LIBWANBOOT =    libwanboot.a
 101 LIBSCRYPT =     libscrypt.a
 102 LIBSSL =        libssl.a
 103 LIBCRYPTO =     libcrypto.a
 104 # EXPORT DELETE END
 105 
 106 LIBWAN_LIBS     = \
 107                 $(LIBWANBOOT) \
 108                 libnvpair.a libufs.a libhsfs.a libnfs.a \
 109                 libxdr.a libnames.a libsock.a libinet.a libtcp.a \
 110                 $(LIBSCRYPT) $(LIBSSL) $(LIBCRYPTO) \
 111                 libmd5.a libsa.a libprom.a \
 112                 $(LIBSSL) \
 113                 $(LIBPLAT_LIBS)
 114 WAN_LIBS        = $(LIBWAN_LIBS:lib%.a=-l%)
 115 WAN_DIRS        = $(LIBNAME_DIR:%=-L%) $(LIBSYS_DIR:%=-L%)
 116 WAN_DIRS        += $(LIBPLAT_DIR:%=-L%) $(LIBPROM_DIR:%=-L%)
 117 
 118 #
 119 # Loader flags used to build wanboot
 120 #
 121 WAN_MAPFILE     = $(MACH_DIR)/mapfile
 122 WAN_LDFLAGS     = -dn -M $(WAN_MAPFILE) -e _start $(WAN_DIRS)
 123 WAN_L_LDFLAGS   = $(WAN_DIRS)
 124 
 125 #
 126 # Object files used to build wanboot
 127 #
 128 WAN_SRT0        = $(SRT0_OBJ)
 129 WAN_OBJS        = $(OBJS) wbfsconf.o wbcli.o wanboot.o ramdisk.o
 130 WAN_L_OBJS      = $(WAN_SRT0:%.o=%.ln) $(WAN_OBJS:%.o=%.ln)
 131 
 132 
 133 #############################
 134 #
 135 # NFS booter
 136 #
 137 # Libraries used to build nfsboot
 138 #
 139 LIBNFS_LIBS     = libnfs.a libxdr.a libnames.a \
 140                 libsock.a libinet.a libtcp.a libsa.a libprom.a \
 141                 $(LIBPLAT_LIBS)
 142 NFS_LIBS        = $(LIBNFS_LIBS:lib%.a=-l%)
 143 NFS_DIRS        = $(LIBNAME_DIR:%=-L%) $(LIBSYS_DIR:%=-L%)
 144 NFS_DIRS        += $(LIBPLAT_DIR:%=-L%) $(LIBPROM_DIR:%=-L%)
 145 
 146 #
 147 # Loader flags used to build inetboot
 148 #
 149 NFS_MAPFILE     = $(MACH_DIR)/mapfile
 150 NFS_LDFLAGS     = -dn -M $(NFS_MAPFILE) -e _start $(NFS_DIRS)
 151 NFS_L_LDFLAGS   = $(NFS_DIRS)
 152 
 153 #
 154 # Object files used to build inetboot
 155 #
 156 NFS_SRT0        = $(SRT0_OBJ)
 157 NFS_OBJS        = $(OBJS) nfsconf.o inetboot.o ramdisk.o
 158 NFS_L_OBJS      = $(NFS_SRT0:%.o=%.ln) $(NFS_OBJS:%.o=%.ln)
 159 
 160 
 161 #include $(BOOTSRCDIR)/Makefile.rules
 162 
 163 FRC:
 164 
 165 .KEEP_STATE:
 166 
 167 all: $(WANBOOT) $(NFSBOOT)
 168 
 169 install: all                                    \
 170         $(ROOT_PLAT_SUN4U_WANBOOT)              \
 171         $(ROOT_PLAT_SUN4V_WANBOOT)              \
 172         $(USR_PLAT_SUN4U_LIB_FS_NFS_NFSBOOT)    \
 173         $(USR_PLAT_SUN4V_LIB_FS_NFS_NFSBOOT)
 174 
 175 $(WANBOOT): $(WAN_MAPFILE) $(WAN_SRT0) $(WAN_OBJS) $(LIBDEPS)
 176         $(LD) $(WAN_LDFLAGS) -o $@ $(WAN_SRT0) $(WAN_OBJS) $(WAN_LIBS)
 177         $(MCS) -d $@
 178         $(POST_PROCESS)
 179         $(MCS) -c $@
 180         $(STRIP) $@
 181 
 182 $(NFSBOOT): $(NFS_MAPFILE) $(NFS_SRT0) $(NFS_OBJS) $(LIBDEPS)
 183         $(LD) $(NFS_LDFLAGS) -o $@ $(NFS_SRT0) $(NFS_OBJS) $(NFS_LIBS)
 184         $(MCS) -d $@
 185         $(POST_PROCESS)
 186         $(MCS) -c $@
 187         $(STRIP) $@
 188 
 189 $(WANBOOT)_lint: $(WAN_L_OBJS) $(L_LIBDEPS)
 190         @echo ""
 191         @echo wanboot lint: global crosschecks:
 192         $(LINT.c) $(WAN_L_LDFLAGS) $(WAN_L_OBJS) $(WAN_LIBS)
 193 
 194 $(NFSBOOT)_lint: $(NFS_L_OBJS) $(L_LIBDEPS)
 195         @echo ""
 196         @echo inetboot lint: global crosschecks:
 197         $(LINT.c) $(NFS_L_LDFLAGS) $(NFS_L_OBJS) $(NFS_LIBS)
 198 
 199 $(ROOT_PLAT_SUN4U_WANBOOT): $(WANBOOT)
 200         $(INS) -s -m $(FILEMODE) -f $(ROOT_PLAT_DIR)/sun4u $(WANBOOT)
 201 
 202 $(ROOT_PLAT_SUN4V_WANBOOT): $(WANBOOT)
 203         $(INS) -s -m $(FILEMODE) -f $(ROOT_PLAT_DIR)/sun4v $(WANBOOT)
 204 
 205 $(USR_PLAT_SUN4U_LIB_FS_NFS):
 206         $(INS.dir)
 207 
 208 $(USR_PLAT_SUN4V_LIB_FS_NFS):
 209         $(INS.dir)
 210 
 211 $(USR_PLAT_SUN4U_LIB_FS_NFS_NFSBOOT): $(USR_PLAT_SUN4U_LIB_FS_NFS) $(NFSBOOT)
 212         $(INS) -s -m $(FILEMODE) -f $(USR_PLAT_SUN4U_LIB_FS_NFS) $(NFSBOOT)
 213 
 214 $(USR_PLAT_SUN4V_LIB_FS_NFS_NFSBOOT): $(USR_PLAT_SUN4V_LIB_FS_NFS) $(NFSBOOT)
 215         $(INS) -s -m $(FILEMODE) -f $(USR_PLAT_SUN4V_LIB_FS_NFS) $(NFSBOOT)
 216 
 217 $(STRIPALIGN): $(CMN_DIR)/$$(@).c
 218         $(NATIVECC) -o $@ $(CMN_DIR)/$@.c
 219 
 220 clean:
 221         $(RM) make.out lint.out
 222         $(RM) $(OBJS) $(CONF_OBJS) $(MISC_OBJS) $(SRT0_OBJ)
 223         $(RM) $(WANBOOT_OBJS) $(NFSBOOT_OBJS)
 224         $(RM) $(L_OBJS) $(CONF_L_OBJS) $(MISC_L_OBJS) $(SRT0_L_OBJ)
 225         $(RM) $(WANBOOT_L_OBJS) $(NFSBOOT_L_OBJS)
 226 
 227 clobber: clean
 228         $(RM) $(WANBOOT) $(NFSBOOT) $(STRIPALIGN)
 229 
 230 lint: $(WANBOOT)_lint $(NFSBOOT)_lint