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