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