xref: /illumos-gate/usr/src/uts/sun4u/Makefile (revision 0aaef2f5)
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
34def		:=	TARGET= def
35def.prereq	:=	TARGET= def
36all		:=	TARGET= all
37all.prereq	:=	TARGET= all
38install		:=	TARGET= install
39install.prereq	:=	TARGET= install
40install_h	:=	TARGET= install_h
41install_h.prere	:=	TARGET= install_h
42clean		:=	TARGET= clean
43clobber		:=	TARGET= clobber
44modlist		:=	TARGET= modlist
45modlist	modlist.sparc :=	NO_STATE= -K $$MODSTATE$$$$
46check		:=	TARGET= check
47
48.KEEP_STATE:
49
50.PARALLEL:	$(PARALLEL_KMODS) $(XMODS) \
51		$(IMPLEMENTATIONS) \
52		modlist modlist.sparc
53
54# Override for CPU_KMODS... they cannot be built
55# in parallel
56.NO_PARALLEL:	$(CPU_KMODS)
57
58def all clean clobber: genassym unix .WAIT \
59	$(KMODS) $(XMODS) $(IMPLEMENTATIONS)
60
61clobber: clobber.targ
62
63# list the modules under sun4u.
64modlist: unix $(KMODS) $(XMODS) $(IMPLEMENTATIONS:.WAIT=)
65
66# list the modules for Install -k sun4u.
67modlist.karch: modlist modlist.sparc
68
69modlist.sparc:
70	@cd $(SRC)/uts/sparc; pwd; $(MAKE) $(NO_STATE) modlist
71
72install: install_platforms genassym unix .WAIT $(KMODS) \
73	$(XMODS) $(IMPLEMENTATIONS)
74
75genassym unix $(KMODS):	FRC
76	@cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET)
77
78#
79# Privilege constants
80#
81# NOTE: The rules for generating priv_const.c file are shared between all
82# processor architectures and should be kept in sync. If they are changed in
83# this file make sure that x86 rules are updated as well.
84#
85PRIVS_C = $(UTSBASE)/common/os/priv_const.c
86
87$(PRIVS_C): $(PRIVS_AWK) $(PRIVS_DEF)
88	$(AWK) -f $(PRIVS_AWK) < $(PRIVS_DEF) cfile=$@
89
90CLOBBERFILES += $(PRIVS_C)
91
92#
93# Prerequisites
94#
95# The uts/Makefile defines build parallelism for sun4 platforms such that sparc,
96# sun4u and sun4v are all built in parallel. Also this Makefile specifies that
97# all IMPLEMENTATIONS sun4u sub-platforms are built in parallel. This requires
98# building certain parts before the parallel build can start. The uts/Makefile
99# appends the '.prereq' string to the original target and executes this Makefile
100# to build any prerequisites needed before the full parallel build can start.
101# After that make continues with normal targets.
102#
103# Any build prerequisites for sun4 and IMPLEMENTATIONS builds should be
104# described here.
105#
106# genassym is used to build dtrace and genunix, so it should be built first.
107#
108# priv_const.c is required to build genunix.
109#
110# genunix is used by everyone to ctfmerge with. Genunix is merged with sparc/ip
111#   so as a side effect this dependency builds sparc/ip as part of the
112#   prerequisites.
113#
114# unix is not required by itself but several sun4u platforms require
115#   sun4u/platmod to be present. The easiest way to achieve this is to build
116#   sun4u/unix first since sun4u/unix Makefile builds sun4u/platform correctly.
117#   This causes full sun4u/unix to be built before all sun4u platforms and
118#   before uts/sun4v and uts/sparc, but it acceptable since it is not spending
119#   too much time building sun4u/unix.
120#
121all.prereq def.prereq install.prereq: genassym genunix unix
122
123#
124# Various sun4u platforms expect proto/root_sparc/platform/sun4u/include to be
125# present. This is handled by running make install_h in sun4u/unix directory
126# first.
127#
128install_h.prereq: FRC
129	@cd sys; pwd; $(MAKE) $(TARGET)
130
131#
132# Nothing to do with any other prerequisites
133#
134%.prereq:
135
136#
137# Platform inter-dependencies
138#
139lw8: serengeti
140
141quasar: darwin
142
143#
144# The genunix requires priv_const.c file to be generated first.
145#
146genunix: $(PRIVS_C)
147
148#
149# Rules
150#
151
152$(IMPLEMENTATIONS):	FRC
153	@cd $@; pwd; THISIMPL=$@ $(MAKE) $(NO_STATE) $(TARGET)
154
155$(XMODS):	FRC
156	@if [ -f $@/Makefile  ]; then \
157		cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET); \
158	else \
159		true; \
160	fi
161
162install_h check: install_platforms $(IMPLEMENTATIONS)
163	@cd sys; pwd; $(MAKE) $(TARGET)
164	@cd vm; pwd; $(MAKE) $(TARGET)
165
166#
167# Rules for the /platforms directories.  This is hardwired here because
168# the first stage of the project (KBI) only implements the userland
169# changes, but the only reasonable place to record the aliases is
170# here in kernel land.
171#
172$(ROOT_PLAT_DIRS): $(ROOT_PLAT_DIR)
173	-$(INS.dir)
174
175#
176# create directories in /usr/platform/ for the implementations that are
177# defined in $(IMPLEMENTED_PLATFORM)
178#       (eg. SUNW,Ultra-1)
179#
180# Foreach $(IMPLEMENTED_PLATFORM) there can be a list of $(LINKED_PLATFORMS)
181# that are linked to it.
182#
183$(USR_PLAT_DIR)/$(IMPLEMENTED_PLATFORM):	$(USR_PLAT_DIR)
184	-$(INS.dir)
185
186#
187# create the links in /usr/platform/ foreach $(LINKED_PLATFORMS)
188# to it's corresponding $(IMPLEMENTED_PLATFORM).
189#
190PLATFORMS	= $(LINKED_PLATFORMS)
191
192$(USR_PLAT_DIRS): $(USR_PLAT_DIR)
193	$(INS.slink3)
194
195PLATFORMS	+= $(IMPLEMENTED_PLATFORM)
196
197#
198# Make the /platforms directories.  This is hardwired here because
199# the first stage of the project (KBI) only implements the userland
200# changes, but the only reasonable place to record the aliases is
201# here in kernel land.
202#
203install_platforms:	$(ROOT_PSM_DIR) $(USR_PSM_DIR) \
204			$(ROOT_PLAT_DIRS) $(USR_PLAT_DIRS) \
205			$(USR_DESKTOP_DIR) $(USR_DESKTOP_INC_DIR) \
206			$(USR_DESKTOP_SBIN_DIR) $(USR_DESKTOP_LIB_DIR)
207
208#
209# rules for making include, sbin, lib dirs/links in
210# /usr/platform/$(PLATFORM)/ for desktop platforms
211#
212$(USR_DESKTOP_INC_DIR):		$(USR_DESKTOP_DIR)
213	$(INS.slink4)
214
215$(USR_DESKTOP_SBIN_DIR):	$(USR_DESKTOP_DIR)
216	$(INS.slink5)
217
218$(USR_DESKTOP_LIB_DIR):		$(USR_DESKTOP_DIR)
219	-$(INS.dir)
220
221include ../Makefile.targ
222
223#
224# Cross-reference customization: build a cross-reference over all of the
225# sun4u-related directories.
226#
227XRDIRS	= ../sun4u ../sun4 ../sfmmu ../sparc ../sun ../common
228XRPRUNE = i86pc
229
230cscope.out tags: FRC
231	$(XREF) -x $@
232