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