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 2014 Gary Mills
22#
23# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27TOPDIR =	../../../../..
28
29include $(TOPDIR)/uts/Makefile.uts
30
31all	:=	TARGET = all
32install	:=	TARGET = install
33clean	:=	TARGET = clean
34
35TARG_MACH =	sparcv9
36TARG_MACH_DIR =	sparcv9
37ARCHVERS =	v9
38PLATFORM =	sun4
39#ARCHMMU  =	sfmmu
40PROMVERS =	ieee1275
41ASFLAGS +=	$(sparcv9_XARCH)
42
43ARCH_C_SRC =	sun4u_memlist.c sun4x_standalloc.c sun4dep.c
44ARCH_S_SRC =	sparcv9_subr.s
45SRT0_S =	sun4u_srt0.s
46INLINES =
47
48LDFLAGS +=	-L$(TOPDIR)/psm/stand/lib/promif/$(TARG_MACH)/$(PROMVERS)/common
49
50#
51# The following libraries are build in LIBPLAT_DIR
52#
53LIBPLAT_DIR =	$(TOPDIR)/psm/stand/lib/promif/$(TARG_MACH)/$(PROMVERS)/$(PLATFORM)
54LIBPLAT_LIBS =  libplat.a
55LIBPLAT_L_LIBS=	$(LIBPLAT_LIBS:lib%.a=llib-l%.ln)
56LIBPLAT_DEP =	$(LIBPLAT_DIR)/$(LIBPLAT_LIBS)
57LIBPLAT_DEP_L =	$(LIBPLAT_DIR)/$(LIBPLAT_L_LIBS)
58
59#
60# Platform specific libraries
61#
62PSMLIBS +=      $(LIBPLAT_LIBS:lib%.a=-l%)
63PSMLIB_DIRS +=  $(LIBPLAT_DIR)
64
65include ../Makefile.com
66
67CPPINCS		+= -I$(TOPDIR)/psm/stand/boot/sparc/sun4
68
69include $(TOPDIR)/psm/Makefile.psm.64
70
71CFLAGS64	+= -xchip=ultra
72
73#
74# Cross-reference customization: include all boot-related source files.
75#
76STANDLIBDIR=	../../../../../stand/lib
77STANDSYSDIR=	../../../../../stand/sys
78PROMDIRS=	../../../../promif
79NAMESDIRS=	../../../lib/names/sparcv9 ../../../lib/names/sparc/common
80XRDIRS +=	../../sparc/common ../../common $(STANDLIBDIR) \
81		$(STANDSYSDIR) $(PROMDIRS) $(NAMESDIRS)
82XRPRUNE =	i86pc i386
83
84
85#############################
86#
87# NFS booter
88#
89# Libraries used to build nfsboot
90#
91LIBNFS_LIBS     = libnfs.a libxdr.a libnames.a \
92		libsock.a libinet.a libtcp.a libsa.a libprom.a \
93		$(LIBPLAT_LIBS)
94NFS_LIBS        = $(LIBNFS_LIBS:lib%.a=-l%)
95NFS_DIRS        = $(LIBNAME_DIR:%=-L%) $(LIBSYS_DIR:%=-L%)
96NFS_DIRS        += $(LIBPLAT_DIR:%=-L%) $(LIBPROM_DIR:%=-L%)
97
98#
99# Loader flags used to build inetboot
100#
101NFS_MAPFILE	= $(MACH_DIR)/mapfile
102NFS_LDFLAGS	= -Wl,-dn -Wl,-M$(NFS_MAPFILE) -e _start $(NFS_DIRS)
103NFS_L_LDFLAGS	= $(NFS_DIRS)
104
105#
106# Object files used to build inetboot
107#
108NFS_SRT0        = $(SRT0_OBJ)
109NFS_OBJS        = $(OBJS) nfsconf.o inetboot.o ramdisk.o
110NFS_L_OBJS      = $(NFS_SRT0:%.o=%.ln) $(NFS_OBJS:%.o=%.ln)
111
112
113#include $(BOOTSRCDIR)/Makefile.rules
114
115FRC:
116
117.KEEP_STATE:
118
119all: $(NFSBOOT)
120
121install: all					\
122	$(USR_PLAT_SUN4U_LIB_FS_NFS_NFSBOOT)	\
123	$(USR_PLAT_SUN4V_LIB_FS_NFS_NFSBOOT)
124
125$(NFSBOOT): $(NFS_MAPFILE) $(NFS_SRT0) $(NFS_OBJS) $(LIBDEPS)
126	$(LD) $(NFS_LDFLAGS) -o $@ $(NFS_SRT0) $(NFS_OBJS) $(NFS_LIBS)
127	$(MCS) -d $@
128	$(POST_PROCESS)
129	$(MCS) -c $@
130	$(STRIP) $@
131
132$(USR_PLAT_SUN4U_LIB_FS_NFS):
133	$(INS.dir)
134
135$(USR_PLAT_SUN4V_LIB_FS_NFS):
136	$(INS.dir)
137
138$(USR_PLAT_SUN4U_LIB_FS_NFS_NFSBOOT): $(USR_PLAT_SUN4U_LIB_FS_NFS) $(NFSBOOT)
139	$(INS) -s -m $(FILEMODE) -f $(USR_PLAT_SUN4U_LIB_FS_NFS) $(NFSBOOT)
140
141$(USR_PLAT_SUN4V_LIB_FS_NFS_NFSBOOT): $(USR_PLAT_SUN4V_LIB_FS_NFS) $(NFSBOOT)
142	$(INS) -s -m $(FILEMODE) -f $(USR_PLAT_SUN4V_LIB_FS_NFS) $(NFSBOOT)
143
144$(STRIPALIGN): $(CMN_DIR)/$$(@).c
145	$(NATIVECC) -o $@ $(CMN_DIR)/$@.c
146
147clean:
148	$(RM) make.out
149	$(RM) $(OBJS) $(CONF_OBJS) $(MISC_OBJS) $(SRT0_OBJ)
150	$(RM) $(NFSBOOT_OBJS)
151	$(RM) $(L_OBJS) $(CONF_L_OBJS) $(MISC_L_OBJS) $(SRT0_L_OBJ)
152	$(RM) $(NFSBOOT_L_OBJS)
153
154clobber: clean
155	$(RM) $(NFSBOOT) $(STRIPALIGN)
156