xref: /illumos-gate/usr/src/uts/Makefile.uts (revision 02e56f3f)
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
5*02e56f3fSwesolows# Common Development and Distribution License (the "License").
6*02e56f3fSwesolows# 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#
21*02e56f3fSwesolows
227c478bd9Sstevel@tonic-gate#
23*02e56f3fSwesolows# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
27*02e56f3fSwesolows#
28*02e56f3fSwesolows
297c478bd9Sstevel@tonic-gate#
307c478bd9Sstevel@tonic-gate#	This Makefile contains the common targets and definitions for
317c478bd9Sstevel@tonic-gate#	all kernels. It is to be included in the Makefiles for specific
327c478bd9Sstevel@tonic-gate#	implementation architectures and processor architecture dependent
337c478bd9Sstevel@tonic-gate#	modules: i.e.: all driving kernel Makefiles.
347c478bd9Sstevel@tonic-gate#
357c478bd9Sstevel@tonic-gate#	Include global definitions:
367c478bd9Sstevel@tonic-gate#
377c478bd9Sstevel@tonic-gateinclude $(SRC)/Makefile.master
387c478bd9Sstevel@tonic-gate
397c478bd9Sstevel@tonic-gate#
407c478bd9Sstevel@tonic-gate#	No text domain in the kernel.
417c478bd9Sstevel@tonic-gate#
427c478bd9Sstevel@tonic-gateDTEXTDOM =
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gate#
457c478bd9Sstevel@tonic-gate# 	Keep references to $(SRC)/common relative.
467c478bd9Sstevel@tonic-gateCOMMONBASE=	$(UTSBASE)/../common
477c478bd9Sstevel@tonic-gate
487c478bd9Sstevel@tonic-gate#
497c478bd9Sstevel@tonic-gate#	Setup build-specific vars
507c478bd9Sstevel@tonic-gate#	To add a build type:
517c478bd9Sstevel@tonic-gate#		add name to ALL_BUILDS32 & ALL_BUILDS64
527c478bd9Sstevel@tonic-gate#		set CLASS_name and OBJ_DIR_name
537c478bd9Sstevel@tonic-gate#		add targets to Makefile.targ
547c478bd9Sstevel@tonic-gate#
557c478bd9Sstevel@tonic-gate
567c478bd9Sstevel@tonic-gate#
577c478bd9Sstevel@tonic-gate#	DEF_BUILDS is for def, lint and install
587c478bd9Sstevel@tonic-gate#	ALL_BUILDS is for everything else (all, clean, ...)
597c478bd9Sstevel@tonic-gate#
607c478bd9Sstevel@tonic-gate# The NOT_RELEASE_BUILD noise is to maintain compatibility with the
617c478bd9Sstevel@tonic-gate# gatekeeper's nightly build script.
627c478bd9Sstevel@tonic-gate#
637c478bd9Sstevel@tonic-gateDEF_BUILDS32				= obj32
647c478bd9Sstevel@tonic-gateDEF_BUILDS64				= obj64
657c478bd9Sstevel@tonic-gateDEF_BUILDSONLY64			= obj64
667c478bd9Sstevel@tonic-gate$(NOT_RELEASE_BUILD)DEF_BUILDS32	= debug32
677c478bd9Sstevel@tonic-gate$(NOT_RELEASE_BUILD)DEF_BUILDS64	= debug64
687c478bd9Sstevel@tonic-gate$(NOT_RELEASE_BUILD)DEF_BUILDSONLY64	= debug64
697c478bd9Sstevel@tonic-gateALL_BUILDS32				= obj32 debug32
707c478bd9Sstevel@tonic-gateALL_BUILDS64				= obj64 debug64
717c478bd9Sstevel@tonic-gateALL_BUILDSONLY64			= obj64 debug64
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gate#
747c478bd9Sstevel@tonic-gate#	For modules in 64b dirs that aren't built 64b
757c478bd9Sstevel@tonic-gate#	or modules in 64b dirs that aren't built 32b we
767c478bd9Sstevel@tonic-gate#	need to create empty modlintlib files so global lint works
777c478bd9Sstevel@tonic-gate#
787c478bd9Sstevel@tonic-gateLINT32_BUILDS	= debug32
797c478bd9Sstevel@tonic-gateLINT64_BUILDS	= debug64
807c478bd9Sstevel@tonic-gate
817c478bd9Sstevel@tonic-gate#
827c478bd9Sstevel@tonic-gate#	Build class (32b or 64b)
837c478bd9Sstevel@tonic-gate#
847c478bd9Sstevel@tonic-gateCLASS_OBJ32	= 32
857c478bd9Sstevel@tonic-gateCLASS_DBG32	= 32
867c478bd9Sstevel@tonic-gateCLASS_OBJ64	= 64
877c478bd9Sstevel@tonic-gateCLASS_DBG64	= 64
887c478bd9Sstevel@tonic-gateCLASS		= $(CLASS_$(BUILD_TYPE))
897c478bd9Sstevel@tonic-gate
907c478bd9Sstevel@tonic-gate#
917c478bd9Sstevel@tonic-gate#	Build subdirectory
927c478bd9Sstevel@tonic-gate#
937c478bd9Sstevel@tonic-gateOBJS_DIR_OBJ32	= obj32
947c478bd9Sstevel@tonic-gateOBJS_DIR_DBG32	= debug32
957c478bd9Sstevel@tonic-gateOBJS_DIR_OBJ64	= obj64
967c478bd9Sstevel@tonic-gateOBJS_DIR_DBG64	= debug64
977c478bd9Sstevel@tonic-gateOBJS_DIR	= $(OBJS_DIR_$(BUILD_TYPE))
987c478bd9Sstevel@tonic-gate
997c478bd9Sstevel@tonic-gate#
1007c478bd9Sstevel@tonic-gate#	Create defaults so empty rules don't
1017c478bd9Sstevel@tonic-gate#	confuse make
1027c478bd9Sstevel@tonic-gate#
1037c478bd9Sstevel@tonic-gateCLASS_		= 32
1047c478bd9Sstevel@tonic-gateOBJS_DIR_	= debug32
1057c478bd9Sstevel@tonic-gate
1067c478bd9Sstevel@tonic-gate#
1077c478bd9Sstevel@tonic-gate#	Build tools
1087c478bd9Sstevel@tonic-gate#
1097c478bd9Sstevel@tonic-gateCC_sparc_32	= $(sparc_CC)
1107c478bd9Sstevel@tonic-gateCC_sparc_64	= $(sparcv9_CC)
1117c478bd9Sstevel@tonic-gate
1127c478bd9Sstevel@tonic-gateCC_i386_32	= $(i386_CC)
1137c478bd9Sstevel@tonic-gateCC_i386_64	= $(amd64_CC)
1147c478bd9Sstevel@tonic-gateCC_amd64_64	= $(amd64_CC)
1157c478bd9Sstevel@tonic-gate
1167c478bd9Sstevel@tonic-gateCC		= $(CC_$(MACH)_$(CLASS))
1177c478bd9Sstevel@tonic-gate
1187c478bd9Sstevel@tonic-gateAS_sparc_32	= $(sparc_AS)
1197c478bd9Sstevel@tonic-gateAS_sparc_64	= $(sparcv9_AS)
1207c478bd9Sstevel@tonic-gate
1217c478bd9Sstevel@tonic-gateAS_i386_32	= $(i386_AS)
1227c478bd9Sstevel@tonic-gateAS_i386_64	= $(amd64_AS)
1237c478bd9Sstevel@tonic-gateAS_amd64_64	= $(amd64_AS)
1247c478bd9Sstevel@tonic-gate
1257c478bd9Sstevel@tonic-gateAS		= $(AS_$(MACH)_$(CLASS))
1267c478bd9Sstevel@tonic-gate
1277c478bd9Sstevel@tonic-gateLD_sparc_32	= $(sparc_LD)
1287c478bd9Sstevel@tonic-gateLD_sparc_64	= $(sparcv9_LD)
1297c478bd9Sstevel@tonic-gate
1307c478bd9Sstevel@tonic-gateLD_i386_32	= $(i386_LD)
1317c478bd9Sstevel@tonic-gateLD_i386_64	= $(amd64_LD)
1327c478bd9Sstevel@tonic-gateLD_amd64_64	= $(amd64_LD)
1337c478bd9Sstevel@tonic-gate
1347c478bd9Sstevel@tonic-gateLD		= $(LD_$(MACH)_$(CLASS))
1357c478bd9Sstevel@tonic-gate
1367c478bd9Sstevel@tonic-gateLINT_sparc_32	= $(sparc_LINT)
1377c478bd9Sstevel@tonic-gateLINT_sparc_64	= $(sparcv9_LINT)
1387c478bd9Sstevel@tonic-gate
1397c478bd9Sstevel@tonic-gateLINT_i386_32	= $(i386_LINT)
1407c478bd9Sstevel@tonic-gateLINT_i386_64	= $(amd64_LINT)
1417c478bd9Sstevel@tonic-gateLINT_amd64_64	= $(amd64_LINT)
1427c478bd9Sstevel@tonic-gate
1437c478bd9Sstevel@tonic-gateLINT		= $(LINT_$(MACH)_$(CLASS))
1447c478bd9Sstevel@tonic-gate
1457c478bd9Sstevel@tonic-gateMODEL_32	= ilp32
1467c478bd9Sstevel@tonic-gateMODEL_64	= lp64
1477c478bd9Sstevel@tonic-gateMODEL		= $(MODEL_$(CLASS))
1487c478bd9Sstevel@tonic-gate
1497c478bd9Sstevel@tonic-gate#
1507c478bd9Sstevel@tonic-gate#	Build rules for linting the kernel.
1517c478bd9Sstevel@tonic-gate#
1527c478bd9Sstevel@tonic-gateLHEAD =	( $(ECHO) "\n$@";
1537c478bd9Sstevel@tonic-gate
1547c478bd9Sstevel@tonic-gateLGREP.2 =	grep -v ' _init ' | \
1557c478bd9Sstevel@tonic-gate		grep -v ' _fini ' | \
1567c478bd9Sstevel@tonic-gate		grep -v ' _info ' | \
1577c478bd9Sstevel@tonic-gate		grep -v ' _depends_on ' | \
1587c478bd9Sstevel@tonic-gate		cat
1597c478bd9Sstevel@tonic-gate
1607c478bd9Sstevel@tonic-gateLTAIL =	)
1617c478bd9Sstevel@tonic-gate
1627c478bd9Sstevel@tonic-gateLINT.c =	$(LINT) -c -dirout=$(LINTS_DIR) $(LINTFLAGS) $(LINT_DEFS) $(CPPFLAGS)
1637c478bd9Sstevel@tonic-gate
1647c478bd9Sstevel@tonic-gateLINTTAGS_32	=
1657c478bd9Sstevel@tonic-gateLINTTAGS_32	+= -erroff=E_BAD_PTR_CAST_ALIGN
1667c478bd9Sstevel@tonic-gateLINTTAGS_32	+= -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
1677c478bd9Sstevel@tonic-gateLINTTAGS_32	+= -erroff=E_SUSPICIOUS_COMPARISON
1687c478bd9Sstevel@tonic-gateLINTTAGS_32	+= -erroff=E_CAST_UINT_TO_SIGNED_INT
1697c478bd9Sstevel@tonic-gateLINTTAGS_32	+= -erroff=E_PASS_UINT_TO_SIGNED_INT
1707c478bd9Sstevel@tonic-gateLINTTAGS_32	+= -erroff=E_INVALID_ANNOTATION_NAME
1717c478bd9Sstevel@tonic-gateLINTTAGS_32	+= -erroff=E_OLD_STYLE_DECL_OR_BAD_TYPE
1727c478bd9Sstevel@tonic-gateLINTTAGS_32	+= -erroff=E_NO_EXPLICIT_TYPE_GIVEN
1737c478bd9Sstevel@tonic-gateLINTTAGS_32	+= -erroff=E_STATIC_UNUSED
1747c478bd9Sstevel@tonic-gateLINTTAGS_32	+= -erroff=E_PTRDIFF_OVERFLOW
1757c478bd9Sstevel@tonic-gateLINTTAGS_32	+= -erroff=E_ASSIGN_NARROW_CONV
1767c478bd9Sstevel@tonic-gate
1777c478bd9Sstevel@tonic-gateLINTTAGS_64	= $(LINTTAGS_32)
1787c478bd9Sstevel@tonic-gate
1797c478bd9Sstevel@tonic-gate# Selectively disable certain noisy lint errors
1807c478bd9Sstevel@tonic-gateLENIENT_LINTTAGS =
1817c478bd9Sstevel@tonic-gateLENIENT_LINTTAGS += -erroff=E_CAST_INT_TO_SMALL_INT
1827c478bd9Sstevel@tonic-gateLENIENT_LINTTAGS += -erroff=E_CAST_INT_CONST_TO_SMALL_INT
1837c478bd9Sstevel@tonic-gateLENIENT_LINTTAGS += -erroff=E_CAST_TO_PTR_FROM_INT
1847c478bd9Sstevel@tonic-gateLENIENT_LINTTAGS += -erroff=E_ASSIGN_INT_TO_SMALL_INT
1857c478bd9Sstevel@tonic-gateLENIENT_LINTTAGS += -erroff=E_ASSIGN_INT_FROM_BIG_CONST
1867c478bd9Sstevel@tonic-gateLENIENT_LINTTAGS += -erroff=E_CONST_PROMOTED_UNSIGNED_LL
1877c478bd9Sstevel@tonic-gateLENIENT_LINTTAGS += -erroff=E_CONST_PROMOTED_LONG_LONG
1887c478bd9Sstevel@tonic-gateLENIENT_LINTTAGS += -erroff=E_CONST_TRUNCATED_BY_ASSIGN
1897c478bd9Sstevel@tonic-gateLENIENT_LINTTAGS += -erroff=E_PASS_INT_FROM_BIG_CONST
1907c478bd9Sstevel@tonic-gateLENIENT_LINTTAGS += -erroff=E_COMP_INT_WITH_LARGE_INT
1917c478bd9Sstevel@tonic-gateLENIENT_LINTTAGS += -erroff=E_ASSIGN_UINT_TO_SIGNED_INT
1927c478bd9Sstevel@tonic-gate# These are still noisy but a bit more useful.
1937c478bd9Sstevel@tonic-gate# They shouldn't be used on new code.
1947c478bd9Sstevel@tonic-gateLENIENT_LINTTAGS += -erroff=E_PASS_INT_TO_SMALL_INT
1957c478bd9Sstevel@tonic-gateLENIENT_LINTTAGS += -erroff=E_PTR_CONV_LOSES_BITS
1967c478bd9Sstevel@tonic-gate
1977c478bd9Sstevel@tonic-gate# comment out next line to turn on pedantic 64-bit error checking
1987c478bd9Sstevel@tonic-gateLINTTAGS_64	+= $(LENIENT_LINTTAGS)
1997c478bd9Sstevel@tonic-gate
2007c478bd9Sstevel@tonic-gateLENIENT_i386_LINTTAGS	=
2017c478bd9Sstevel@tonic-gate
2027c478bd9Sstevel@tonic-gateLENIENT_amd64_LINTTAGS	=
2037c478bd9Sstevel@tonic-gateLENIENT_amd64_LINTTAGS	+= -erroff=E_BAD_PRAGMA_PACK_VALUE
2047c478bd9Sstevel@tonic-gateLENIENT_amd64_LINTTAGS	+= -erroff=E_SHIFT_CNT_NEG_TOO_BIG_L
2057c478bd9Sstevel@tonic-gateLENIENT_amd64_LINTTAGS	+= -erroff=E_CONST_PROMOTED_UNSIGNED_LL
2067c478bd9Sstevel@tonic-gateLENIENT_amd64_LINTTAGS	+= -erroff=E_CONST_PROMOTED_LONG_LONG
2077c478bd9Sstevel@tonic-gate
2087c478bd9Sstevel@tonic-gateLINTFLAGS_sparc_32	= $(LINTCCMODE) -nsxmuF -errtags=yes
2097c478bd9Sstevel@tonic-gateLINTFLAGS_sparc_64	= $(LINTFLAGS_sparc_32) -Xarch=v9
2107c478bd9Sstevel@tonic-gateLINTFLAGS_i386_32	= $(LINTCCMODE) -nsxmuF -errtags=yes
2117c478bd9Sstevel@tonic-gateLINTFLAGS_i386_64	= $(LINTFLAGS_i386_32) -Xarch=amd64
2127c478bd9Sstevel@tonic-gate
2137c478bd9Sstevel@tonic-gateLINTTAGS_sparc_32	= $(LINTTAGS_32)
2147c478bd9Sstevel@tonic-gateLINTTAGS_sparc_64	= $(LINTTAGS_64)
2157c478bd9Sstevel@tonic-gateLINTTAGS_i386_32	= $(LINTTAGS_32)
2167c478bd9Sstevel@tonic-gateLINTTAGS_i386_64	= $(LINTTAGS_64) $(LENIENT_amd64_LINTTAGS)
2177c478bd9Sstevel@tonic-gate
2187c478bd9Sstevel@tonic-gateLINTFLAGS	= $(LINTFLAGS_$(MACH)_$(CLASS)) $(LINTTAGS_$(MACH)_$(CLASS))
2197c478bd9Sstevel@tonic-gateLINTFLAGS	+= $(C99LMODE)
2207c478bd9Sstevel@tonic-gate
2217c478bd9Sstevel@tonic-gate#
2227c478bd9Sstevel@tonic-gate#	Override this variable to modify the name of the lint target.
2237c478bd9Sstevel@tonic-gate#
2247c478bd9Sstevel@tonic-gateLINT_MODULE=	$(MODULE)
2257c478bd9Sstevel@tonic-gate
2267c478bd9Sstevel@tonic-gate#
2277c478bd9Sstevel@tonic-gate#	Build the compile/assemble lines:
2287c478bd9Sstevel@tonic-gate#
2297c478bd9Sstevel@tonic-gateEXTRA_OPTIONS		=
2307c478bd9Sstevel@tonic-gateAS_DEFS			= -D_ASM -D__STDC__=0
2317c478bd9Sstevel@tonic-gate
2327c478bd9Sstevel@tonic-gateALWAYS_DEFS_32		= -D_KERNEL -D_SYSCALL32
2337c478bd9Sstevel@tonic-gateALWAYS_DEFS_64		= -D_KERNEL -D_SYSCALL32 -D_SYSCALL32_IMPL -D_ELF64
2347c478bd9Sstevel@tonic-gate#
2357c478bd9Sstevel@tonic-gate# XX64	This should be defined by the compiler!
2367c478bd9Sstevel@tonic-gate#
2377c478bd9Sstevel@tonic-gateALWAYS_DEFS_64		+= -Dsun -D__sun -D__SVR4
2387c478bd9Sstevel@tonic-gateALWAYS_DEFS		= $(ALWAYS_DEFS_$(CLASS))
2397c478bd9Sstevel@tonic-gate
2407c478bd9Sstevel@tonic-gate#
2417c478bd9Sstevel@tonic-gate#	CPPFLAGS is deliberatly set with a "=" and not a "+=".  For the kernel
2427c478bd9Sstevel@tonic-gate#	the header include path should not look for header files outside of
2437c478bd9Sstevel@tonic-gate#	the kernel code.  This "=" removes the search path built in
2447c478bd9Sstevel@tonic-gate#	Makefile.master inside CPPFLAGS.  Ditto for AS_CPPFLAGS.
2457c478bd9Sstevel@tonic-gate#
2467c478bd9Sstevel@tonic-gateCPPFLAGS	= $(ALWAYS_DEFS) $(ALL_DEFS) $(CONFIG_DEFS) \
2477c478bd9Sstevel@tonic-gate		   $(INCLUDE_PATH) $(EXTRA_OPTIONS)
2487c478bd9Sstevel@tonic-gateASFLAGS		+= -P
2497c478bd9Sstevel@tonic-gateAS_CPPFLAGS	= $(ALWAYS_DEFS) $(ALL_DEFS) $(CONFIG_DEFS) $(AS_DEFS) \
2507c478bd9Sstevel@tonic-gate		   $(AS_INC_PATH) $(EXTRA_OPTIONS)
2517c478bd9Sstevel@tonic-gate
2527c478bd9Sstevel@tonic-gate#
2537c478bd9Sstevel@tonic-gate#	Make it (relatively) easy to share compilation options between
2547c478bd9Sstevel@tonic-gate#	all kernel implementations.
2557c478bd9Sstevel@tonic-gate#
2567c478bd9Sstevel@tonic-gate
2577c478bd9Sstevel@tonic-gate#
2587c478bd9Sstevel@tonic-gate# XX64	Compiling with -xc99=%all on build 55 merge makes the
2597c478bd9Sstevel@tonic-gate#	kmem_alloc double map parts of the kernel data causing
2607c478bd9Sstevel@tonic-gate#	horrible overwriting and forces a hardware reset in
2617c478bd9Sstevel@tonic-gate#	segkp_create().  Until the origin of this problem can
2627c478bd9Sstevel@tonic-gate#	be tracked down (i.e. is it a deliberate C89 -> C99 semantic
2637c478bd9Sstevel@tonic-gate#	change for which the kernel needs repair, or is it just a
2647c478bd9Sstevel@tonic-gate#	bug in the x86 compiler?) disabling C99 for kernel compilation
2657c478bd9Sstevel@tonic-gate#	when using the Devpro compiler
2667c478bd9Sstevel@tonic-gate#
2677c478bd9Sstevel@tonic-gatei386_C99MODE		= $(C99_DISABLE)
2687c478bd9Sstevel@tonic-gate$(__GNUC)i386_C99MODE	= $(C99_ENABLE)
2697c478bd9Sstevel@tonic-gatesparc_C99MODE		= $(C99_DISABLE)
2707c478bd9Sstevel@tonic-gateC99MODE			= $($(MACH)_C99MODE)
2717c478bd9Sstevel@tonic-gate
2727c478bd9Sstevel@tonic-gateCFLAGS_uts		=
2737c478bd9Sstevel@tonic-gateCFLAGS_uts		+= $(STAND_FLAGS_$(CLASS))
2747c478bd9Sstevel@tonic-gateCFLAGS_uts		+= $(CCVERBOSE)
2757c478bd9Sstevel@tonic-gateCFLAGS_uts		+= $(ILDOFF)
2767c478bd9Sstevel@tonic-gateCFLAGS_uts		+= $(XAOPT)
2777c478bd9Sstevel@tonic-gateCFLAGS_uts		+= $(CTF_FLAGS)
2787c478bd9Sstevel@tonic-gateCFLAGS_uts		+= $(CERRWARN)
2797c478bd9Sstevel@tonic-gateCFLAGS_uts		+= $(C99MODE)
2807c478bd9Sstevel@tonic-gateCFLAGS_uts		+= $(EXTRA_CFLAGS)
2817c478bd9Sstevel@tonic-gate
2827c478bd9Sstevel@tonic-gate#
2837c478bd9Sstevel@tonic-gate#	Declare that $(OBJECTS) and $(LINTS) can be compiled in parallel.
2847c478bd9Sstevel@tonic-gate#	The DUMMY target is for those instances where OBJECTS and LINTS
2857c478bd9Sstevel@tonic-gate#	are empty (to avoid an unconditional .PARALLEL).
2867c478bd9Sstevel@tonic-gate.PARALLEL:	$(OBJECTS) $(LINTS) DUMMY
2877c478bd9Sstevel@tonic-gate
2887c478bd9Sstevel@tonic-gate#
2897c478bd9Sstevel@tonic-gate#	Expanded dependencies
2907c478bd9Sstevel@tonic-gate#
2917c478bd9Sstevel@tonic-gateDEF_DEPS	= $(DEF_BUILDS:%=def.%)
2927c478bd9Sstevel@tonic-gateALL_DEPS	= $(ALL_BUILDS:%=all.%)
2937c478bd9Sstevel@tonic-gateCLEAN_DEPS	= $(ALL_BUILDS:%=clean.%)
2947c478bd9Sstevel@tonic-gateCLOBBER_DEPS	= $(ALL_BUILDS:%=clobber.%)
2957c478bd9Sstevel@tonic-gateLINT_DEPS	= $(DEF_BUILDS:%=lint.%)
2967c478bd9Sstevel@tonic-gateMODLINTLIB_DEPS	= $(DEF_BUILDS:%=modlintlib.%)
2977c478bd9Sstevel@tonic-gateCLEAN_LINT_DEPS	= $(ALL_BUILDS:%=clean.lint.%)
2987c478bd9Sstevel@tonic-gateINSTALL_DEPS	= $(DEF_BUILDS:%=install.%)
2997c478bd9Sstevel@tonic-gateSYM_DEPS	= $(SYM_BUILDS:%=symcheck.%)
3007c478bd9Sstevel@tonic-gate
3017c478bd9Sstevel@tonic-gate#
3027c478bd9Sstevel@tonic-gate#	Default module name
3037c478bd9Sstevel@tonic-gate#
3047c478bd9Sstevel@tonic-gateBINARY		= $(OBJS_DIR)/$(MODULE)
3057c478bd9Sstevel@tonic-gate
3067c478bd9Sstevel@tonic-gate#
3077c478bd9Sstevel@tonic-gate#	Default cleanup definitions
3087c478bd9Sstevel@tonic-gate#
3097c478bd9Sstevel@tonic-gateCLEANLINTFILES	= $(LINTS) $(MOD_LINT_LIB)
3107c478bd9Sstevel@tonic-gateCLEANFILES	= $(OBJECTS) $(CLEANLINTFILES)
3117c478bd9Sstevel@tonic-gateCLOBBERFILES	= $(BINARY) $(CLEANFILES)
3127c478bd9Sstevel@tonic-gate
3137c478bd9Sstevel@tonic-gate#
3147c478bd9Sstevel@tonic-gate#	Installation constants:
3157c478bd9Sstevel@tonic-gate#
3167c478bd9Sstevel@tonic-gate#		FILEMODE is the mode given to the kernel modules
3177c478bd9Sstevel@tonic-gate#		CFILEMODE is the mode given to the '.conf' files
3187c478bd9Sstevel@tonic-gate#
3197c478bd9Sstevel@tonic-gateFILEMODE	 = 755
3207c478bd9Sstevel@tonic-gateDIRMODE		 = 755
3217c478bd9Sstevel@tonic-gateOWNER		 = root
3227c478bd9Sstevel@tonic-gateGROUP		 = sys
3237c478bd9Sstevel@tonic-gateCFILEMODE	 = 644
3247c478bd9Sstevel@tonic-gate
3257c478bd9Sstevel@tonic-gate#
3267c478bd9Sstevel@tonic-gate#	Special Installation Macros for the installation of '.conf' files.
3277c478bd9Sstevel@tonic-gate#
3287c478bd9Sstevel@tonic-gate#	These are unique because they are not installed from the current
3297c478bd9Sstevel@tonic-gate#	working directory.
3307c478bd9Sstevel@tonic-gate#
3317c478bd9Sstevel@tonic-gate# Sigh.  Apparently at some time in the past there was a confusion on
3327c478bd9Sstevel@tonic-gate# whether the name is SRC_CONFFILE or SRC_CONFILE.  Consistency with the
3337c478bd9Sstevel@tonic-gate# other names would indicate SRC_CONFFILE, but the voting is >180 Makefiles
3347c478bd9Sstevel@tonic-gate# with SRC_CONFILE and about 11 with SRC_CONFFILE.  Software development
3357c478bd9Sstevel@tonic-gate# isn't a popularity contest, though, and so my inclination is to define
3367c478bd9Sstevel@tonic-gate# both names for now and incrementally convert to SRC_CONFFILE to be consistent
3377c478bd9Sstevel@tonic-gate# with the other names.
3387c478bd9Sstevel@tonic-gate#
3397c478bd9Sstevel@tonic-gateCONFFILE		= $(MODULE).conf
3407c478bd9Sstevel@tonic-gateSRC_CONFFILE		= $(CONF_SRCDIR)/$(CONFFILE)
3417c478bd9Sstevel@tonic-gateSRC_CONFILE		= $(SRC_CONFFILE)
3427c478bd9Sstevel@tonic-gateROOT_CONFFILE_32	= $(ROOTMODULE).conf
3437c478bd9Sstevel@tonic-gateROOT_CONFFILE_64	= $(ROOTMODULE:%/$(SUBDIR64)/$(MODULE)=%/$(MODULE)).conf
3447c478bd9Sstevel@tonic-gateROOT_CONFFILE		= $(ROOT_CONFFILE_$(CLASS))
3457c478bd9Sstevel@tonic-gate
3467c478bd9Sstevel@tonic-gate
3477c478bd9Sstevel@tonic-gateINS.conffile= \
3487c478bd9Sstevel@tonic-gate	$(RM) $@; $(INS) -s -m $(CFILEMODE) -f $(@D) $(SRC_CONFFILE)
3497c478bd9Sstevel@tonic-gate$(CH)INS.conffile= \
3507c478bd9Sstevel@tonic-gate    $(INS) -s -m $(CFILEMODE) -u $(OWNER) -g $(GROUP) -f $(@D) $(SRC_CONFFILE)
3517c478bd9Sstevel@tonic-gate
3527c478bd9Sstevel@tonic-gate#
3537c478bd9Sstevel@tonic-gate# The CTF merge of child kernel modules is performed against one of the genunix
3547c478bd9Sstevel@tonic-gate# modules.  For Intel builds, all modules will be used with a single genunix:
3557c478bd9Sstevel@tonic-gate# the one built in intel/genunix.  For SPARC builds, a given
3567c478bd9Sstevel@tonic-gate# module may be
3577c478bd9Sstevel@tonic-gate# used with one of a number of genunix files, depending on what platform the
3587c478bd9Sstevel@tonic-gate# module is deployed on.  We merge against the sun4u genunix to optimize for
3597c478bd9Sstevel@tonic-gate# the common case.  We also merge against the ip driver since networking is
3607c478bd9Sstevel@tonic-gate# typically loaded and types defined therein are shared between many modules.
3617c478bd9Sstevel@tonic-gate#
3627c478bd9Sstevel@tonic-gateCTFMERGE_GUDIR_sparc	= sun4u
3637c478bd9Sstevel@tonic-gateCTFMERGE_GUDIR_i386	= intel
3647c478bd9Sstevel@tonic-gateCTFMERGE_GUDIR		= $(CTFMERGE_GUDIR_$(MACH))
3657c478bd9Sstevel@tonic-gate
3667c478bd9Sstevel@tonic-gateCTFMERGE_GENUNIX 	= \
3677c478bd9Sstevel@tonic-gate	$(UTSBASE)/$(CTFMERGE_GUDIR)/genunix/$(OBJS_DIR)/genunix
3687c478bd9Sstevel@tonic-gate
3697c478bd9Sstevel@tonic-gate#
3707c478bd9Sstevel@tonic-gate# Used to uniquify a non-genunix module against genunix.  If used in patch
3717c478bd9Sstevel@tonic-gate# mode (PATCH_BUILD != "#"), the patch ID corresponding to the module being
3727c478bd9Sstevel@tonic-gate# built will be used as the label.  If no ID is available, or if patch mode
3737c478bd9Sstevel@tonic-gate# is not being used, the value of $VERSION will be used.
3747c478bd9Sstevel@tonic-gate#
3757c478bd9Sstevel@tonic-gateCTFMERGE_UNIQUIFY_AGAINST_GENUNIX	= \
3767c478bd9Sstevel@tonic-gate	@label="-L VERSION" ; \
3777c478bd9Sstevel@tonic-gate	if [ -z "$(PATCH_BUILD)" ] ; then \
3787c478bd9Sstevel@tonic-gate		uniq="-D BASE" ; \
3797c478bd9Sstevel@tonic-gate		set -- `$(CTFFINDMOD) -n -r -t $(PMTMO_FILE) $@` ; \
3807c478bd9Sstevel@tonic-gate		if [ "X$$1" != "X-" ] ; then \
3817c478bd9Sstevel@tonic-gate			label="-l $$1" ; \
3827c478bd9Sstevel@tonic-gate			if [ "$$2" != "fcs" ] ; then \
3837c478bd9Sstevel@tonic-gate				uniq="-D $$2" ; \
3847c478bd9Sstevel@tonic-gate			fi ; \
3857c478bd9Sstevel@tonic-gate		fi ; \
3867c478bd9Sstevel@tonic-gate	fi ; \
3877c478bd9Sstevel@tonic-gate	mergecmd="$(CTFMERGE) $(CTFMRGFLAGS)" ; \
3887c478bd9Sstevel@tonic-gate	cmd="$$mergecmd $$label -d $(CTFMERGE_GENUNIX) $$uniq -o $@" ; \
3897c478bd9Sstevel@tonic-gate	echo $$cmd "$(OBJECTS) $(CTFEXTRAOBJS)" ; \
3907c478bd9Sstevel@tonic-gate	$$cmd $(OBJECTS) $(CTFEXTRAOBJS)
3917c478bd9Sstevel@tonic-gate
3927c478bd9Sstevel@tonic-gate#
3937c478bd9Sstevel@tonic-gate# Used to merge the genunix module.  genunix has special requirements in
3947c478bd9Sstevel@tonic-gate# patch mode.  In particular, it needs to be able to find the genunix used
3957c478bd9Sstevel@tonic-gate# in the previous version of the KU patch (or the FCS version of genunix in
3967c478bd9Sstevel@tonic-gate# the case of KU 1).
3977c478bd9Sstevel@tonic-gate#
3987c478bd9Sstevel@tonic-gateCTFMERGE_GENUNIX_MERGE		= \
3997c478bd9Sstevel@tonic-gate	@if [ -z "$(PATCH_BUILD)" ] ; then \
4007c478bd9Sstevel@tonic-gate		set -- `$(CTFFINDMOD) -b $(OBJS_DIR) -o patch,lastgu -n -r \
4017c478bd9Sstevel@tonic-gate		    -t $(PMTMO_FILE) $(GENUNIX) || true` '' ; \
4027c478bd9Sstevel@tonic-gate		msg= ; \
4037c478bd9Sstevel@tonic-gate		if [ $$$(POUND_SIGN) -eq 1 ] ; \
4047c478bd9Sstevel@tonic-gate		    then msg="Error in $(CTFFINDMOD)" ; \
4057c478bd9Sstevel@tonic-gate		elif [ "X$$1" = "X-" ] ; then msg="Did not get label" ; \
4067c478bd9Sstevel@tonic-gate		elif [ "X$$2" = "X-" ] ; then msg="Did not get withfile" ; \
4077c478bd9Sstevel@tonic-gate		fi ; \
4087c478bd9Sstevel@tonic-gate		if [ -n "$$msg" ] ; then \
4097c478bd9Sstevel@tonic-gate			echo "make ctf: $$msg - removing $(GENUNIX)" ; \
4107c478bd9Sstevel@tonic-gate			$(RM) $(GENUNIX) ; \
4117c478bd9Sstevel@tonic-gate			exit 1 ; \
4127c478bd9Sstevel@tonic-gate		fi ; \
4137c478bd9Sstevel@tonic-gate		label="-l $$1" ; \
4147c478bd9Sstevel@tonic-gate		with="-w $$2" ; \
4157c478bd9Sstevel@tonic-gate	else \
4167c478bd9Sstevel@tonic-gate		label="-L VERSION" ; \
4177c478bd9Sstevel@tonic-gate	fi ; \
4187c478bd9Sstevel@tonic-gate	cmd="$(CTFMERGE) $(CTFMRGFLAGS) $$label $$with -o $@" ; \
4197c478bd9Sstevel@tonic-gate	echo $$cmd "$(OBJECTS) $(CTFEXTRAOBJS) $(IPCTF_TARGET)"; \
4207c478bd9Sstevel@tonic-gate	$$cmd $(OBJECTS) $(CTFEXTRAOBJS) $(IPCTF_TARGET)
4217c478bd9Sstevel@tonic-gate
4227c478bd9Sstevel@tonic-gate#
4237c478bd9Sstevel@tonic-gate# Used to copy CTF data from the sun4u genunix to the sun4m genunix.  While
4247c478bd9Sstevel@tonic-gate# we may lose some genunix-specific sun4m-only data, there really isn't any
4257c478bd9Sstevel@tonic-gate# other way, since individual ctfmerges on the sun4u and sun4m genunix
4267c478bd9Sstevel@tonic-gate# modules will result in differing type indices for the same types, and we
4277c478bd9Sstevel@tonic-gate# can't uniquify a given non-genunix module against two genunix modules.
4287c478bd9Sstevel@tonic-gate#
4297c478bd9Sstevel@tonic-gateCTFMERGE_COPY_CTF_DATA		= \
4307c478bd9Sstevel@tonic-gate	@if [ -f $(CTFMERGE_GENUNIX) ] ; then \
4317c478bd9Sstevel@tonic-gate		cmd="$(CTFMERGE) $(CTFMRGFLAGS) -c $(CTFMERGE_GENUNIX) $@" ; \
4327c478bd9Sstevel@tonic-gate		echo $$cmd ; \
4337c478bd9Sstevel@tonic-gate		$$cmd ; \
4347c478bd9Sstevel@tonic-gate	else \
4357c478bd9Sstevel@tonic-gate		echo "WARNING: $(CTFMERGE_GENUNIX) not built. " \
4367c478bd9Sstevel@tonic-gate		    "CTF data will be incomplete" ; \
4377c478bd9Sstevel@tonic-gate	fi
4387c478bd9Sstevel@tonic-gate
4397c478bd9Sstevel@tonic-gate#
4407c478bd9Sstevel@tonic-gate# We ctfmerge the ip objects into genunix to maximize the number of common types
4417c478bd9Sstevel@tonic-gate# found there, thus maximizing the effectiveness of uniquification.  We don't
4427c478bd9Sstevel@tonic-gate# want the genunix build to have to know about the individual ip objects, so we
4437c478bd9Sstevel@tonic-gate# put them in an archive.  The genunix ctfmerge then includes this archive.
4447c478bd9Sstevel@tonic-gate#
4457c478bd9Sstevel@tonic-gateIPCTF			= $(IPDRV_DIR)/$(OBJS_DIR)/ipctf.a
4467c478bd9Sstevel@tonic-gate
447*02e56f3fSwesolows#
448*02e56f3fSwesolows# Rule for building fake shared libraries used for symbol resolution
449*02e56f3fSwesolows# when building other modules.  -znoreloc is needed here to avoid
450*02e56f3fSwesolows# tripping over code that isn't really suitable for shared libraries.
451*02e56f3fSwesolows#
452*02e56f3fSwesolowsBUILD.SO		= \
453*02e56f3fSwesolows	$(LD) -o $@ $(GSHARED) $(ZNORELOC) -h $(SONAME)
454*02e56f3fSwesolows
455*02e56f3fSwesolows#
456*02e56f3fSwesolows# SONAME defaults for common fake shared libraries.
457*02e56f3fSwesolows#
458*02e56f3fSwesolows$(LIBGEN)		:= SONAME = $(MODULE)
459*02e56f3fSwesolows$(PLATLIB)		:= SONAME = misc/platmod
460*02e56f3fSwesolows$(CPULIB)		:= SONAME = 'cpu/$$CPU'
461*02e56f3fSwesolows$(DTRACESTUBS)		:= SONAME = dtracestubs
462*02e56f3fSwesolows
4637c478bd9Sstevel@tonic-gate#
4647c478bd9Sstevel@tonic-gate#	Installation directories
4657c478bd9Sstevel@tonic-gate#
4667c478bd9Sstevel@tonic-gate
4677c478bd9Sstevel@tonic-gate#
4687c478bd9Sstevel@tonic-gate#	For now, 64b modules install into a subdirectory
4697c478bd9Sstevel@tonic-gate#	of their 32b brethren.
4707c478bd9Sstevel@tonic-gate#
4717c478bd9Sstevel@tonic-gateSUBDIR64_sparc		= sparcv9
4727c478bd9Sstevel@tonic-gateSUBDIR64_i386		= amd64
4737c478bd9Sstevel@tonic-gateSUBDIR64		= $(SUBDIR64_$(MACH))
4747c478bd9Sstevel@tonic-gate
4757c478bd9Sstevel@tonic-gateROOT_MOD_DIR		= $(ROOT)/kernel
4767c478bd9Sstevel@tonic-gate
4777c478bd9Sstevel@tonic-gateROOT_KERN_DIR_32	= $(ROOT_MOD_DIR)
4787c478bd9Sstevel@tonic-gateROOT_DRV_DIR_32		= $(ROOT_MOD_DIR)/drv
4797c478bd9Sstevel@tonic-gateROOT_DTRACE_DIR_32	= $(ROOT_MOD_DIR)/dtrace
4807c478bd9Sstevel@tonic-gateROOT_EXEC_DIR_32	= $(ROOT_MOD_DIR)/exec
4817c478bd9Sstevel@tonic-gateROOT_FS_DIR_32		= $(ROOT_MOD_DIR)/fs
4827c478bd9Sstevel@tonic-gateROOT_SCHED_DIR_32	= $(ROOT_MOD_DIR)/sched
4837c478bd9Sstevel@tonic-gateROOT_STRMOD_DIR_32	= $(ROOT_MOD_DIR)/strmod
4847c478bd9Sstevel@tonic-gateROOT_IPP_DIR_32		= $(ROOT_MOD_DIR)/ipp
4857c478bd9Sstevel@tonic-gateROOT_SYS_DIR_32		= $(ROOT_MOD_DIR)/sys
4867c478bd9Sstevel@tonic-gateROOT_MISC_DIR_32	= $(ROOT_MOD_DIR)/misc
4877c478bd9Sstevel@tonic-gateROOT_KGSS_DIR_32	= $(ROOT_MOD_DIR)/misc/kgss
4887c478bd9Sstevel@tonic-gateROOT_NLMISC_DIR_32	= $(ROOT_MOD_DIR)/misc
4897c478bd9Sstevel@tonic-gateROOT_MACH_DIR_32	= $(ROOT_MOD_DIR)/mach
4907c478bd9Sstevel@tonic-gateROOT_CPU_DIR_32		= $(ROOT_MOD_DIR)/cpu
4917c478bd9Sstevel@tonic-gateROOT_TOD_DIR_32		= $(ROOT_MOD_DIR)/tod
4927c478bd9Sstevel@tonic-gateROOT_FONT_DIR_32	= $(ROOT_MOD_DIR)/fonts
4937c478bd9Sstevel@tonic-gateROOT_DACF_DIR_32	= $(ROOT_MOD_DIR)/dacf
4947c478bd9Sstevel@tonic-gateROOT_CRYPTO_DIR_32	= $(ROOT_MOD_DIR)/crypto
4957c478bd9Sstevel@tonic-gate
4967c478bd9Sstevel@tonic-gateROOT_KERN_DIR_64	= $(ROOT_MOD_DIR)/$(SUBDIR64)
4977c478bd9Sstevel@tonic-gateROOT_DRV_DIR_64		= $(ROOT_MOD_DIR)/drv/$(SUBDIR64)
4987c478bd9Sstevel@tonic-gateROOT_DTRACE_DIR_64	= $(ROOT_MOD_DIR)/dtrace/$(SUBDIR64)
4997c478bd9Sstevel@tonic-gateROOT_EXEC_DIR_64	= $(ROOT_MOD_DIR)/exec/$(SUBDIR64)
5007c478bd9Sstevel@tonic-gateROOT_FS_DIR_64		= $(ROOT_MOD_DIR)/fs/$(SUBDIR64)
5017c478bd9Sstevel@tonic-gateROOT_SCHED_DIR_64	= $(ROOT_MOD_DIR)/sched/$(SUBDIR64)
5027c478bd9Sstevel@tonic-gateROOT_STRMOD_DIR_64	= $(ROOT_MOD_DIR)/strmod/$(SUBDIR64)
5037c478bd9Sstevel@tonic-gateROOT_IPP_DIR_64		= $(ROOT_MOD_DIR)/ipp/$(SUBDIR64)
5047c478bd9Sstevel@tonic-gateROOT_SYS_DIR_64		= $(ROOT_MOD_DIR)/sys/$(SUBDIR64)
5057c478bd9Sstevel@tonic-gateROOT_MISC_DIR_64	= $(ROOT_MOD_DIR)/misc/$(SUBDIR64)
5067c478bd9Sstevel@tonic-gateROOT_KGSS_DIR_64	= $(ROOT_MOD_DIR)/misc/kgss/$(SUBDIR64)
5077c478bd9Sstevel@tonic-gateROOT_NLMISC_DIR_64	= $(ROOT_MOD_DIR)/misc/$(SUBDIR64)
5087c478bd9Sstevel@tonic-gateROOT_MACH_DIR_64	= $(ROOT_MOD_DIR)/mach/$(SUBDIR64)
5097c478bd9Sstevel@tonic-gateROOT_CPU_DIR_64		= $(ROOT_MOD_DIR)/cpu/$(SUBDIR64)
5107c478bd9Sstevel@tonic-gateROOT_TOD_DIR_64		= $(ROOT_MOD_DIR)/tod/$(SUBDIR64)
5117c478bd9Sstevel@tonic-gateROOT_FONT_DIR_64	= $(ROOT_MOD_DIR)/fonts/$(SUBDIR64)
5127c478bd9Sstevel@tonic-gateROOT_DACF_DIR_64	= $(ROOT_MOD_DIR)/dacf/$(SUBDIR64)
5137c478bd9Sstevel@tonic-gateROOT_CRYPTO_DIR_64	= $(ROOT_MOD_DIR)/crypto/$(SUBDIR64)
5147c478bd9Sstevel@tonic-gate
5157c478bd9Sstevel@tonic-gateROOT_KERN_DIR		= $(ROOT_KERN_DIR_$(CLASS))
5167c478bd9Sstevel@tonic-gateROOT_DRV_DIR		= $(ROOT_DRV_DIR_$(CLASS))
5177c478bd9Sstevel@tonic-gateROOT_DTRACE_DIR		= $(ROOT_DTRACE_DIR_$(CLASS))
5187c478bd9Sstevel@tonic-gateROOT_EXEC_DIR		= $(ROOT_EXEC_DIR_$(CLASS))
5197c478bd9Sstevel@tonic-gateROOT_FS_DIR		= $(ROOT_FS_DIR_$(CLASS))
5207c478bd9Sstevel@tonic-gateROOT_SCHED_DIR		= $(ROOT_SCHED_DIR_$(CLASS))
5217c478bd9Sstevel@tonic-gateROOT_STRMOD_DIR		= $(ROOT_STRMOD_DIR_$(CLASS))
5227c478bd9Sstevel@tonic-gateROOT_IPP_DIR		= $(ROOT_IPP_DIR_$(CLASS))
5237c478bd9Sstevel@tonic-gateROOT_SYS_DIR		= $(ROOT_SYS_DIR_$(CLASS))
5247c478bd9Sstevel@tonic-gateROOT_MISC_DIR		= $(ROOT_MISC_DIR_$(CLASS))
5257c478bd9Sstevel@tonic-gateROOT_KGSS_DIR		= $(ROOT_KGSS_DIR_$(CLASS))
5267c478bd9Sstevel@tonic-gateROOT_NLMISC_DIR		= $(ROOT_NLMISC_DIR_$(CLASS))
5277c478bd9Sstevel@tonic-gateROOT_MACH_DIR		= $(ROOT_MACH_DIR_$(CLASS))
5287c478bd9Sstevel@tonic-gateROOT_CPU_DIR		= $(ROOT_CPU_DIR_$(CLASS))
5297c478bd9Sstevel@tonic-gateROOT_TOD_DIR		= $(ROOT_TOD_DIR_$(CLASS))
5307c478bd9Sstevel@tonic-gateROOT_FONT_DIR		= $(ROOT_FONT_DIR_$(CLASS))
5317c478bd9Sstevel@tonic-gateROOT_DACF_DIR		= $(ROOT_DACF_DIR_$(CLASS))
5327c478bd9Sstevel@tonic-gateROOT_CRYPTO_DIR		= $(ROOT_CRYPTO_DIR_$(CLASS))
5337c478bd9Sstevel@tonic-gate
5347c478bd9Sstevel@tonic-gateROOT_MOD_DIRS_32	= $(ROOT_DRV_DIR_32) $(ROOT_EXEC_DIR_32)
5357c478bd9Sstevel@tonic-gateROOT_MOD_DIRS_32	+= $(ROOT_DTRACE_DIR_32)
5367c478bd9Sstevel@tonic-gateROOT_MOD_DIRS_32	+= $(ROOT_FS_DIR_32) $(ROOT_SCHED_DIR_32)
5377c478bd9Sstevel@tonic-gateROOT_MOD_DIRS_32	+= $(ROOT_STRMOD_DIR_32) $(ROOT_SYS_DIR_32)
5387c478bd9Sstevel@tonic-gateROOT_MOD_DIRS_32	+= $(ROOT_IPP_DIR_32)
5397c478bd9Sstevel@tonic-gateROOT_MOD_DIRS_32	+= $(ROOT_MISC_DIR_32) $(ROOT_MACH_DIR_32)
5407c478bd9Sstevel@tonic-gateROOT_MOD_DIRS_32	+= $(ROOT_KGSS_DIR_32)
5417c478bd9Sstevel@tonic-gateROOT_MOD_DIRS_32	+= $(ROOT_CPU_DIR_32) $(ROOT_FONT_DIR_32)
5427c478bd9Sstevel@tonic-gateROOT_MOD_DIRS_32	+= $(ROOT_TOD_DIR_32) $(ROOT_DACF_DIR_32)
5437c478bd9Sstevel@tonic-gateROOT_MOD_DIRS_32	+= $(ROOT_CRYPTO_DIR_32)
5447c478bd9Sstevel@tonic-gate
5457c478bd9Sstevel@tonic-gateUSR_MOD_DIR		= $(ROOT)/usr/kernel
5467c478bd9Sstevel@tonic-gate
5477c478bd9Sstevel@tonic-gateUSR_DRV_DIR_32		= $(USR_MOD_DIR)/drv
5487c478bd9Sstevel@tonic-gateUSR_EXEC_DIR_32		= $(USR_MOD_DIR)/exec
5497c478bd9Sstevel@tonic-gateUSR_FS_DIR_32		= $(USR_MOD_DIR)/fs
5507c478bd9Sstevel@tonic-gateUSR_SCHED_DIR_32	= $(USR_MOD_DIR)/sched
5517c478bd9Sstevel@tonic-gateUSR_STRMOD_DIR_32	= $(USR_MOD_DIR)/strmod
5527c478bd9Sstevel@tonic-gateUSR_SYS_DIR_32		= $(USR_MOD_DIR)/sys
5537c478bd9Sstevel@tonic-gateUSR_MISC_DIR_32		= $(USR_MOD_DIR)/misc
5547c478bd9Sstevel@tonic-gateUSR_DACF_DIR_32		= $(USR_MOD_DIR)/dacf
5557c478bd9Sstevel@tonic-gateUSR_PCBE_DIR_32		= $(USR_MOD_DIR)/pcbe
5567c478bd9Sstevel@tonic-gate
5577c478bd9Sstevel@tonic-gateUSR_DRV_DIR_64		= $(USR_MOD_DIR)/drv/$(SUBDIR64)
5587c478bd9Sstevel@tonic-gateUSR_EXEC_DIR_64		= $(USR_MOD_DIR)/exec/$(SUBDIR64)
5597c478bd9Sstevel@tonic-gateUSR_FS_DIR_64		= $(USR_MOD_DIR)/fs/$(SUBDIR64)
5607c478bd9Sstevel@tonic-gateUSR_SCHED_DIR_64	= $(USR_MOD_DIR)/sched/$(SUBDIR64)
5617c478bd9Sstevel@tonic-gateUSR_STRMOD_DIR_64	= $(USR_MOD_DIR)/strmod/$(SUBDIR64)
5627c478bd9Sstevel@tonic-gateUSR_SYS_DIR_64		= $(USR_MOD_DIR)/sys/$(SUBDIR64)
5637c478bd9Sstevel@tonic-gateUSR_MISC_DIR_64		= $(USR_MOD_DIR)/misc/$(SUBDIR64)
5647c478bd9Sstevel@tonic-gateUSR_DACF_DIR_64		= $(USR_MOD_DIR)/dacf/$(SUBDIR64)
5657c478bd9Sstevel@tonic-gateUSR_PCBE_DIR_64		= $(USR_MOD_DIR)/pcbe/$(SUBDIR64)
5667c478bd9Sstevel@tonic-gate
5677c478bd9Sstevel@tonic-gateUSR_DRV_DIR		= $(USR_DRV_DIR_$(CLASS))
5687c478bd9Sstevel@tonic-gateUSR_EXEC_DIR		= $(USR_EXEC_DIR_$(CLASS))
5697c478bd9Sstevel@tonic-gateUSR_FS_DIR		= $(USR_FS_DIR_$(CLASS))
5707c478bd9Sstevel@tonic-gateUSR_SCHED_DIR		= $(USR_SCHED_DIR_$(CLASS))
5717c478bd9Sstevel@tonic-gateUSR_STRMOD_DIR		= $(USR_STRMOD_DIR_$(CLASS))
5727c478bd9Sstevel@tonic-gateUSR_SYS_DIR		= $(USR_SYS_DIR_$(CLASS))
5737c478bd9Sstevel@tonic-gateUSR_MISC_DIR		= $(USR_MISC_DIR_$(CLASS))
5747c478bd9Sstevel@tonic-gateUSR_DACF_DIR		= $(USR_DACF_DIR_$(CLASS))
5757c478bd9Sstevel@tonic-gateUSR_PCBE_DIR		= $(USR_PCBE_DIR_$(CLASS))
5767c478bd9Sstevel@tonic-gate
5777c478bd9Sstevel@tonic-gateUSR_MOD_DIRS_32		= $(USR_DRV_DIR_32) $(USR_EXEC_DIR_32)
5787c478bd9Sstevel@tonic-gateUSR_MOD_DIRS_32		+= $(USR_FS_DIR_32) $(USR_SCHED_DIR_32)
5797c478bd9Sstevel@tonic-gateUSR_MOD_DIRS_32		+= $(USR_STRMOD_DIR_32) $(USR_SYS_DIR_32)
5807c478bd9Sstevel@tonic-gateUSR_MOD_DIRS_32		+= $(USR_MISC_DIR_32) $(USR_DACF_DIR_32)
5817c478bd9Sstevel@tonic-gateUSR_MOD_DIRS_32		+= $(USR_PCBE_DIR_32)
5827c478bd9Sstevel@tonic-gate
5837c478bd9Sstevel@tonic-gate#
5847c478bd9Sstevel@tonic-gate#
5857c478bd9Sstevel@tonic-gate#
5867c478bd9Sstevel@tonic-gateinclude $(SRC)/Makefile.psm
5877c478bd9Sstevel@tonic-gate
5887c478bd9Sstevel@tonic-gate#
5897c478bd9Sstevel@tonic-gate#       Set ownership on links.
5907c478bd9Sstevel@tonic-gate#
5917c478bd9Sstevel@tonic-gateCHOWNLINK=
5927c478bd9Sstevel@tonic-gate$(CH)CHOWNLINK= ; $(CHOWN) $(OWNER) $@
5937c478bd9Sstevel@tonic-gateCHGRPLINK=
5947c478bd9Sstevel@tonic-gate$(CH)CHGRPLINK= ; $(CHGRP) $(GROUP) $@
5957c478bd9Sstevel@tonic-gate
5967c478bd9Sstevel@tonic-gate#
5977c478bd9Sstevel@tonic-gate#	The "-r" on the remove may be considered temporary, but is required
5987c478bd9Sstevel@tonic-gate#	while the replacement of the SUNW,SPARCstation-10,SX directory by
5997c478bd9Sstevel@tonic-gate#	a symbolic link is being propagated.
6007c478bd9Sstevel@tonic-gate#
6017c478bd9Sstevel@tonic-gateINS.slink1= $(RM) -r $@; $(SYMLINK) $(PLATFORM) $@ $(CHOWNLINK) $(CHGRPLINK)
6027c478bd9Sstevel@tonic-gateINS.slink2= $(RM) -r $@; $(SYMLINK) ../$(PLATFORM)/$(@F) $@ $(CHOWNLINK) $(CHGRPLINK)
6037c478bd9Sstevel@tonic-gateINS.slink3= $(RM) -r $@; $(SYMLINK) $(IMPLEMENTED_PLATFORM) $@ $(CHOWNLINK) $(CHGRPLINK)
6047c478bd9Sstevel@tonic-gateINS.slink4= $(RM) -r $@; $(SYMLINK) ../$(PLATFORM)/include $@ $(CHOWNLINK) $(CHGRPLINK)
6057c478bd9Sstevel@tonic-gateINS.slink5= $(RM) -r $@; $(SYMLINK) ../$(PLATFORM)/sbin $@ $(CHOWNLINK) $(CHGRPLINK)
6067c478bd9Sstevel@tonic-gateINS.slink6= $(RM) -r $@; $(SYMLINK) ../../$(PLATFORM)/lib/$(MODULE) $@ $(CHOWNLINK) $(CHGRPLINK)
6077c478bd9Sstevel@tonic-gate
6087c478bd9Sstevel@tonic-gateROOT_PLAT_LINKS		 = $(PLAT_LINKS:%=$(ROOT_PLAT_DIR)/%)
6097c478bd9Sstevel@tonic-gateROOT_PLAT_LINKS_2	 = $(PLAT_LINKS_2:%=$(ROOT_PLAT_DIR)/%)
6107c478bd9Sstevel@tonic-gateUSR_PLAT_LINKS		 = $(PLAT_LINKS:%=$(USR_PLAT_DIR)/%)
6117c478bd9Sstevel@tonic-gateUSR_PLAT_LINKS_2	 = $(PLAT_LINKS_2:%=$(USR_PLAT_DIR)/%)
6127c478bd9Sstevel@tonic-gate
6137c478bd9Sstevel@tonic-gate#
6147c478bd9Sstevel@tonic-gate#	Collection of all relevant, delivered kernel modules.
6157c478bd9Sstevel@tonic-gate#
6167c478bd9Sstevel@tonic-gateKMODS	= $(DRV_KMODS) $(EXEC_KMODS) $(FS_KMODS) $(SCHED_KMODS) $(TOD_KMODS) \
6177c478bd9Sstevel@tonic-gate	  $(STRMOD_KMODS) $(SYS_KMODS) $(MISC_KMODS) $(NLMISC_KMODS) \
6187c478bd9Sstevel@tonic-gate	  $(MACH_KMODS) $(CPU_KMODS) $(GENUNIX_KMODS) \
6197c478bd9Sstevel@tonic-gate	  $(GSS_KMODS) $(MMU_KMODS) $(DACF_KMODS) $(EXPORT_KMODS) \
6207c478bd9Sstevel@tonic-gate	  $(IPP_KMODS) $(CRYPTO_KMODS) $(CRYPTO_EK_KMODS) $(PCBE_KMODS) \
6217c478bd9Sstevel@tonic-gate	  $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS))
6227c478bd9Sstevel@tonic-gate
6237c478bd9Sstevel@tonic-gateLINT_KMODS = $(DRV_KMODS) $(EXEC_KMODS) $(FS_KMODS) $(SCHED_KMODS) \
6247c478bd9Sstevel@tonic-gate	  $(TOD_KMODS) $(STRMOD_KMODS) $(SYS_KMODS) $(MISC_KMODS) \
6257c478bd9Sstevel@tonic-gate	  $(MACH_KMODS) $(GSS_KMODS) $(DACF_KMODS) $(IPP_KMODS) \
6267c478bd9Sstevel@tonic-gate	  $(CRYPTO_KMODS) $(PCBE_KMODS) \
6277c478bd9Sstevel@tonic-gate	  $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS))
6287c478bd9Sstevel@tonic-gate
6297c478bd9Sstevel@tonic-gateTHIS_YEAR:sh=	/bin/date +%Y
6307c478bd9Sstevel@tonic-gate$(OBJS_DIR)/logsubr.o	:= CPPFLAGS += -DTHIS_YEAR=$(THIS_YEAR)
6317c478bd9Sstevel@tonic-gate$(OBJS_DIR)/logsubr.ln	:= CPPFLAGS += -DTHIS_YEAR=$(THIS_YEAR)
6327c478bd9Sstevel@tonic-gate
6337c478bd9Sstevel@tonic-gate#
6347c478bd9Sstevel@tonic-gate#	Files to be compiled with -xa, to generate basic block execution
6357c478bd9Sstevel@tonic-gate#	count data.
6367c478bd9Sstevel@tonic-gate#
6377c478bd9Sstevel@tonic-gate#	There are several ways to compile parts of the kernel for kcov:
6387c478bd9Sstevel@tonic-gate#               1)  Add targets to BB_FILES here or in other Makefiles
6397c478bd9Sstevel@tonic-gate#                       (they must in the form of $(OBJS_DIR)/target.o)
6407c478bd9Sstevel@tonic-gate#               2)  setenv BB_FILES '$(XXX_OBJS:%=$(OBJS_DIR)/%)'
6417c478bd9Sstevel@tonic-gate#               3)  setenv BB_FILES '$(OBJECTS)'
6427c478bd9Sstevel@tonic-gate#
6437c478bd9Sstevel@tonic-gate#       Do NOT setenv CFLAGS -xa, as that will cause infinite recursion
6447c478bd9Sstevel@tonic-gate#       in unix_bb.o
6457c478bd9Sstevel@tonic-gate#
6467c478bd9Sstevel@tonic-gateBB_FILES =
6477c478bd9Sstevel@tonic-gate$(BB_FILES)	:= XAOPT = -xa
6487c478bd9Sstevel@tonic-gate
6497c478bd9Sstevel@tonic-gate#
6507c478bd9Sstevel@tonic-gate#	The idea here is for unix_bb.o to be in all kernels except the
6517c478bd9Sstevel@tonic-gate#	kernel which actually gets shipped to customers.  In practice,
6527c478bd9Sstevel@tonic-gate#	$(RELEASE_BUILD) is on for a number of the late beta and fcs builds.
6537c478bd9Sstevel@tonic-gate#
6547c478bd9Sstevel@tonic-gateCODE_COVERAGE=
6557c478bd9Sstevel@tonic-gate$(RELEASE_BUILD)CODE_COVERAGE:sh=	echo \\043
6567c478bd9Sstevel@tonic-gate$(CODE_COVERAGE)$(OBJS_DIR)/unix_bb.o   := CPPFLAGS     += -DKCOV
6577c478bd9Sstevel@tonic-gate$(CODE_COVERAGE)$(OBJS_DIR)/unix_bb.ln  := CPPFLAGS     += -DKCOV
6587c478bd9Sstevel@tonic-gate
6597c478bd9Sstevel@tonic-gate#
6607c478bd9Sstevel@tonic-gate#	Do not let unix_bb.o get compiled with -xa!
6617c478bd9Sstevel@tonic-gate#
6627c478bd9Sstevel@tonic-gate$(OBJS_DIR)/unix_bb.o	:= XAOPT =
6637c478bd9Sstevel@tonic-gate
6647c478bd9Sstevel@tonic-gate#
6657c478bd9Sstevel@tonic-gate#	MPSAS support
6667c478bd9Sstevel@tonic-gate#
6677c478bd9Sstevel@tonic-gateMPSAS_BUILD:sh=		echo \\043
6687c478bd9Sstevel@tonic-gate#
6697c478bd9Sstevel@tonic-gate# Privilege files
6707c478bd9Sstevel@tonic-gate#
6717c478bd9Sstevel@tonic-gatePRIVS_AWK = $(SRC)/uts/common/os/privs.awk
6727c478bd9Sstevel@tonic-gatePRIVS_DEF = $(SRC)/uts/common/os/priv_defs
673