xref: /titanic_41/usr/src/uts/Makefile.uts (revision 53391baf4e45c693cf123555e9617b5e1e0b641a)
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#
23# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29#
30#	This Makefile contains the common targets and definitions for
31#	all kernels. It is to be included in the Makefiles for specific
32#	implementation architectures and processor architecture dependent
33#	modules: i.e.: all driving kernel Makefiles.
34#
35#	Include global definitions:
36#
37include $(SRC)/Makefile.master
38
39#
40#	No text domain in the kernel.
41#
42DTEXTDOM =
43
44#
45# 	Keep references to $(SRC)/common relative.
46COMMONBASE=	$(UTSBASE)/../common
47
48#
49#	Setup build-specific vars
50#	To add a build type:
51#		add name to ALL_BUILDS32 & ALL_BUILDS64
52#		set CLASS_name and OBJ_DIR_name
53#		add targets to Makefile.targ
54#
55
56#
57#	DEF_BUILDS is for def, lint and install
58#	ALL_BUILDS is for everything else (all, clean, ...)
59#
60# The NOT_RELEASE_BUILD noise is to maintain compatibility with the
61# gatekeeper's nightly build script.
62#
63DEF_BUILDS32				= obj32
64DEF_BUILDS64				= obj64
65DEF_BUILDSONLY64			= obj64
66$(NOT_RELEASE_BUILD)DEF_BUILDS32	= debug32
67$(NOT_RELEASE_BUILD)DEF_BUILDS64	= debug64
68$(NOT_RELEASE_BUILD)DEF_BUILDSONLY64	= debug64
69ALL_BUILDS32				= obj32 debug32
70ALL_BUILDS64				= obj64 debug64
71ALL_BUILDSONLY64			= obj64 debug64
72
73#
74#	For modules in 64b dirs that aren't built 64b
75#	or modules in 64b dirs that aren't built 32b we
76#	need to create empty modlintlib files so global lint works
77#
78LINT32_BUILDS	= debug32
79LINT64_BUILDS	= debug64
80
81#
82#	Build class (32b or 64b)
83#
84CLASS_OBJ32	= 32
85CLASS_DBG32	= 32
86CLASS_OBJ64	= 64
87CLASS_DBG64	= 64
88CLASS		= $(CLASS_$(BUILD_TYPE))
89
90#
91#	Build subdirectory
92#
93OBJS_DIR_OBJ32	= obj32
94OBJS_DIR_DBG32	= debug32
95OBJS_DIR_OBJ64	= obj64
96OBJS_DIR_DBG64	= debug64
97OBJS_DIR	= $(OBJS_DIR_$(BUILD_TYPE))
98
99#
100#	Create defaults so empty rules don't
101#	confuse make
102#
103CLASS_		= 32
104OBJS_DIR_	= debug32
105
106#
107#	Build tools
108#
109CC_sparc_32	= $(sparc_CC)
110CC_sparc_64	= $(sparcv9_CC)
111
112CC_i386_32	= $(i386_CC)
113CC_i386_64	= $(amd64_CC)
114CC_amd64_64	= $(amd64_CC)
115
116CC		= $(CC_$(MACH)_$(CLASS))
117
118AS_sparc_32	= $(sparc_AS)
119AS_sparc_64	= $(sparcv9_AS)
120
121AS_i386_32	= $(i386_AS)
122AS_i386_64	= $(amd64_AS)
123AS_amd64_64	= $(amd64_AS)
124
125AS		= $(AS_$(MACH)_$(CLASS))
126
127LD_sparc_32	= $(sparc_LD)
128LD_sparc_64	= $(sparcv9_LD)
129
130LD_i386_32	= $(i386_LD)
131LD_i386_64	= $(amd64_LD)
132LD_amd64_64	= $(amd64_LD)
133
134LD		= $(LD_$(MACH)_$(CLASS))
135
136LINT_sparc_32	= $(sparc_LINT)
137LINT_sparc_64	= $(sparcv9_LINT)
138
139LINT_i386_32	= $(i386_LINT)
140LINT_i386_64	= $(amd64_LINT)
141LINT_amd64_64	= $(amd64_LINT)
142
143LINT		= $(LINT_$(MACH)_$(CLASS))
144
145MODEL_32	= ilp32
146MODEL_64	= lp64
147MODEL		= $(MODEL_$(CLASS))
148
149#
150#	Build rules for linting the kernel.
151#
152LHEAD =	( $(ECHO) "\n$@";
153
154LGREP.2 =	grep -v ' _init ' | \
155		grep -v ' _fini ' | \
156		grep -v ' _info ' | \
157		grep -v ' _depends_on ' | \
158		cat
159
160LTAIL =	)
161
162LINT.c =	$(LINT) -c -dirout=$(LINTS_DIR) $(LINTFLAGS) $(LINT_DEFS) $(CPPFLAGS)
163
164LINTTAGS_32	=
165LINTTAGS_32	+= -erroff=E_BAD_PTR_CAST_ALIGN
166LINTTAGS_32	+= -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
167LINTTAGS_32	+= -erroff=E_SUSPICIOUS_COMPARISON
168LINTTAGS_32	+= -erroff=E_CAST_UINT_TO_SIGNED_INT
169LINTTAGS_32	+= -erroff=E_PASS_UINT_TO_SIGNED_INT
170LINTTAGS_32	+= -erroff=E_INVALID_ANNOTATION_NAME
171LINTTAGS_32	+= -erroff=E_OLD_STYLE_DECL_OR_BAD_TYPE
172LINTTAGS_32	+= -erroff=E_NO_EXPLICIT_TYPE_GIVEN
173LINTTAGS_32	+= -erroff=E_STATIC_UNUSED
174LINTTAGS_32	+= -erroff=E_PTRDIFF_OVERFLOW
175LINTTAGS_32	+= -erroff=E_ASSIGN_NARROW_CONV
176
177LINTTAGS_64	= $(LINTTAGS_32)
178
179# Selectively disable certain noisy lint errors
180LENIENT_LINTTAGS =
181LENIENT_LINTTAGS += -erroff=E_CAST_INT_TO_SMALL_INT
182LENIENT_LINTTAGS += -erroff=E_CAST_INT_CONST_TO_SMALL_INT
183LENIENT_LINTTAGS += -erroff=E_CAST_TO_PTR_FROM_INT
184LENIENT_LINTTAGS += -erroff=E_ASSIGN_INT_TO_SMALL_INT
185LENIENT_LINTTAGS += -erroff=E_ASSIGN_INT_FROM_BIG_CONST
186LENIENT_LINTTAGS += -erroff=E_CONST_PROMOTED_UNSIGNED_LL
187LENIENT_LINTTAGS += -erroff=E_CONST_PROMOTED_LONG_LONG
188LENIENT_LINTTAGS += -erroff=E_CONST_TRUNCATED_BY_ASSIGN
189LENIENT_LINTTAGS += -erroff=E_PASS_INT_FROM_BIG_CONST
190LENIENT_LINTTAGS += -erroff=E_COMP_INT_WITH_LARGE_INT
191LENIENT_LINTTAGS += -erroff=E_ASSIGN_UINT_TO_SIGNED_INT
192# These are still noisy but a bit more useful.
193# They shouldn't be used on new code.
194LENIENT_LINTTAGS += -erroff=E_PASS_INT_TO_SMALL_INT
195LENIENT_LINTTAGS += -erroff=E_PTR_CONV_LOSES_BITS
196
197# comment out next line to turn on pedantic 64-bit error checking
198LINTTAGS_64	+= $(LENIENT_LINTTAGS)
199
200LENIENT_i386_LINTTAGS	=
201
202LENIENT_amd64_LINTTAGS	=
203LENIENT_amd64_LINTTAGS	+= -erroff=E_BAD_PRAGMA_PACK_VALUE
204LENIENT_amd64_LINTTAGS	+= -erroff=E_SHIFT_CNT_NEG_TOO_BIG_L
205LENIENT_amd64_LINTTAGS	+= -erroff=E_CONST_PROMOTED_UNSIGNED_LL
206LENIENT_amd64_LINTTAGS	+= -erroff=E_CONST_PROMOTED_LONG_LONG
207
208LINTFLAGS_sparc_32	= $(LINTCCMODE) -nsxmuF -errtags=yes
209LINTFLAGS_sparc_64	= $(LINTFLAGS_sparc_32) -Xarch=v9
210LINTFLAGS_i386_32	= $(LINTCCMODE) -nsxmuF -errtags=yes
211LINTFLAGS_i386_64	= $(LINTFLAGS_i386_32) -Xarch=amd64
212
213LINTTAGS_sparc_32	= $(LINTTAGS_32)
214LINTTAGS_sparc_64	= $(LINTTAGS_64)
215LINTTAGS_i386_32	= $(LINTTAGS_32)
216LINTTAGS_i386_64	= $(LINTTAGS_64) $(LENIENT_amd64_LINTTAGS)
217
218LINTFLAGS	= $(LINTFLAGS_$(MACH)_$(CLASS)) $(LINTTAGS_$(MACH)_$(CLASS))
219LINTFLAGS	+= $(C99LMODE)
220
221#
222#	Override this variable to modify the name of the lint target.
223#
224LINT_MODULE=	$(MODULE)
225
226#
227#	Build the compile/assemble lines:
228#
229EXTRA_OPTIONS		=
230AS_DEFS			= -D_ASM -D__STDC__=0
231
232ALWAYS_DEFS_32		= -D_KERNEL -D_SYSCALL32
233ALWAYS_DEFS_64		= -D_KERNEL -D_SYSCALL32 -D_SYSCALL32_IMPL -D_ELF64
234#
235# XX64	This should be defined by the compiler!
236#
237ALWAYS_DEFS_64		+= -Dsun -D__sun -D__SVR4
238ALWAYS_DEFS		= $(ALWAYS_DEFS_$(CLASS))
239
240#
241#	CPPFLAGS is deliberatly set with a "=" and not a "+=".  For the kernel
242#	the header include path should not look for header files outside of
243#	the kernel code.  This "=" removes the search path built in
244#	Makefile.master inside CPPFLAGS.  Ditto for AS_CPPFLAGS.
245#
246CPPFLAGS	= $(ALWAYS_DEFS) $(ALL_DEFS) $(CONFIG_DEFS) \
247		   $(INCLUDE_PATH) $(EXTRA_OPTIONS)
248ASFLAGS		+= -P
249AS_CPPFLAGS	= $(ALWAYS_DEFS) $(ALL_DEFS) $(CONFIG_DEFS) $(AS_DEFS) \
250		   $(AS_INC_PATH) $(EXTRA_OPTIONS)
251
252#
253#	Make it (relatively) easy to share compilation options between
254#	all kernel implementations.
255#
256
257#
258# XX64	Compiling with -xc99=%all on build 55 merge makes the
259#	kmem_alloc double map parts of the kernel data causing
260#	horrible overwriting and forces a hardware reset in
261#	segkp_create().  Until the origin of this problem can
262#	be tracked down (i.e. is it a deliberate C89 -> C99 semantic
263#	change for which the kernel needs repair, or is it just a
264#	bug in the x86 compiler?) disabling C99 for kernel compilation
265#	when using the Devpro compiler
266#
267i386_C99MODE		= $(C99_DISABLE)
268$(__GNUC)i386_C99MODE	= $(C99_ENABLE)
269sparc_C99MODE		= $(C99_DISABLE)
270C99MODE			= $($(MACH)_C99MODE)
271
272CFLAGS_uts		=
273CFLAGS_uts		+= $(STAND_FLAGS_$(CLASS))
274CFLAGS_uts		+= $(CCVERBOSE)
275CFLAGS_uts		+= $(ILDOFF)
276CFLAGS_uts		+= $(XAOPT)
277CFLAGS_uts		+= $(CTF_FLAGS)
278CFLAGS_uts		+= $(CERRWARN)
279CFLAGS_uts		+= $(C99MODE)
280CFLAGS_uts		+= $(EXTRA_CFLAGS)
281
282#
283#	Declare that $(OBJECTS) and $(LINTS) can be compiled in parallel.
284#	The DUMMY target is for those instances where OBJECTS and LINTS
285#	are empty (to avoid an unconditional .PARALLEL).
286.PARALLEL:	$(OBJECTS) $(LINTS) DUMMY
287
288#
289#	Expanded dependencies
290#
291DEF_DEPS	= $(DEF_BUILDS:%=def.%)
292ALL_DEPS	= $(ALL_BUILDS:%=all.%)
293CLEAN_DEPS	= $(ALL_BUILDS:%=clean.%)
294CLOBBER_DEPS	= $(ALL_BUILDS:%=clobber.%)
295LINT_DEPS	= $(DEF_BUILDS:%=lint.%)
296MODLINTLIB_DEPS	= $(DEF_BUILDS:%=modlintlib.%)
297CLEAN_LINT_DEPS	= $(ALL_BUILDS:%=clean.lint.%)
298INSTALL_DEPS	= $(DEF_BUILDS:%=install.%)
299SYM_DEPS	= $(SYM_BUILDS:%=symcheck.%)
300
301#
302#	Default module name
303#
304BINARY		= $(OBJS_DIR)/$(MODULE)
305
306#
307#	Default cleanup definitions
308#
309CLEANLINTFILES	= $(LINTS) $(MOD_LINT_LIB)
310CLEANFILES	= $(OBJECTS) $(CLEANLINTFILES)
311CLOBBERFILES	= $(BINARY) $(CLEANFILES)
312
313#
314#	Installation constants:
315#
316#		FILEMODE is the mode given to the kernel modules
317#		CFILEMODE is the mode given to the '.conf' files
318#
319FILEMODE	 = 755
320DIRMODE		 = 755
321OWNER		 = root
322GROUP		 = sys
323CFILEMODE	 = 644
324
325#
326#	Special Installation Macros for the installation of '.conf' files.
327#
328#	These are unique because they are not installed from the current
329#	working directory.
330#
331# Sigh.  Apparently at some time in the past there was a confusion on
332# whether the name is SRC_CONFFILE or SRC_CONFILE.  Consistency with the
333# other names would indicate SRC_CONFFILE, but the voting is >180 Makefiles
334# with SRC_CONFILE and about 11 with SRC_CONFFILE.  Software development
335# isn't a popularity contest, though, and so my inclination is to define
336# both names for now and incrementally convert to SRC_CONFFILE to be consistent
337# with the other names.
338#
339CONFFILE		= $(MODULE).conf
340SRC_CONFFILE		= $(CONF_SRCDIR)/$(CONFFILE)
341SRC_CONFILE		= $(SRC_CONFFILE)
342ROOT_CONFFILE_32	= $(ROOTMODULE).conf
343ROOT_CONFFILE_64	= $(ROOTMODULE:%/$(SUBDIR64)/$(MODULE)=%/$(MODULE)).conf
344ROOT_CONFFILE		= $(ROOT_CONFFILE_$(CLASS))
345
346
347INS.conffile= \
348	$(RM) $@; $(INS) -s -m $(CFILEMODE) -f $(@D) $(SRC_CONFFILE)
349$(CH)INS.conffile= \
350    $(INS) -s -m $(CFILEMODE) -u $(OWNER) -g $(GROUP) -f $(@D) $(SRC_CONFFILE)
351
352#
353# The CTF merge of child kernel modules is performed against one of the genunix
354# modules.  For Intel builds, all modules will be used with a single genunix:
355# the one built in intel/genunix.  For SPARC builds, a given
356# module may be
357# used with one of a number of genunix files, depending on what platform the
358# module is deployed on.  We merge against the sun4u genunix to optimize for
359# the common case.  We also merge against the ip driver since networking is
360# typically loaded and types defined therein are shared between many modules.
361#
362CTFMERGE_GUDIR_sparc	= sun4u
363CTFMERGE_GUDIR_i386	= intel
364CTFMERGE_GUDIR		= $(CTFMERGE_GUDIR_$(MACH))
365
366CTFMERGE_GENUNIX 	= \
367	$(UTSBASE)/$(CTFMERGE_GUDIR)/genunix/$(OBJS_DIR)/genunix
368
369#
370# Used to uniquify a non-genunix module against genunix.  If used in patch
371# mode (PATCH_BUILD != "#"), the patch ID corresponding to the module being
372# built will be used as the label.  If no ID is available, or if patch mode
373# is not being used, the value of $VERSION will be used.
374#
375CTFMERGE_UNIQUIFY_AGAINST_GENUNIX	= \
376	@label="-L VERSION" ; \
377	if [ -z "$(PATCH_BUILD)" ] ; then \
378		uniq="-D BASE" ; \
379		set -- `$(CTFFINDMOD) -n -r -t $(PMTMO_FILE) $@` ; \
380		if [ "X$$1" != "X-" ] ; then \
381			label="-l $$1" ; \
382			if [ "$$2" != "fcs" ] ; then \
383				uniq="-D $$2" ; \
384			fi ; \
385		fi ; \
386	fi ; \
387	mergecmd="$(CTFMERGE) $(CTFMRGFLAGS)" ; \
388	cmd="$$mergecmd $$label -d $(CTFMERGE_GENUNIX) $$uniq -o $@" ; \
389	echo $$cmd "$(OBJECTS) $(CTFEXTRAOBJS)" ; \
390	$$cmd $(OBJECTS) $(CTFEXTRAOBJS)
391
392#
393# Used to merge the genunix module.  genunix has special requirements in
394# patch mode.  In particular, it needs to be able to find the genunix used
395# in the previous version of the KU patch (or the FCS version of genunix in
396# the case of KU 1).
397#
398CTFMERGE_GENUNIX_MERGE		= \
399	@if [ -z "$(PATCH_BUILD)" ] ; then \
400		set -- `$(CTFFINDMOD) -b $(OBJS_DIR) -o patch,lastgu -n -r \
401		    -t $(PMTMO_FILE) $(GENUNIX) || true` '' ; \
402		msg= ; \
403		if [ $$$(POUND_SIGN) -eq 1 ] ; \
404		    then msg="Error in $(CTFFINDMOD)" ; \
405		elif [ "X$$1" = "X-" ] ; then msg="Did not get label" ; \
406		elif [ "X$$2" = "X-" ] ; then msg="Did not get withfile" ; \
407		fi ; \
408		if [ -n "$$msg" ] ; then \
409			echo "make ctf: $$msg - removing $(GENUNIX)" ; \
410			$(RM) $(GENUNIX) ; \
411			exit 1 ; \
412		fi ; \
413		label="-l $$1" ; \
414		with="-w $$2" ; \
415	else \
416		label="-L VERSION" ; \
417	fi ; \
418	cmd="$(CTFMERGE) $(CTFMRGFLAGS) $$label $$with -o $@" ; \
419	echo $$cmd "$(OBJECTS) $(CTFEXTRAOBJS) $(IPCTF_TARGET)"; \
420	$$cmd $(OBJECTS) $(CTFEXTRAOBJS) $(IPCTF_TARGET)
421
422#
423# Used to copy CTF data from the sun4u genunix to the sun4m genunix.  While
424# we may lose some genunix-specific sun4m-only data, there really isn't any
425# other way, since individual ctfmerges on the sun4u and sun4m genunix
426# modules will result in differing type indices for the same types, and we
427# can't uniquify a given non-genunix module against two genunix modules.
428#
429CTFMERGE_COPY_CTF_DATA		= \
430	@if [ -f $(CTFMERGE_GENUNIX) ] ; then \
431		cmd="$(CTFMERGE) $(CTFMRGFLAGS) -c $(CTFMERGE_GENUNIX) $@" ; \
432		echo $$cmd ; \
433		$$cmd ; \
434	else \
435		echo "WARNING: $(CTFMERGE_GENUNIX) not built. " \
436		    "CTF data will be incomplete" ; \
437	fi
438
439#
440# We ctfmerge the ip objects into genunix to maximize the number of common types
441# found there, thus maximizing the effectiveness of uniquification.  We don't
442# want the genunix build to have to know about the individual ip objects, so we
443# put them in an archive.  The genunix ctfmerge then includes this archive.
444#
445IPCTF			= $(IPDRV_DIR)/$(OBJS_DIR)/ipctf.a
446
447#
448# Rule for building fake shared libraries used for symbol resolution
449# when building other modules.  -znoreloc is needed here to avoid
450# tripping over code that isn't really suitable for shared libraries.
451#
452BUILD.SO		= \
453	$(LD) -o $@ $(GSHARED) $(ZNORELOC) -h $(SONAME)
454
455#
456# SONAME defaults for common fake shared libraries.
457#
458$(LIBGEN)		:= SONAME = $(MODULE)
459$(PLATLIB)		:= SONAME = misc/platmod
460$(CPULIB)		:= SONAME = 'cpu/$$CPU'
461$(DTRACESTUBS)		:= SONAME = dtracestubs
462
463#
464#	Installation directories
465#
466
467#
468#	For now, 64b modules install into a subdirectory
469#	of their 32b brethren.
470#
471SUBDIR64_sparc		= sparcv9
472SUBDIR64_i386		= amd64
473SUBDIR64		= $(SUBDIR64_$(MACH))
474
475ROOT_MOD_DIR		= $(ROOT)/kernel
476
477ROOT_KERN_DIR_32	= $(ROOT_MOD_DIR)
478ROOT_DRV_DIR_32		= $(ROOT_MOD_DIR)/drv
479ROOT_DTRACE_DIR_32	= $(ROOT_MOD_DIR)/dtrace
480ROOT_EXEC_DIR_32	= $(ROOT_MOD_DIR)/exec
481ROOT_FS_DIR_32		= $(ROOT_MOD_DIR)/fs
482ROOT_SCHED_DIR_32	= $(ROOT_MOD_DIR)/sched
483ROOT_STRMOD_DIR_32	= $(ROOT_MOD_DIR)/strmod
484ROOT_IPP_DIR_32		= $(ROOT_MOD_DIR)/ipp
485ROOT_SYS_DIR_32		= $(ROOT_MOD_DIR)/sys
486ROOT_MISC_DIR_32	= $(ROOT_MOD_DIR)/misc
487ROOT_KGSS_DIR_32	= $(ROOT_MOD_DIR)/misc/kgss
488ROOT_NLMISC_DIR_32	= $(ROOT_MOD_DIR)/misc
489ROOT_MACH_DIR_32	= $(ROOT_MOD_DIR)/mach
490ROOT_CPU_DIR_32		= $(ROOT_MOD_DIR)/cpu
491ROOT_TOD_DIR_32		= $(ROOT_MOD_DIR)/tod
492ROOT_FONT_DIR_32	= $(ROOT_MOD_DIR)/fonts
493ROOT_DACF_DIR_32	= $(ROOT_MOD_DIR)/dacf
494ROOT_CRYPTO_DIR_32	= $(ROOT_MOD_DIR)/crypto
495
496ROOT_KERN_DIR_64	= $(ROOT_MOD_DIR)/$(SUBDIR64)
497ROOT_DRV_DIR_64		= $(ROOT_MOD_DIR)/drv/$(SUBDIR64)
498ROOT_DTRACE_DIR_64	= $(ROOT_MOD_DIR)/dtrace/$(SUBDIR64)
499ROOT_EXEC_DIR_64	= $(ROOT_MOD_DIR)/exec/$(SUBDIR64)
500ROOT_FS_DIR_64		= $(ROOT_MOD_DIR)/fs/$(SUBDIR64)
501ROOT_SCHED_DIR_64	= $(ROOT_MOD_DIR)/sched/$(SUBDIR64)
502ROOT_STRMOD_DIR_64	= $(ROOT_MOD_DIR)/strmod/$(SUBDIR64)
503ROOT_IPP_DIR_64		= $(ROOT_MOD_DIR)/ipp/$(SUBDIR64)
504ROOT_SYS_DIR_64		= $(ROOT_MOD_DIR)/sys/$(SUBDIR64)
505ROOT_MISC_DIR_64	= $(ROOT_MOD_DIR)/misc/$(SUBDIR64)
506ROOT_KGSS_DIR_64	= $(ROOT_MOD_DIR)/misc/kgss/$(SUBDIR64)
507ROOT_NLMISC_DIR_64	= $(ROOT_MOD_DIR)/misc/$(SUBDIR64)
508ROOT_MACH_DIR_64	= $(ROOT_MOD_DIR)/mach/$(SUBDIR64)
509ROOT_CPU_DIR_64		= $(ROOT_MOD_DIR)/cpu/$(SUBDIR64)
510ROOT_TOD_DIR_64		= $(ROOT_MOD_DIR)/tod/$(SUBDIR64)
511ROOT_FONT_DIR_64	= $(ROOT_MOD_DIR)/fonts/$(SUBDIR64)
512ROOT_DACF_DIR_64	= $(ROOT_MOD_DIR)/dacf/$(SUBDIR64)
513ROOT_CRYPTO_DIR_64	= $(ROOT_MOD_DIR)/crypto/$(SUBDIR64)
514
515ROOT_KERN_DIR		= $(ROOT_KERN_DIR_$(CLASS))
516ROOT_DRV_DIR		= $(ROOT_DRV_DIR_$(CLASS))
517ROOT_DTRACE_DIR		= $(ROOT_DTRACE_DIR_$(CLASS))
518ROOT_EXEC_DIR		= $(ROOT_EXEC_DIR_$(CLASS))
519ROOT_FS_DIR		= $(ROOT_FS_DIR_$(CLASS))
520ROOT_SCHED_DIR		= $(ROOT_SCHED_DIR_$(CLASS))
521ROOT_STRMOD_DIR		= $(ROOT_STRMOD_DIR_$(CLASS))
522ROOT_IPP_DIR		= $(ROOT_IPP_DIR_$(CLASS))
523ROOT_SYS_DIR		= $(ROOT_SYS_DIR_$(CLASS))
524ROOT_MISC_DIR		= $(ROOT_MISC_DIR_$(CLASS))
525ROOT_KGSS_DIR		= $(ROOT_KGSS_DIR_$(CLASS))
526ROOT_NLMISC_DIR		= $(ROOT_NLMISC_DIR_$(CLASS))
527ROOT_MACH_DIR		= $(ROOT_MACH_DIR_$(CLASS))
528ROOT_CPU_DIR		= $(ROOT_CPU_DIR_$(CLASS))
529ROOT_TOD_DIR		= $(ROOT_TOD_DIR_$(CLASS))
530ROOT_FONT_DIR		= $(ROOT_FONT_DIR_$(CLASS))
531ROOT_DACF_DIR		= $(ROOT_DACF_DIR_$(CLASS))
532ROOT_CRYPTO_DIR		= $(ROOT_CRYPTO_DIR_$(CLASS))
533
534ROOT_MOD_DIRS_32	= $(ROOT_DRV_DIR_32) $(ROOT_EXEC_DIR_32)
535ROOT_MOD_DIRS_32	+= $(ROOT_DTRACE_DIR_32)
536ROOT_MOD_DIRS_32	+= $(ROOT_FS_DIR_32) $(ROOT_SCHED_DIR_32)
537ROOT_MOD_DIRS_32	+= $(ROOT_STRMOD_DIR_32) $(ROOT_SYS_DIR_32)
538ROOT_MOD_DIRS_32	+= $(ROOT_IPP_DIR_32)
539ROOT_MOD_DIRS_32	+= $(ROOT_MISC_DIR_32) $(ROOT_MACH_DIR_32)
540ROOT_MOD_DIRS_32	+= $(ROOT_KGSS_DIR_32)
541ROOT_MOD_DIRS_32	+= $(ROOT_CPU_DIR_32) $(ROOT_FONT_DIR_32)
542ROOT_MOD_DIRS_32	+= $(ROOT_TOD_DIR_32) $(ROOT_DACF_DIR_32)
543ROOT_MOD_DIRS_32	+= $(ROOT_CRYPTO_DIR_32)
544
545USR_MOD_DIR		= $(ROOT)/usr/kernel
546
547USR_DRV_DIR_32		= $(USR_MOD_DIR)/drv
548USR_EXEC_DIR_32		= $(USR_MOD_DIR)/exec
549USR_FS_DIR_32		= $(USR_MOD_DIR)/fs
550USR_SCHED_DIR_32	= $(USR_MOD_DIR)/sched
551USR_STRMOD_DIR_32	= $(USR_MOD_DIR)/strmod
552USR_SYS_DIR_32		= $(USR_MOD_DIR)/sys
553USR_MISC_DIR_32		= $(USR_MOD_DIR)/misc
554USR_DACF_DIR_32		= $(USR_MOD_DIR)/dacf
555USR_PCBE_DIR_32		= $(USR_MOD_DIR)/pcbe
556
557USR_DRV_DIR_64		= $(USR_MOD_DIR)/drv/$(SUBDIR64)
558USR_EXEC_DIR_64		= $(USR_MOD_DIR)/exec/$(SUBDIR64)
559USR_FS_DIR_64		= $(USR_MOD_DIR)/fs/$(SUBDIR64)
560USR_SCHED_DIR_64	= $(USR_MOD_DIR)/sched/$(SUBDIR64)
561USR_STRMOD_DIR_64	= $(USR_MOD_DIR)/strmod/$(SUBDIR64)
562USR_SYS_DIR_64		= $(USR_MOD_DIR)/sys/$(SUBDIR64)
563USR_MISC_DIR_64		= $(USR_MOD_DIR)/misc/$(SUBDIR64)
564USR_DACF_DIR_64		= $(USR_MOD_DIR)/dacf/$(SUBDIR64)
565USR_PCBE_DIR_64		= $(USR_MOD_DIR)/pcbe/$(SUBDIR64)
566
567USR_DRV_DIR		= $(USR_DRV_DIR_$(CLASS))
568USR_EXEC_DIR		= $(USR_EXEC_DIR_$(CLASS))
569USR_FS_DIR		= $(USR_FS_DIR_$(CLASS))
570USR_SCHED_DIR		= $(USR_SCHED_DIR_$(CLASS))
571USR_STRMOD_DIR		= $(USR_STRMOD_DIR_$(CLASS))
572USR_SYS_DIR		= $(USR_SYS_DIR_$(CLASS))
573USR_MISC_DIR		= $(USR_MISC_DIR_$(CLASS))
574USR_DACF_DIR		= $(USR_DACF_DIR_$(CLASS))
575USR_PCBE_DIR		= $(USR_PCBE_DIR_$(CLASS))
576
577USR_MOD_DIRS_32		= $(USR_DRV_DIR_32) $(USR_EXEC_DIR_32)
578USR_MOD_DIRS_32		+= $(USR_FS_DIR_32) $(USR_SCHED_DIR_32)
579USR_MOD_DIRS_32		+= $(USR_STRMOD_DIR_32) $(USR_SYS_DIR_32)
580USR_MOD_DIRS_32		+= $(USR_MISC_DIR_32) $(USR_DACF_DIR_32)
581USR_MOD_DIRS_32		+= $(USR_PCBE_DIR_32)
582
583#
584#
585#
586include $(SRC)/Makefile.psm
587
588#
589#       Set ownership on links.
590#
591CHOWNLINK=
592$(CH)CHOWNLINK= ; $(CHOWN) $(OWNER) $@
593CHGRPLINK=
594$(CH)CHGRPLINK= ; $(CHGRP) $(GROUP) $@
595
596#
597#	The "-r" on the remove may be considered temporary, but is required
598#	while the replacement of the SUNW,SPARCstation-10,SX directory by
599#	a symbolic link is being propagated.
600#
601INS.slink1= $(RM) -r $@; $(SYMLINK) $(PLATFORM) $@ $(CHOWNLINK) $(CHGRPLINK)
602INS.slink2= $(RM) -r $@; $(SYMLINK) ../$(PLATFORM)/$(@F) $@ $(CHOWNLINK) $(CHGRPLINK)
603INS.slink3= $(RM) -r $@; $(SYMLINK) $(IMPLEMENTED_PLATFORM) $@ $(CHOWNLINK) $(CHGRPLINK)
604INS.slink4= $(RM) -r $@; $(SYMLINK) ../$(PLATFORM)/include $@ $(CHOWNLINK) $(CHGRPLINK)
605INS.slink5= $(RM) -r $@; $(SYMLINK) ../$(PLATFORM)/sbin $@ $(CHOWNLINK) $(CHGRPLINK)
606INS.slink6= $(RM) -r $@; $(SYMLINK) ../../$(PLATFORM)/lib/$(MODULE) $@ $(CHOWNLINK) $(CHGRPLINK)
607
608ROOT_PLAT_LINKS		 = $(PLAT_LINKS:%=$(ROOT_PLAT_DIR)/%)
609ROOT_PLAT_LINKS_2	 = $(PLAT_LINKS_2:%=$(ROOT_PLAT_DIR)/%)
610USR_PLAT_LINKS		 = $(PLAT_LINKS:%=$(USR_PLAT_DIR)/%)
611USR_PLAT_LINKS_2	 = $(PLAT_LINKS_2:%=$(USR_PLAT_DIR)/%)
612
613#
614#	Collection of all relevant, delivered kernel modules.
615#
616KMODS	= $(DRV_KMODS) $(EXEC_KMODS) $(FS_KMODS) $(SCHED_KMODS) $(TOD_KMODS) \
617	  $(STRMOD_KMODS) $(SYS_KMODS) $(MISC_KMODS) $(NLMISC_KMODS) \
618	  $(MACH_KMODS) $(CPU_KMODS) $(GENUNIX_KMODS) \
619	  $(GSS_KMODS) $(MMU_KMODS) $(DACF_KMODS) $(EXPORT_KMODS) \
620	  $(IPP_KMODS) $(CRYPTO_KMODS) $(CRYPTO_EK_KMODS) $(PCBE_KMODS) \
621	  $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS))
622
623LINT_KMODS = $(DRV_KMODS) $(EXEC_KMODS) $(FS_KMODS) $(SCHED_KMODS) \
624	  $(TOD_KMODS) $(STRMOD_KMODS) $(SYS_KMODS) $(MISC_KMODS) \
625	  $(MACH_KMODS) $(GSS_KMODS) $(DACF_KMODS) $(IPP_KMODS) \
626	  $(CRYPTO_KMODS) $(PCBE_KMODS) \
627	  $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS))
628
629THIS_YEAR:sh=	/bin/date +%Y
630$(OBJS_DIR)/logsubr.o	:= CPPFLAGS += -DTHIS_YEAR=$(THIS_YEAR)
631$(OBJS_DIR)/logsubr.ln	:= CPPFLAGS += -DTHIS_YEAR=$(THIS_YEAR)
632
633#
634#	Files to be compiled with -xa, to generate basic block execution
635#	count data.
636#
637#	There are several ways to compile parts of the kernel for kcov:
638#               1)  Add targets to BB_FILES here or in other Makefiles
639#                       (they must in the form of $(OBJS_DIR)/target.o)
640#               2)  setenv BB_FILES '$(XXX_OBJS:%=$(OBJS_DIR)/%)'
641#               3)  setenv BB_FILES '$(OBJECTS)'
642#
643#       Do NOT setenv CFLAGS -xa, as that will cause infinite recursion
644#       in unix_bb.o
645#
646BB_FILES =
647$(BB_FILES)	:= XAOPT = -xa
648
649#
650#	The idea here is for unix_bb.o to be in all kernels except the
651#	kernel which actually gets shipped to customers.  In practice,
652#	$(RELEASE_BUILD) is on for a number of the late beta and fcs builds.
653#
654CODE_COVERAGE=
655$(RELEASE_BUILD)CODE_COVERAGE:sh=	echo \\043
656$(CODE_COVERAGE)$(OBJS_DIR)/unix_bb.o   := CPPFLAGS     += -DKCOV
657$(CODE_COVERAGE)$(OBJS_DIR)/unix_bb.ln  := CPPFLAGS     += -DKCOV
658
659#
660#	Do not let unix_bb.o get compiled with -xa!
661#
662$(OBJS_DIR)/unix_bb.o	:= XAOPT =
663
664#
665#	MPSAS support
666#
667MPSAS_BUILD:sh=		echo \\043
668#
669# Privilege files
670#
671PRIVS_AWK = $(SRC)/uts/common/os/privs.awk
672PRIVS_DEF = $(SRC)/uts/common/os/priv_defs
673