xref: /titanic_50/usr/src/psm/stand/boot/sparcv9/sun4/Makefile (revision 81d9f076db88c1f40c85831ce1ebb444a209c5a8)
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#
99# EXPORT DELETE START
100LIBWANBOOT =	libwanboot.a
101LIBSCRYPT =	libscrypt.a
102LIBSSL =	libssl.a
103LIBCRYPTO =	libcrypto.a
104# EXPORT DELETE END
105
106LIBWAN_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)
114WAN_LIBS        = $(LIBWAN_LIBS:lib%.a=-l%)
115WAN_DIRS        = $(LIBNAME_DIR:%=-L%) $(LIBSYS_DIR:%=-L%)
116WAN_DIRS        += $(LIBPLAT_DIR:%=-L%) $(LIBPROM_DIR:%=-L%)
117
118#
119# Loader flags used to build wanboot
120#
121WAN_MAPFILE	= $(MACH_DIR)/mapfile
122WAN_LDFLAGS	= -dn -M $(WAN_MAPFILE) -e _start $(WAN_DIRS)
123WAN_L_LDFLAGS	= $(WAN_DIRS)
124
125#
126# Object files used to build wanboot
127#
128WAN_SRT0        = $(SRT0_OBJ)
129WAN_OBJS        = $(OBJS) wbfsconf.o wbcli.o wanboot.o ramdisk.o
130WAN_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#
139LIBNFS_LIBS     = libnfs.a libxdr.a libnames.a \
140		libsock.a libinet.a libtcp.a libsa.a libprom.a \
141		$(LIBPLAT_LIBS)
142NFS_LIBS        = $(LIBNFS_LIBS:lib%.a=-l%)
143NFS_DIRS        = $(LIBNAME_DIR:%=-L%) $(LIBSYS_DIR:%=-L%)
144NFS_DIRS        += $(LIBPLAT_DIR:%=-L%) $(LIBPROM_DIR:%=-L%)
145
146#
147# Loader flags used to build inetboot
148#
149NFS_MAPFILE	= $(MACH_DIR)/mapfile
150NFS_LDFLAGS	= -dn -M $(NFS_MAPFILE) -e _start $(NFS_DIRS)
151NFS_L_LDFLAGS	= $(NFS_DIRS)
152
153#
154# Object files used to build inetboot
155#
156NFS_SRT0        = $(SRT0_OBJ)
157NFS_OBJS        = $(OBJS) nfsconf.o inetboot.o ramdisk.o
158NFS_L_OBJS      = $(NFS_SRT0:%.o=%.ln) $(NFS_OBJS:%.o=%.ln)
159
160
161#include $(BOOTSRCDIR)/Makefile.rules
162
163FRC:
164
165.KEEP_STATE:
166
167all: $(WANBOOT) $(NFSBOOT)
168
169install: 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
220clean:
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
227clobber: clean
228	$(RM) $(WANBOOT) $(NFSBOOT) $(STRIPALIGN)
229
230lint: $(WANBOOT)_lint $(NFSBOOT)_lint
231