xref: /titanic_51/usr/src/uts/sun4u/Makefile (revision c0e7977a434048a8bc7386ea0e8befaa77a646cf)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5ae115bc7Smrj# Common Development and Distribution License (the "License").
6ae115bc7Smrj# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
2267b33ca4SValerie Bubb Fenwick# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate#	This makefile drives the production of all implementation architecture
267c478bd9Sstevel@tonic-gate#	dependent modules for the sun4u architecture.
277c478bd9Sstevel@tonic-gate#
287c478bd9Sstevel@tonic-gate
297c478bd9Sstevel@tonic-gateUTSBASE = ..
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gateinclude Makefile.sun4u
327c478bd9Sstevel@tonic-gate
337c478bd9Sstevel@tonic-gate#
347c478bd9Sstevel@tonic-gate#	The following are SPARC specific (rather than sun4u) specific modules
357c478bd9Sstevel@tonic-gate#	which are required for the sun4u kernel to completely lint. They are
367c478bd9Sstevel@tonic-gate#	not involved in the build in any other way. In order to minimize
377c478bd9Sstevel@tonic-gate#	build time, it is assumed that they are up to date. But since sun4u
387c478bd9Sstevel@tonic-gate#	is really a separate architecture we cannot use the v7 sparc modules.
397c478bd9Sstevel@tonic-gate#
407c478bd9Sstevel@tonic-gateSPARC_LIB_DIR	 = $(UTSBASE)/sparc/lint-libs/$(OBJS_DIR)
417c478bd9Sstevel@tonic-gate
427c478bd9Sstevel@tonic-gateSPARC_LINTS	 =
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gate#
457c478bd9Sstevel@tonic-gate#
467c478bd9Sstevel@tonic-gate#
477c478bd9Sstevel@tonic-gateLINT_LIBS	 = $(LINT_LIB) \
487c478bd9Sstevel@tonic-gate		   $(LINT_KMODS:%=$(LINT_LIB_DIR)/llib-l%.ln) \
497c478bd9Sstevel@tonic-gate		   $(SPARC_LINTS:%=$(SPARC_LIB_DIR)/llib-l%.ln)
507c478bd9Sstevel@tonic-gate
517c478bd9Sstevel@tonic-gate
527c478bd9Sstevel@tonic-gatedef		:=	TARGET= def
5398157a70Sakolbdef.prereq	:=	TARGET= def
547c478bd9Sstevel@tonic-gateall		:=	TARGET= all
5598157a70Sakolball.prereq	:=	TARGET= all
567c478bd9Sstevel@tonic-gateinstall		:=	TARGET= install
5798157a70Sakolbinstall.prereq	:=	TARGET= all
587c478bd9Sstevel@tonic-gateinstall_h	:=	TARGET= install_h
5998157a70Sakolbinstall_h.prere	:=	TARGET= install_h
607c478bd9Sstevel@tonic-gateclean		:=	TARGET= clean
617c478bd9Sstevel@tonic-gateclobber		:=	TARGET= clobber
627c478bd9Sstevel@tonic-gatelint		:=	TARGET= lint
6398157a70Sakolblint.prereq	:=	TARGET= lint
647c478bd9Sstevel@tonic-gatelintlib		:=	TARGET= lintlib
657c478bd9Sstevel@tonic-gatemodlintlib	:=	TARGET= modlintlib
66fb9f9b97Skupfermodlist		:=	TARGET= modlist
67fb9f9b97Skupfermodlist	modlist.sparc :=	NO_STATE= -K $$MODSTATE$$$$
687c478bd9Sstevel@tonic-gateclean.lint	:=	TARGET= clean.lint
697c478bd9Sstevel@tonic-gatecheck		:=	TARGET= check
707c478bd9Sstevel@tonic-gate
717c478bd9Sstevel@tonic-gate.KEEP_STATE:
727c478bd9Sstevel@tonic-gate
73*c0e7977aSJosef 'Jeff' Sipek.PARALLEL:	$(PARALLEL_KMODS) $(XMODS) \
74*c0e7977aSJosef 'Jeff' Sipek		$(IMPLEMENTATIONS) \
75fb9f9b97Skupfer		modlist modlist.sparc
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gate# Override for CPU_KMODS... they cannot be built
787c478bd9Sstevel@tonic-gate# in parallel
797c478bd9Sstevel@tonic-gate.NO_PARALLEL:	$(CPU_KMODS)
807c478bd9Sstevel@tonic-gate
81fb9f9b97Skupferdef all clean clobber clean.lint: genassym unix .WAIT \
82*c0e7977aSJosef 'Jeff' Sipek	$(KMODS) $(XMODS) $(IMPLEMENTATIONS)
837c478bd9Sstevel@tonic-gate
84b6805bf7SGordon Rossclobber: clobber.targ
85b6805bf7SGordon Ross
86fb9f9b97Skupfer# list the modules under sun4u.
87*c0e7977aSJosef 'Jeff' Sipekmodlist: unix $(KMODS) $(XMODS) $(IMPLEMENTATIONS:.WAIT=)
88fb9f9b97Skupfer
89fb9f9b97Skupfer# list the modules for Install -k sun4u.
90fb9f9b97Skupfermodlist.karch: modlist modlist.sparc
91fb9f9b97Skupfer
92fb9f9b97Skupfermodlist.sparc:
93fb9f9b97Skupfer	@cd $(SRC)/uts/sparc; pwd; $(MAKE) $(NO_STATE) modlist
94fb9f9b97Skupfer
95*c0e7977aSJosef 'Jeff' Sipekinstall: install_platforms genassym unix .WAIT $(KMODS) \
96*c0e7977aSJosef 'Jeff' Sipek	$(XMODS) $(IMPLEMENTATIONS)
977c478bd9Sstevel@tonic-gate
987c478bd9Sstevel@tonic-gatelintlib:	unix
997c478bd9Sstevel@tonic-gate
100*c0e7977aSJosef 'Jeff' Sipekmodlintlib:	$(LINT_KMODS)
1017c478bd9Sstevel@tonic-gate
102fb9f9b97Skupfergenassym unix $(KMODS):	FRC
103fb9f9b97Skupfer	@cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET)
104fb9f9b97Skupfer
10598157a70Sakolb#
10698157a70Sakolb# Privilege constants
10798157a70Sakolb#
10898157a70Sakolb# NOTE: The rules for generating priv_const.c file are shared between all
10998157a70Sakolb# processor architectures and should be kept in sync. If they are changed in
11098157a70Sakolb# this file make sure that x86 rules are updated as well.
11198157a70Sakolb#
11298157a70SakolbPRIVS_C = $(UTSBASE)/common/os/priv_const.c
11398157a70Sakolb
11498157a70Sakolb$(PRIVS_C): $(PRIVS_AWK) $(PRIVS_DEF)
11598157a70Sakolb	$(NAWK) -f $(PRIVS_AWK) < $(PRIVS_DEF) cfile=$@
11698157a70Sakolb
117b6805bf7SGordon RossCLOBBERFILES += $(PRIVS_C)
11898157a70Sakolb
11998157a70Sakolb#
12098157a70Sakolb# Prerequisites
12198157a70Sakolb#
12298157a70Sakolb# The uts/Makefile defines build parallelism for sun4 platforms such that sparc,
12398157a70Sakolb# sun4u and sun4v are all built in parallel. Also this Makefile specifies that
12498157a70Sakolb# all IMPLEMENTATIONS sun4u sub-platforms are built in parallel. This requires
12598157a70Sakolb# building certain parts before the parallel build can start. The uts/Makefile
12698157a70Sakolb# appends the '.prereq' string to the original target and executes this Makefile
12798157a70Sakolb# to build any prerequisites needed before the full parallel build can start.
12898157a70Sakolb# After that make continues with normal targets.
12998157a70Sakolb#
13098157a70Sakolb# Any build prerequisites for sun4 and IMPLEMENTATIONS builds should be
13198157a70Sakolb# described here.
13298157a70Sakolb#
13398157a70Sakolb# genassym is used to build dtrace and genunix, so it should be built first.
13498157a70Sakolb#
13598157a70Sakolb# priv_const.c is required to build genunix.
13698157a70Sakolb#
13798157a70Sakolb# genunix is used by everyone to ctfmerge with. Genunix is merged with sparc/ip
13898157a70Sakolb#   so as a side effect this dependency builds sparc/ip as part of the
13998157a70Sakolb#   prerequisites.
14098157a70Sakolb#
14198157a70Sakolb# unix is not required by itself but several sun4u platforms require
14298157a70Sakolb#   sun4u/platmod to be present. The easiest way to achieve this is to build
14398157a70Sakolb#   sun4u/unix first since sun4u/unix Makefile builds sun4u/platform correctly.
14498157a70Sakolb#   This causes full sun4u/unix to be built before all sun4u platforms and
14598157a70Sakolb#   before uts/sun4v and uts/sparc, but it acceptable since it is not spending
14698157a70Sakolb#   too much time building sun4u/unix.
14798157a70Sakolb#
14898157a70Sakolball.prereq def.prereq install.prereq: genassym genunix unix
14998157a70Sakolb
15098157a70Sakolb#
15198157a70Sakolb# Various sun4u platforms expect proto/root_sparc/platform/sun4u/include to be
15298157a70Sakolb# present. This is handled by running make install_h in sun4u/unix directory
15398157a70Sakolb# first.
15498157a70Sakolb#
15598157a70Sakolbinstall_h.prereq: FRC
15698157a70Sakolb	@cd sys; pwd; $(MAKE) $(TARGET)
15798157a70Sakolb
15898157a70Sakolb#
15998157a70Sakolb# sun4u/unix and sun4u/genunix should be linted first since sparc does global
16098157a70Sakolb# cross-check with these lint libraries. The sun4u/unix and sun4u/genunix can be
16198157a70Sakolb# linted in parallel.
16298157a70Sakolb#
16398157a70SakolbLINT_PREREQ = unix.lint genunix.lint
16498157a70Sakolblint.prereq: $(LINT_PREREQ)
16598157a70Sakolb
16698157a70Sakolb.PARALLEL:  $(LINT_PREREQ)
16798157a70Sakolb
16898157a70Sakolb$(LINT_PREREQ):
16998157a70Sakolb	@cd $(@:%.lint=%); pwd; $(MAKE) $(TARGET)
17098157a70Sakolb
17198157a70Sakolb#
17298157a70Sakolb# Nothing to do with any other prerequisites
17398157a70Sakolb#
17498157a70Sakolb%.prereq:
17598157a70Sakolb
17698157a70Sakolb#
17798157a70Sakolb# Platform inter-dependencies
17898157a70Sakolb#
17998157a70Sakolblw8: serengeti
18098157a70Sakolb
18198157a70Sakolbquasar: darwin
18298157a70Sakolb
18398157a70Sakolb#
18498157a70Sakolb# The genunix requires priv_const.c file to be generated first.
18598157a70Sakolb#
18698157a70Sakolbgenunix: $(PRIVS_C)
18798157a70Sakolb
18898157a70Sakolb#
18998157a70Sakolb# Rules
19098157a70Sakolb#
19198157a70Sakolb
192fb9f9b97Skupfer$(IMPLEMENTATIONS):	FRC
193fb9f9b97Skupfer	@cd $@; pwd; THISIMPL=$@ $(MAKE) $(NO_STATE) $(TARGET)
194fb9f9b97Skupfer
1957c478bd9Sstevel@tonic-gate$(XMODS):	FRC
1967c478bd9Sstevel@tonic-gate	@if [ -f $@/Makefile  ]; then \
197fb9f9b97Skupfer		cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET); \
1987c478bd9Sstevel@tonic-gate	else \
1997c478bd9Sstevel@tonic-gate		true; \
2007c478bd9Sstevel@tonic-gate	fi
2017c478bd9Sstevel@tonic-gate
202*c0e7977aSJosef 'Jeff' Sipekinstall_h check: install_platforms $(IMPLEMENTATIONS)
2037c478bd9Sstevel@tonic-gate	@cd sys; pwd; $(MAKE) $(TARGET)
2047c478bd9Sstevel@tonic-gate	@cd vm; pwd; $(MAKE) $(TARGET)
2057c478bd9Sstevel@tonic-gate
2067c478bd9Sstevel@tonic-gate#
2077c478bd9Sstevel@tonic-gate# Rules for the /platforms directories.  This is hardwired here because
2087c478bd9Sstevel@tonic-gate# the first stage of the project (KBI) only implements the userland
2097c478bd9Sstevel@tonic-gate# changes, but the only reasonable place to record the aliases is
2107c478bd9Sstevel@tonic-gate# here in kernel land.
2117c478bd9Sstevel@tonic-gate#
2127c478bd9Sstevel@tonic-gate$(ROOT_PLAT_DIRS): $(ROOT_PLAT_DIR)
21348bc00d6Sjmcp	-$(INS.dir)
2147c478bd9Sstevel@tonic-gate
2157c478bd9Sstevel@tonic-gate#
2167c478bd9Sstevel@tonic-gate# create directories in /usr/platform/ for the implementations that are
2177c478bd9Sstevel@tonic-gate# defined in $(IMPLEMENTED_PLATFORM)
2187c478bd9Sstevel@tonic-gate#       (eg. SUNW,Ultra-1)
2197c478bd9Sstevel@tonic-gate#
2207c478bd9Sstevel@tonic-gate# Foreach $(IMPLEMENTED_PLATFORM) there can be a list of $(LINKED_PLATFORMS)
2217c478bd9Sstevel@tonic-gate# that are linked to it.
2227c478bd9Sstevel@tonic-gate#
2237c478bd9Sstevel@tonic-gate$(USR_PLAT_DIR)/$(IMPLEMENTED_PLATFORM):	$(USR_PLAT_DIR)
22448bc00d6Sjmcp	-$(INS.dir)
2257c478bd9Sstevel@tonic-gate
2267c478bd9Sstevel@tonic-gate#
2277c478bd9Sstevel@tonic-gate# create the links in /usr/platform/ foreach $(LINKED_PLATFORMS)
2287c478bd9Sstevel@tonic-gate# to it's corresponding $(IMPLEMENTED_PLATFORM).
2297c478bd9Sstevel@tonic-gate#
2307c478bd9Sstevel@tonic-gatePLATFORMS	= $(LINKED_PLATFORMS)
2317c478bd9Sstevel@tonic-gate
2327c478bd9Sstevel@tonic-gate$(USR_PLAT_DIRS): $(USR_PLAT_DIR)
2337c478bd9Sstevel@tonic-gate	$(INS.slink3)
2347c478bd9Sstevel@tonic-gate
2357c478bd9Sstevel@tonic-gatePLATFORMS	+= $(IMPLEMENTED_PLATFORM)
2367c478bd9Sstevel@tonic-gate
2377c478bd9Sstevel@tonic-gate#
2387c478bd9Sstevel@tonic-gate# Make the /platforms directories.  This is hardwired here because
2397c478bd9Sstevel@tonic-gate# the first stage of the project (KBI) only implements the userland
2407c478bd9Sstevel@tonic-gate# changes, but the only reasonable place to record the aliases is
2417c478bd9Sstevel@tonic-gate# here in kernel land.
2427c478bd9Sstevel@tonic-gate#
2437c478bd9Sstevel@tonic-gateinstall_platforms:	$(ROOT_PSM_DIR) $(USR_PSM_DIR) \
2447c478bd9Sstevel@tonic-gate			$(ROOT_PLAT_DIRS) $(USR_PLAT_DIRS) \
2457c478bd9Sstevel@tonic-gate			$(USR_DESKTOP_DIR) $(USR_DESKTOP_INC_DIR) \
2467c478bd9Sstevel@tonic-gate			$(USR_DESKTOP_SBIN_DIR) $(USR_DESKTOP_LIB_DIR)
2477c478bd9Sstevel@tonic-gate
2487c478bd9Sstevel@tonic-gate#
2497c478bd9Sstevel@tonic-gate# rules for making include, sbin, lib dirs/links in
2507c478bd9Sstevel@tonic-gate# /usr/platform/$(PLATFORM)/ for desktop platforms
2517c478bd9Sstevel@tonic-gate#
2527c478bd9Sstevel@tonic-gate$(USR_DESKTOP_INC_DIR):		$(USR_DESKTOP_DIR)
2537c478bd9Sstevel@tonic-gate	$(INS.slink4)
2547c478bd9Sstevel@tonic-gate
2557c478bd9Sstevel@tonic-gate$(USR_DESKTOP_SBIN_DIR):	$(USR_DESKTOP_DIR)
2567c478bd9Sstevel@tonic-gate	$(INS.slink5)
2577c478bd9Sstevel@tonic-gate
2587c478bd9Sstevel@tonic-gate$(USR_DESKTOP_LIB_DIR):		$(USR_DESKTOP_DIR)
25948bc00d6Sjmcp	-$(INS.dir)
2607c478bd9Sstevel@tonic-gate
2617c478bd9Sstevel@tonic-gate#
2627c478bd9Sstevel@tonic-gate#	Full kernel lint target.
2637c478bd9Sstevel@tonic-gate#
2647c478bd9Sstevel@tonic-gateLINT_TARGET	= globallint
2657c478bd9Sstevel@tonic-gate
2667c478bd9Sstevel@tonic-gategloballint:
26798157a70Sakolb	@pwd
2687c478bd9Sstevel@tonic-gate	@-$(ECHO) "\nSUN4U KERNEL: global crosschecks:"
2697c478bd9Sstevel@tonic-gate	@-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2)
2707c478bd9Sstevel@tonic-gate
2717c478bd9Sstevel@tonic-gatelint:	lintlib .WAIT modlintlib .WAIT $(SPARC_LINTS) $(LINT_DEPS) \
272*c0e7977aSJosef 'Jeff' Sipek	$(IMPLEMENTATIONS) $(CPU_KMODS)
2737c478bd9Sstevel@tonic-gate
2747c478bd9Sstevel@tonic-gateinclude ../Makefile.targ
2757c478bd9Sstevel@tonic-gate
2767c478bd9Sstevel@tonic-gate#
2777c478bd9Sstevel@tonic-gate# Cross-reference customization: build a cross-reference over all of the
2787c478bd9Sstevel@tonic-gate# sun4u-related directories.
2797c478bd9Sstevel@tonic-gate#
280*c0e7977aSJosef 'Jeff' SipekXRDIRS	= ../sun4u ../sun4 ../sfmmu ../sparc ../sun ../common
2817c478bd9Sstevel@tonic-gateXRPRUNE = i86pc
2827c478bd9Sstevel@tonic-gate
2837c478bd9Sstevel@tonic-gatecscope.out tags: FRC
2847c478bd9Sstevel@tonic-gate	$(XREF) -x $@
285