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