xref: /titanic_51/usr/src/uts/sun4u/Makefile (revision 5db531e3faa94427746eae754b11770fd8416b6d)
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.
247b07063dSIgor Kozhukhov# Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate#	This makefile drives the production of all implementation architecture
277c478bd9Sstevel@tonic-gate#	dependent modules for the sun4u architecture.
287c478bd9Sstevel@tonic-gate#
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gateUTSBASE = ..
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gateinclude Makefile.sun4u
337c478bd9Sstevel@tonic-gate
347c478bd9Sstevel@tonic-gate#
357c478bd9Sstevel@tonic-gate#	The following are SPARC specific (rather than sun4u) specific modules
367c478bd9Sstevel@tonic-gate#	which are required for the sun4u kernel to completely lint. They are
377c478bd9Sstevel@tonic-gate#	not involved in the build in any other way. In order to minimize
387c478bd9Sstevel@tonic-gate#	build time, it is assumed that they are up to date. But since sun4u
397c478bd9Sstevel@tonic-gate#	is really a separate architecture we cannot use the v7 sparc modules.
407c478bd9Sstevel@tonic-gate#
417c478bd9Sstevel@tonic-gateSPARC_LIB_DIR	 = $(UTSBASE)/sparc/lint-libs/$(OBJS_DIR)
427c478bd9Sstevel@tonic-gate
437c478bd9Sstevel@tonic-gateSPARC_LINTS	 =
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gate#
467c478bd9Sstevel@tonic-gate#
477c478bd9Sstevel@tonic-gate#
487c478bd9Sstevel@tonic-gateLINT_LIBS	 = $(LINT_LIB) \
497c478bd9Sstevel@tonic-gate		   $(LINT_KMODS:%=$(LINT_LIB_DIR)/llib-l%.ln) \
507c478bd9Sstevel@tonic-gate		   $(SPARC_LINTS:%=$(SPARC_LIB_DIR)/llib-l%.ln)
517c478bd9Sstevel@tonic-gate
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gatedef		:=	TARGET= def
5498157a70Sakolbdef.prereq	:=	TARGET= def
557c478bd9Sstevel@tonic-gateall		:=	TARGET= all
5698157a70Sakolball.prereq	:=	TARGET= all
577c478bd9Sstevel@tonic-gateinstall		:=	TARGET= install
58*5db531e3SRichard Loweinstall.prereq	:=	TARGET= install
597c478bd9Sstevel@tonic-gateinstall_h	:=	TARGET= install_h
6098157a70Sakolbinstall_h.prere	:=	TARGET= install_h
617c478bd9Sstevel@tonic-gateclean		:=	TARGET= clean
627c478bd9Sstevel@tonic-gateclobber		:=	TARGET= clobber
637c478bd9Sstevel@tonic-gatelint		:=	TARGET= lint
6498157a70Sakolblint.prereq	:=	TARGET= lint
657c478bd9Sstevel@tonic-gatelintlib		:=	TARGET= lintlib
667c478bd9Sstevel@tonic-gatemodlintlib	:=	TARGET= modlintlib
67fb9f9b97Skupfermodlist		:=	TARGET= modlist
68fb9f9b97Skupfermodlist	modlist.sparc :=	NO_STATE= -K $$MODSTATE$$$$
697c478bd9Sstevel@tonic-gateclean.lint	:=	TARGET= clean.lint
707c478bd9Sstevel@tonic-gatecheck		:=	TARGET= check
717c478bd9Sstevel@tonic-gate
727c478bd9Sstevel@tonic-gate.KEEP_STATE:
737c478bd9Sstevel@tonic-gate
74c0e7977aSJosef 'Jeff' Sipek.PARALLEL:	$(PARALLEL_KMODS) $(XMODS) \
75c0e7977aSJosef 'Jeff' Sipek		$(IMPLEMENTATIONS) \
76fb9f9b97Skupfer		modlist modlist.sparc
777c478bd9Sstevel@tonic-gate
787c478bd9Sstevel@tonic-gate# Override for CPU_KMODS... they cannot be built
797c478bd9Sstevel@tonic-gate# in parallel
807c478bd9Sstevel@tonic-gate.NO_PARALLEL:	$(CPU_KMODS)
817c478bd9Sstevel@tonic-gate
82fb9f9b97Skupferdef all clean clobber clean.lint: genassym unix .WAIT \
83c0e7977aSJosef 'Jeff' Sipek	$(KMODS) $(XMODS) $(IMPLEMENTATIONS)
847c478bd9Sstevel@tonic-gate
85b6805bf7SGordon Rossclobber: clobber.targ
86b6805bf7SGordon Ross
87fb9f9b97Skupfer# list the modules under sun4u.
88c0e7977aSJosef 'Jeff' Sipekmodlist: unix $(KMODS) $(XMODS) $(IMPLEMENTATIONS:.WAIT=)
89fb9f9b97Skupfer
90fb9f9b97Skupfer# list the modules for Install -k sun4u.
91fb9f9b97Skupfermodlist.karch: modlist modlist.sparc
92fb9f9b97Skupfer
93fb9f9b97Skupfermodlist.sparc:
94fb9f9b97Skupfer	@cd $(SRC)/uts/sparc; pwd; $(MAKE) $(NO_STATE) modlist
95fb9f9b97Skupfer
96c0e7977aSJosef 'Jeff' Sipekinstall: install_platforms genassym unix .WAIT $(KMODS) \
97c0e7977aSJosef 'Jeff' Sipek	$(XMODS) $(IMPLEMENTATIONS)
987c478bd9Sstevel@tonic-gate
997c478bd9Sstevel@tonic-gatelintlib:	unix
1007c478bd9Sstevel@tonic-gate
101c0e7977aSJosef 'Jeff' Sipekmodlintlib:	$(LINT_KMODS)
1027c478bd9Sstevel@tonic-gate
103fb9f9b97Skupfergenassym unix $(KMODS):	FRC
104fb9f9b97Skupfer	@cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET)
105fb9f9b97Skupfer
10698157a70Sakolb#
10798157a70Sakolb# Privilege constants
10898157a70Sakolb#
10998157a70Sakolb# NOTE: The rules for generating priv_const.c file are shared between all
11098157a70Sakolb# processor architectures and should be kept in sync. If they are changed in
11198157a70Sakolb# this file make sure that x86 rules are updated as well.
11298157a70Sakolb#
11398157a70SakolbPRIVS_C = $(UTSBASE)/common/os/priv_const.c
11498157a70Sakolb
11598157a70Sakolb$(PRIVS_C): $(PRIVS_AWK) $(PRIVS_DEF)
1167b07063dSIgor Kozhukhov	$(AWK) -f $(PRIVS_AWK) < $(PRIVS_DEF) cfile=$@
11798157a70Sakolb
118b6805bf7SGordon RossCLOBBERFILES += $(PRIVS_C)
11998157a70Sakolb
12098157a70Sakolb#
12198157a70Sakolb# Prerequisites
12298157a70Sakolb#
12398157a70Sakolb# The uts/Makefile defines build parallelism for sun4 platforms such that sparc,
12498157a70Sakolb# sun4u and sun4v are all built in parallel. Also this Makefile specifies that
12598157a70Sakolb# all IMPLEMENTATIONS sun4u sub-platforms are built in parallel. This requires
12698157a70Sakolb# building certain parts before the parallel build can start. The uts/Makefile
12798157a70Sakolb# appends the '.prereq' string to the original target and executes this Makefile
12898157a70Sakolb# to build any prerequisites needed before the full parallel build can start.
12998157a70Sakolb# After that make continues with normal targets.
13098157a70Sakolb#
13198157a70Sakolb# Any build prerequisites for sun4 and IMPLEMENTATIONS builds should be
13298157a70Sakolb# described here.
13398157a70Sakolb#
13498157a70Sakolb# genassym is used to build dtrace and genunix, so it should be built first.
13598157a70Sakolb#
13698157a70Sakolb# priv_const.c is required to build genunix.
13798157a70Sakolb#
13898157a70Sakolb# genunix is used by everyone to ctfmerge with. Genunix is merged with sparc/ip
13998157a70Sakolb#   so as a side effect this dependency builds sparc/ip as part of the
14098157a70Sakolb#   prerequisites.
14198157a70Sakolb#
14298157a70Sakolb# unix is not required by itself but several sun4u platforms require
14398157a70Sakolb#   sun4u/platmod to be present. The easiest way to achieve this is to build
14498157a70Sakolb#   sun4u/unix first since sun4u/unix Makefile builds sun4u/platform correctly.
14598157a70Sakolb#   This causes full sun4u/unix to be built before all sun4u platforms and
14698157a70Sakolb#   before uts/sun4v and uts/sparc, but it acceptable since it is not spending
14798157a70Sakolb#   too much time building sun4u/unix.
14898157a70Sakolb#
14998157a70Sakolball.prereq def.prereq install.prereq: genassym genunix unix
15098157a70Sakolb
15198157a70Sakolb#
15298157a70Sakolb# Various sun4u platforms expect proto/root_sparc/platform/sun4u/include to be
15398157a70Sakolb# present. This is handled by running make install_h in sun4u/unix directory
15498157a70Sakolb# first.
15598157a70Sakolb#
15698157a70Sakolbinstall_h.prereq: FRC
15798157a70Sakolb	@cd sys; pwd; $(MAKE) $(TARGET)
15898157a70Sakolb
15998157a70Sakolb#
16098157a70Sakolb# sun4u/unix and sun4u/genunix should be linted first since sparc does global
16198157a70Sakolb# cross-check with these lint libraries. The sun4u/unix and sun4u/genunix can be
16298157a70Sakolb# linted in parallel.
16398157a70Sakolb#
16498157a70SakolbLINT_PREREQ = unix.lint genunix.lint
16598157a70Sakolblint.prereq: $(LINT_PREREQ)
16698157a70Sakolb
16798157a70Sakolb.PARALLEL:  $(LINT_PREREQ)
16898157a70Sakolb
16998157a70Sakolb$(LINT_PREREQ):
17098157a70Sakolb	@cd $(@:%.lint=%); pwd; $(MAKE) $(TARGET)
17198157a70Sakolb
17298157a70Sakolb#
17398157a70Sakolb# Nothing to do with any other prerequisites
17498157a70Sakolb#
17598157a70Sakolb%.prereq:
17698157a70Sakolb
17798157a70Sakolb#
17898157a70Sakolb# Platform inter-dependencies
17998157a70Sakolb#
18098157a70Sakolblw8: serengeti
18198157a70Sakolb
18298157a70Sakolbquasar: darwin
18398157a70Sakolb
18498157a70Sakolb#
18598157a70Sakolb# The genunix requires priv_const.c file to be generated first.
18698157a70Sakolb#
18798157a70Sakolbgenunix: $(PRIVS_C)
18898157a70Sakolb
18998157a70Sakolb#
19098157a70Sakolb# Rules
19198157a70Sakolb#
19298157a70Sakolb
193fb9f9b97Skupfer$(IMPLEMENTATIONS):	FRC
194fb9f9b97Skupfer	@cd $@; pwd; THISIMPL=$@ $(MAKE) $(NO_STATE) $(TARGET)
195fb9f9b97Skupfer
1967c478bd9Sstevel@tonic-gate$(XMODS):	FRC
1977c478bd9Sstevel@tonic-gate	@if [ -f $@/Makefile  ]; then \
198fb9f9b97Skupfer		cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET); \
1997c478bd9Sstevel@tonic-gate	else \
2007c478bd9Sstevel@tonic-gate		true; \
2017c478bd9Sstevel@tonic-gate	fi
2027c478bd9Sstevel@tonic-gate
203c0e7977aSJosef 'Jeff' Sipekinstall_h check: install_platforms $(IMPLEMENTATIONS)
2047c478bd9Sstevel@tonic-gate	@cd sys; pwd; $(MAKE) $(TARGET)
2057c478bd9Sstevel@tonic-gate	@cd vm; pwd; $(MAKE) $(TARGET)
2067c478bd9Sstevel@tonic-gate
2077c478bd9Sstevel@tonic-gate#
2087c478bd9Sstevel@tonic-gate# Rules for the /platforms directories.  This is hardwired here because
2097c478bd9Sstevel@tonic-gate# the first stage of the project (KBI) only implements the userland
2107c478bd9Sstevel@tonic-gate# changes, but the only reasonable place to record the aliases is
2117c478bd9Sstevel@tonic-gate# here in kernel land.
2127c478bd9Sstevel@tonic-gate#
2137c478bd9Sstevel@tonic-gate$(ROOT_PLAT_DIRS): $(ROOT_PLAT_DIR)
21448bc00d6Sjmcp	-$(INS.dir)
2157c478bd9Sstevel@tonic-gate
2167c478bd9Sstevel@tonic-gate#
2177c478bd9Sstevel@tonic-gate# create directories in /usr/platform/ for the implementations that are
2187c478bd9Sstevel@tonic-gate# defined in $(IMPLEMENTED_PLATFORM)
2197c478bd9Sstevel@tonic-gate#       (eg. SUNW,Ultra-1)
2207c478bd9Sstevel@tonic-gate#
2217c478bd9Sstevel@tonic-gate# Foreach $(IMPLEMENTED_PLATFORM) there can be a list of $(LINKED_PLATFORMS)
2227c478bd9Sstevel@tonic-gate# that are linked to it.
2237c478bd9Sstevel@tonic-gate#
2247c478bd9Sstevel@tonic-gate$(USR_PLAT_DIR)/$(IMPLEMENTED_PLATFORM):	$(USR_PLAT_DIR)
22548bc00d6Sjmcp	-$(INS.dir)
2267c478bd9Sstevel@tonic-gate
2277c478bd9Sstevel@tonic-gate#
2287c478bd9Sstevel@tonic-gate# create the links in /usr/platform/ foreach $(LINKED_PLATFORMS)
2297c478bd9Sstevel@tonic-gate# to it's corresponding $(IMPLEMENTED_PLATFORM).
2307c478bd9Sstevel@tonic-gate#
2317c478bd9Sstevel@tonic-gatePLATFORMS	= $(LINKED_PLATFORMS)
2327c478bd9Sstevel@tonic-gate
2337c478bd9Sstevel@tonic-gate$(USR_PLAT_DIRS): $(USR_PLAT_DIR)
2347c478bd9Sstevel@tonic-gate	$(INS.slink3)
2357c478bd9Sstevel@tonic-gate
2367c478bd9Sstevel@tonic-gatePLATFORMS	+= $(IMPLEMENTED_PLATFORM)
2377c478bd9Sstevel@tonic-gate
2387c478bd9Sstevel@tonic-gate#
2397c478bd9Sstevel@tonic-gate# Make the /platforms directories.  This is hardwired here because
2407c478bd9Sstevel@tonic-gate# the first stage of the project (KBI) only implements the userland
2417c478bd9Sstevel@tonic-gate# changes, but the only reasonable place to record the aliases is
2427c478bd9Sstevel@tonic-gate# here in kernel land.
2437c478bd9Sstevel@tonic-gate#
2447c478bd9Sstevel@tonic-gateinstall_platforms:	$(ROOT_PSM_DIR) $(USR_PSM_DIR) \
2457c478bd9Sstevel@tonic-gate			$(ROOT_PLAT_DIRS) $(USR_PLAT_DIRS) \
2467c478bd9Sstevel@tonic-gate			$(USR_DESKTOP_DIR) $(USR_DESKTOP_INC_DIR) \
2477c478bd9Sstevel@tonic-gate			$(USR_DESKTOP_SBIN_DIR) $(USR_DESKTOP_LIB_DIR)
2487c478bd9Sstevel@tonic-gate
2497c478bd9Sstevel@tonic-gate#
2507c478bd9Sstevel@tonic-gate# rules for making include, sbin, lib dirs/links in
2517c478bd9Sstevel@tonic-gate# /usr/platform/$(PLATFORM)/ for desktop platforms
2527c478bd9Sstevel@tonic-gate#
2537c478bd9Sstevel@tonic-gate$(USR_DESKTOP_INC_DIR):		$(USR_DESKTOP_DIR)
2547c478bd9Sstevel@tonic-gate	$(INS.slink4)
2557c478bd9Sstevel@tonic-gate
2567c478bd9Sstevel@tonic-gate$(USR_DESKTOP_SBIN_DIR):	$(USR_DESKTOP_DIR)
2577c478bd9Sstevel@tonic-gate	$(INS.slink5)
2587c478bd9Sstevel@tonic-gate
2597c478bd9Sstevel@tonic-gate$(USR_DESKTOP_LIB_DIR):		$(USR_DESKTOP_DIR)
26048bc00d6Sjmcp	-$(INS.dir)
2617c478bd9Sstevel@tonic-gate
2627c478bd9Sstevel@tonic-gate#
2637c478bd9Sstevel@tonic-gate#	Full kernel lint target.
2647c478bd9Sstevel@tonic-gate#
2657c478bd9Sstevel@tonic-gateLINT_TARGET	= globallint
2667c478bd9Sstevel@tonic-gate
2677c478bd9Sstevel@tonic-gategloballint:
26898157a70Sakolb	@pwd
2697c478bd9Sstevel@tonic-gate	@-$(ECHO) "\nSUN4U KERNEL: global crosschecks:"
2707c478bd9Sstevel@tonic-gate	@-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2)
2717c478bd9Sstevel@tonic-gate
2727c478bd9Sstevel@tonic-gatelint:	lintlib .WAIT modlintlib .WAIT $(SPARC_LINTS) $(LINT_DEPS) \
273c0e7977aSJosef 'Jeff' Sipek	$(IMPLEMENTATIONS) $(CPU_KMODS)
2747c478bd9Sstevel@tonic-gate
2757c478bd9Sstevel@tonic-gateinclude ../Makefile.targ
2767c478bd9Sstevel@tonic-gate
2777c478bd9Sstevel@tonic-gate#
2787c478bd9Sstevel@tonic-gate# Cross-reference customization: build a cross-reference over all of the
2797c478bd9Sstevel@tonic-gate# sun4u-related directories.
2807c478bd9Sstevel@tonic-gate#
281c0e7977aSJosef 'Jeff' SipekXRDIRS	= ../sun4u ../sun4 ../sfmmu ../sparc ../sun ../common
2827c478bd9Sstevel@tonic-gateXRPRUNE = i86pc
2837c478bd9Sstevel@tonic-gate
2847c478bd9Sstevel@tonic-gatecscope.out tags: FRC
2857c478bd9Sstevel@tonic-gate	$(XREF) -x $@
286