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