xref: /titanic_50/usr/src/uts/Makefile.uts (revision 9d3d2ed09c8e9ba0b2ba44fdd1dd300b2c3f9e8e)
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
154# Note: egrep returns "failure" if there are no matches, which is
155# exactly the opposite of what we need.
156LGREP.2 =	if egrep -v ' (_init|_fini|_info|_depends_on) '; then false; else true; fi
157
158LTAIL =	)
159
160LINT.c =	$(LINT) -c -dirout=$(LINTS_DIR) $(LINTFLAGS) $(LINT_DEFS) $(CPPFLAGS)
161
162LINTTAGS_32	=
163LINTTAGS_32	+= -erroff=E_BAD_PTR_CAST_ALIGN
164LINTTAGS_32	+= -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
165LINTTAGS_32	+= -erroff=E_SUSPICIOUS_COMPARISON
166LINTTAGS_32	+= -erroff=E_INVALID_ANNOTATION_NAME
167LINTTAGS_32	+= -erroff=E_STATIC_UNUSED
168LINTTAGS_32	+= -erroff=E_PTRDIFF_OVERFLOW
169LINTTAGS_32	+= -erroff=E_ASSIGN_NARROW_CONV
170
171LINTTAGS_64	= $(LINTTAGS_32)
172
173# Selectively disable certain noisy lint errors
174LENIENT_LINTTAGS =
175LENIENT_LINTTAGS += -erroff=E_CONST_TRUNCATED_BY_ASSIGN
176
177# comment out next line to turn on pedantic 64-bit error checking
178LINTTAGS_64	+= $(LENIENT_LINTTAGS)
179
180LINTFLAGS_sparc_32	= $(LINTCCMODE) -nsxmuF -errtags=yes
181LINTFLAGS_sparc_64	= $(LINTFLAGS_sparc_32) -Xarch=v9
182LINTFLAGS_i386_32	= $(LINTCCMODE) -nsxmuF -errtags=yes
183LINTFLAGS_i386_64	= $(LINTFLAGS_i386_32) -Xarch=amd64
184
185LINTTAGS_sparc_32	= $(LINTTAGS_32)
186LINTTAGS_sparc_64	= $(LINTTAGS_64)
187LINTTAGS_i386_32	= $(LINTTAGS_32)
188LINTTAGS_i386_64	= $(LINTTAGS_64)
189
190LINTFLAGS	= $(LINTFLAGS_$(MACH)_$(CLASS)) $(LINTTAGS_$(MACH)_$(CLASS))
191LINTFLAGS	+= $(C99LMODE)
192
193#
194#	Override this variable to modify the name of the lint target.
195#
196LINT_MODULE=	$(MODULE)
197
198#
199#	Build the compile/assemble lines:
200#
201EXTRA_OPTIONS		=
202AS_DEFS			= -D_ASM -D__STDC__=0
203
204ALWAYS_DEFS_32		= -D_KERNEL -D_SYSCALL32
205ALWAYS_DEFS_64		= -D_KERNEL -D_SYSCALL32 -D_SYSCALL32_IMPL -D_ELF64
206#
207# XX64	This should be defined by the compiler!
208#
209ALWAYS_DEFS_64		+= -Dsun -D__sun -D__SVR4
210ALWAYS_DEFS		= $(ALWAYS_DEFS_$(CLASS))
211
212#
213#	CPPFLAGS is deliberatly set with a "=" and not a "+=".  For the kernel
214#	the header include path should not look for header files outside of
215#	the kernel code.  This "=" removes the search path built in
216#	Makefile.master inside CPPFLAGS.  Ditto for AS_CPPFLAGS.
217#
218CPPFLAGS	= $(ALWAYS_DEFS) $(ALL_DEFS) $(CONFIG_DEFS) \
219		   $(INCLUDE_PATH) $(EXTRA_OPTIONS)
220ASFLAGS		+= -P
221AS_CPPFLAGS	= $(ALWAYS_DEFS) $(ALL_DEFS) $(CONFIG_DEFS) $(AS_DEFS) \
222		   $(AS_INC_PATH) $(EXTRA_OPTIONS)
223
224#
225#	Make it (relatively) easy to share compilation options between
226#	all kernel implementations.
227#
228
229#
230# XX64	Compiling with -xc99=%all on build 55 merge makes the
231#	kmem_alloc double map parts of the kernel data causing
232#	horrible overwriting and forces a hardware reset in
233#	segkp_create().  Until the origin of this problem can
234#	be tracked down (i.e. is it a deliberate C89 -> C99 semantic
235#	change for which the kernel needs repair, or is it just a
236#	bug in the x86 compiler?) disabling C99 for kernel compilation
237#	when using the Devpro compiler
238#
239i386_C99MODE		= $(C99_DISABLE)
240$(__GNUC)i386_C99MODE	= $(C99_ENABLE)
241sparc_C99MODE		= $(C99_DISABLE)
242C99MODE			= $($(MACH)_C99MODE)
243
244# Override the default, the kernel is squeaky clean
245CERRWARN = -errtags=yes -errwarn=%all
246
247CFLAGS_uts		=
248CFLAGS_uts		+= $(STAND_FLAGS_$(CLASS))
249CFLAGS_uts		+= $(CCVERBOSE)
250CFLAGS_uts		+= $(ILDOFF)
251CFLAGS_uts		+= $(XAOPT)
252CFLAGS_uts		+= $(CTF_FLAGS)
253CFLAGS_uts		+= $(CERRWARN)
254CFLAGS_uts		+= $(C99MODE)
255CFLAGS_uts		+= $(EXTRA_CFLAGS)
256
257#
258#	Declare that $(OBJECTS) and $(LINTS) can be compiled in parallel.
259#	The DUMMY target is for those instances where OBJECTS and LINTS
260#	are empty (to avoid an unconditional .PARALLEL).
261.PARALLEL:	$(OBJECTS) $(LINTS) DUMMY
262
263#
264#	Expanded dependencies
265#
266DEF_DEPS	= $(DEF_BUILDS:%=def.%)
267ALL_DEPS	= $(ALL_BUILDS:%=all.%)
268CLEAN_DEPS	= $(ALL_BUILDS:%=clean.%)
269CLOBBER_DEPS	= $(ALL_BUILDS:%=clobber.%)
270LINT_DEPS	= $(DEF_BUILDS:%=lint.%)
271MODLINTLIB_DEPS	= $(DEF_BUILDS:%=modlintlib.%)
272CLEAN_LINT_DEPS	= $(ALL_BUILDS:%=clean.lint.%)
273INSTALL_DEPS	= $(DEF_BUILDS:%=install.%)
274SYM_DEPS	= $(SYM_BUILDS:%=symcheck.%)
275
276#
277#	Default module name
278#
279BINARY		= $(OBJS_DIR)/$(MODULE)
280
281#
282#	Default cleanup definitions
283#
284CLEANLINTFILES	= $(LINTS) $(MOD_LINT_LIB)
285CLEANFILES	= $(OBJECTS) $(CLEANLINTFILES)
286CLOBBERFILES	= $(BINARY) $(CLEANFILES)
287
288#
289#	Installation constants:
290#
291#		FILEMODE is the mode given to the kernel modules
292#		CFILEMODE is the mode given to the '.conf' files
293#
294FILEMODE	 = 755
295DIRMODE		 = 755
296OWNER		 = root
297GROUP		 = sys
298CFILEMODE	 = 644
299
300#
301#	Special Installation Macros for the installation of '.conf' files.
302#
303#	These are unique because they are not installed from the current
304#	working directory.
305#
306# Sigh.  Apparently at some time in the past there was a confusion on
307# whether the name is SRC_CONFFILE or SRC_CONFILE.  Consistency with the
308# other names would indicate SRC_CONFFILE, but the voting is >180 Makefiles
309# with SRC_CONFILE and about 11 with SRC_CONFFILE.  Software development
310# isn't a popularity contest, though, and so my inclination is to define
311# both names for now and incrementally convert to SRC_CONFFILE to be consistent
312# with the other names.
313#
314CONFFILE		= $(MODULE).conf
315SRC_CONFFILE		= $(CONF_SRCDIR)/$(CONFFILE)
316SRC_CONFILE		= $(SRC_CONFFILE)
317ROOT_CONFFILE_32	= $(ROOTMODULE).conf
318ROOT_CONFFILE_64	= $(ROOTMODULE:%/$(SUBDIR64)/$(MODULE)=%/$(MODULE)).conf
319ROOT_CONFFILE		= $(ROOT_CONFFILE_$(CLASS))
320
321
322INS.conffile= \
323	$(RM) $@; $(INS) -s -m $(CFILEMODE) -f $(@D) $(SRC_CONFFILE)
324$(CH)INS.conffile= \
325    $(INS) -s -m $(CFILEMODE) -u $(OWNER) -g $(GROUP) -f $(@D) $(SRC_CONFFILE)
326
327#
328# The CTF merge of child kernel modules is performed against one of the genunix
329# modules.  For Intel builds, all modules will be used with a single genunix:
330# the one built in intel/genunix.  For SPARC builds, a given
331# module may be
332# used with one of a number of genunix files, depending on what platform the
333# module is deployed on.  We merge against the sun4u genunix to optimize for
334# the common case.  We also merge against the ip driver since networking is
335# typically loaded and types defined therein are shared between many modules.
336#
337CTFMERGE_GUDIR_sparc	= sun4u
338CTFMERGE_GUDIR_i386	= intel
339CTFMERGE_GUDIR		= $(CTFMERGE_GUDIR_$(MACH))
340
341CTFMERGE_GENUNIX 	= \
342	$(UTSBASE)/$(CTFMERGE_GUDIR)/genunix/$(OBJS_DIR)/genunix
343
344#
345# Used to uniquify a non-genunix module against genunix.  If used in patch
346# mode (PATCH_BUILD != "#"), the patch ID corresponding to the module being
347# built will be used as the label.  If no ID is available, or if patch mode
348# is not being used, the value of $VERSION will be used.
349#
350CTFMERGE_UNIQUIFY_AGAINST_GENUNIX	= \
351	@label="-L VERSION" ; \
352	if [ -z "$(PATCH_BUILD)" ] ; then \
353		uniq="-D BASE" ; \
354		set -- `$(CTFFINDMOD) -n -r -t $(PMTMO_FILE) $@` ; \
355		if [ "X$$1" != "X-" ] ; then \
356			label="-l $$1" ; \
357			if [ "$$2" != "fcs" ] ; then \
358				uniq="-D $$2" ; \
359			fi ; \
360		fi ; \
361	fi ; \
362	mergecmd="$(CTFMERGE) $(CTFMRGFLAGS)" ; \
363	cmd="$$mergecmd $$label -d $(CTFMERGE_GENUNIX) $$uniq -o $@" ; \
364	echo $$cmd "$(OBJECTS) $(CTFEXTRAOBJS)" ; \
365	$$cmd $(OBJECTS) $(CTFEXTRAOBJS)
366
367#
368# Used to merge the genunix module.  genunix has special requirements in
369# patch mode.  In particular, it needs to be able to find the genunix used
370# in the previous version of the KU patch (or the FCS version of genunix in
371# the case of KU 1).
372#
373CTFMERGE_GENUNIX_MERGE		= \
374	@if [ -z "$(PATCH_BUILD)" ] ; then \
375		set -- `$(CTFFINDMOD) -b $(OBJS_DIR) -o patch,lastgu -n -r \
376		    -t $(PMTMO_FILE) $(GENUNIX) || true` '' ; \
377		msg= ; \
378		if [ $$$(POUND_SIGN) -eq 1 ] ; \
379		    then msg="Error in $(CTFFINDMOD)" ; \
380		elif [ "X$$1" = "X-" ] ; then msg="Did not get label" ; \
381		elif [ "X$$2" = "X-" ] ; then msg="Did not get withfile" ; \
382		fi ; \
383		if [ -n "$$msg" ] ; then \
384			echo "make ctf: $$msg - removing $(GENUNIX)" ; \
385			$(RM) $(GENUNIX) ; \
386			exit 1 ; \
387		fi ; \
388		label="-l $$1" ; \
389		with="-w $$2" ; \
390	else \
391		label="-L VERSION" ; \
392	fi ; \
393	cmd="$(CTFMERGE) $(CTFMRGFLAGS) $$label $$with -o $@" ; \
394	echo $$cmd "$(OBJECTS) $(CTFEXTRAOBJS) $(IPCTF_TARGET)"; \
395	$$cmd $(OBJECTS) $(CTFEXTRAOBJS) $(IPCTF_TARGET)
396
397#
398# Used to copy CTF data from the sun4u genunix to the sun4m genunix.  While
399# we may lose some genunix-specific sun4m-only data, there really isn't any
400# other way, since individual ctfmerges on the sun4u and sun4m genunix
401# modules will result in differing type indices for the same types, and we
402# can't uniquify a given non-genunix module against two genunix modules.
403#
404CTFMERGE_COPY_CTF_DATA		= \
405	@if [ -f $(CTFMERGE_GENUNIX) ] ; then \
406		cmd="$(CTFMERGE) $(CTFMRGFLAGS) -c $(CTFMERGE_GENUNIX) $@" ; \
407		echo $$cmd ; \
408		$$cmd ; \
409	else \
410		echo "WARNING: $(CTFMERGE_GENUNIX) not built. " \
411		    "CTF data will be incomplete" ; \
412	fi
413
414#
415# We ctfmerge the ip objects into genunix to maximize the number of common types
416# found there, thus maximizing the effectiveness of uniquification.  We don't
417# want the genunix build to have to know about the individual ip objects, so we
418# put them in an archive.  The genunix ctfmerge then includes this archive.
419#
420IPCTF			= $(IPDRV_DIR)/$(OBJS_DIR)/ipctf.a
421
422#
423# Rule for building fake shared libraries used for symbol resolution
424# when building other modules.  -znoreloc is needed here to avoid
425# tripping over code that isn't really suitable for shared libraries.
426#
427BUILD.SO		= \
428	$(LD) -o $@ $(GSHARED) $(ZNORELOC) -h $(SONAME)
429
430#
431# SONAME defaults for common fake shared libraries.
432#
433$(LIBGEN)		:= SONAME = $(MODULE)
434$(PLATLIB)		:= SONAME = misc/platmod
435$(CPULIB)		:= SONAME = 'cpu/$$CPU'
436$(DTRACESTUBS)		:= SONAME = dtracestubs
437
438#
439#	Installation directories
440#
441
442#
443#	For now, 64b modules install into a subdirectory
444#	of their 32b brethren.
445#
446SUBDIR64_sparc		= sparcv9
447SUBDIR64_i386		= amd64
448SUBDIR64		= $(SUBDIR64_$(MACH))
449
450ROOT_MOD_DIR		= $(ROOT)/kernel
451
452ROOT_KERN_DIR_32	= $(ROOT_MOD_DIR)
453ROOT_DRV_DIR_32		= $(ROOT_MOD_DIR)/drv
454ROOT_DTRACE_DIR_32	= $(ROOT_MOD_DIR)/dtrace
455ROOT_EXEC_DIR_32	= $(ROOT_MOD_DIR)/exec
456ROOT_FS_DIR_32		= $(ROOT_MOD_DIR)/fs
457ROOT_SCHED_DIR_32	= $(ROOT_MOD_DIR)/sched
458ROOT_STRMOD_DIR_32	= $(ROOT_MOD_DIR)/strmod
459ROOT_IPP_DIR_32		= $(ROOT_MOD_DIR)/ipp
460ROOT_SYS_DIR_32		= $(ROOT_MOD_DIR)/sys
461ROOT_MISC_DIR_32	= $(ROOT_MOD_DIR)/misc
462ROOT_KGSS_DIR_32	= $(ROOT_MOD_DIR)/misc/kgss
463ROOT_NLMISC_DIR_32	= $(ROOT_MOD_DIR)/misc
464ROOT_MACH_DIR_32	= $(ROOT_MOD_DIR)/mach
465ROOT_CPU_DIR_32		= $(ROOT_MOD_DIR)/cpu
466ROOT_TOD_DIR_32		= $(ROOT_MOD_DIR)/tod
467ROOT_FONT_DIR_32	= $(ROOT_MOD_DIR)/fonts
468ROOT_DACF_DIR_32	= $(ROOT_MOD_DIR)/dacf
469ROOT_CRYPTO_DIR_32	= $(ROOT_MOD_DIR)/crypto
470
471ROOT_KERN_DIR_64	= $(ROOT_MOD_DIR)/$(SUBDIR64)
472ROOT_DRV_DIR_64		= $(ROOT_MOD_DIR)/drv/$(SUBDIR64)
473ROOT_DTRACE_DIR_64	= $(ROOT_MOD_DIR)/dtrace/$(SUBDIR64)
474ROOT_EXEC_DIR_64	= $(ROOT_MOD_DIR)/exec/$(SUBDIR64)
475ROOT_FS_DIR_64		= $(ROOT_MOD_DIR)/fs/$(SUBDIR64)
476ROOT_SCHED_DIR_64	= $(ROOT_MOD_DIR)/sched/$(SUBDIR64)
477ROOT_STRMOD_DIR_64	= $(ROOT_MOD_DIR)/strmod/$(SUBDIR64)
478ROOT_IPP_DIR_64		= $(ROOT_MOD_DIR)/ipp/$(SUBDIR64)
479ROOT_SYS_DIR_64		= $(ROOT_MOD_DIR)/sys/$(SUBDIR64)
480ROOT_MISC_DIR_64	= $(ROOT_MOD_DIR)/misc/$(SUBDIR64)
481ROOT_KGSS_DIR_64	= $(ROOT_MOD_DIR)/misc/kgss/$(SUBDIR64)
482ROOT_NLMISC_DIR_64	= $(ROOT_MOD_DIR)/misc/$(SUBDIR64)
483ROOT_MACH_DIR_64	= $(ROOT_MOD_DIR)/mach/$(SUBDIR64)
484ROOT_CPU_DIR_64		= $(ROOT_MOD_DIR)/cpu/$(SUBDIR64)
485ROOT_TOD_DIR_64		= $(ROOT_MOD_DIR)/tod/$(SUBDIR64)
486ROOT_FONT_DIR_64	= $(ROOT_MOD_DIR)/fonts/$(SUBDIR64)
487ROOT_DACF_DIR_64	= $(ROOT_MOD_DIR)/dacf/$(SUBDIR64)
488ROOT_CRYPTO_DIR_64	= $(ROOT_MOD_DIR)/crypto/$(SUBDIR64)
489
490ROOT_KERN_DIR		= $(ROOT_KERN_DIR_$(CLASS))
491ROOT_DRV_DIR		= $(ROOT_DRV_DIR_$(CLASS))
492ROOT_DTRACE_DIR		= $(ROOT_DTRACE_DIR_$(CLASS))
493ROOT_EXEC_DIR		= $(ROOT_EXEC_DIR_$(CLASS))
494ROOT_FS_DIR		= $(ROOT_FS_DIR_$(CLASS))
495ROOT_SCHED_DIR		= $(ROOT_SCHED_DIR_$(CLASS))
496ROOT_STRMOD_DIR		= $(ROOT_STRMOD_DIR_$(CLASS))
497ROOT_IPP_DIR		= $(ROOT_IPP_DIR_$(CLASS))
498ROOT_SYS_DIR		= $(ROOT_SYS_DIR_$(CLASS))
499ROOT_MISC_DIR		= $(ROOT_MISC_DIR_$(CLASS))
500ROOT_KGSS_DIR		= $(ROOT_KGSS_DIR_$(CLASS))
501ROOT_NLMISC_DIR		= $(ROOT_NLMISC_DIR_$(CLASS))
502ROOT_MACH_DIR		= $(ROOT_MACH_DIR_$(CLASS))
503ROOT_CPU_DIR		= $(ROOT_CPU_DIR_$(CLASS))
504ROOT_TOD_DIR		= $(ROOT_TOD_DIR_$(CLASS))
505ROOT_FONT_DIR		= $(ROOT_FONT_DIR_$(CLASS))
506ROOT_DACF_DIR		= $(ROOT_DACF_DIR_$(CLASS))
507ROOT_CRYPTO_DIR		= $(ROOT_CRYPTO_DIR_$(CLASS))
508
509ROOT_MOD_DIRS_32	= $(ROOT_DRV_DIR_32) $(ROOT_EXEC_DIR_32)
510ROOT_MOD_DIRS_32	+= $(ROOT_DTRACE_DIR_32)
511ROOT_MOD_DIRS_32	+= $(ROOT_FS_DIR_32) $(ROOT_SCHED_DIR_32)
512ROOT_MOD_DIRS_32	+= $(ROOT_STRMOD_DIR_32) $(ROOT_SYS_DIR_32)
513ROOT_MOD_DIRS_32	+= $(ROOT_IPP_DIR_32)
514ROOT_MOD_DIRS_32	+= $(ROOT_MISC_DIR_32) $(ROOT_MACH_DIR_32)
515ROOT_MOD_DIRS_32	+= $(ROOT_KGSS_DIR_32)
516ROOT_MOD_DIRS_32	+= $(ROOT_CPU_DIR_32) $(ROOT_FONT_DIR_32)
517ROOT_MOD_DIRS_32	+= $(ROOT_TOD_DIR_32) $(ROOT_DACF_DIR_32)
518ROOT_MOD_DIRS_32	+= $(ROOT_CRYPTO_DIR_32)
519
520USR_MOD_DIR		= $(ROOT)/usr/kernel
521
522USR_DRV_DIR_32		= $(USR_MOD_DIR)/drv
523USR_EXEC_DIR_32		= $(USR_MOD_DIR)/exec
524USR_FS_DIR_32		= $(USR_MOD_DIR)/fs
525USR_SCHED_DIR_32	= $(USR_MOD_DIR)/sched
526USR_STRMOD_DIR_32	= $(USR_MOD_DIR)/strmod
527USR_SYS_DIR_32		= $(USR_MOD_DIR)/sys
528USR_MISC_DIR_32		= $(USR_MOD_DIR)/misc
529USR_DACF_DIR_32		= $(USR_MOD_DIR)/dacf
530USR_PCBE_DIR_32		= $(USR_MOD_DIR)/pcbe
531
532USR_DRV_DIR_64		= $(USR_MOD_DIR)/drv/$(SUBDIR64)
533USR_EXEC_DIR_64		= $(USR_MOD_DIR)/exec/$(SUBDIR64)
534USR_FS_DIR_64		= $(USR_MOD_DIR)/fs/$(SUBDIR64)
535USR_SCHED_DIR_64	= $(USR_MOD_DIR)/sched/$(SUBDIR64)
536USR_STRMOD_DIR_64	= $(USR_MOD_DIR)/strmod/$(SUBDIR64)
537USR_SYS_DIR_64		= $(USR_MOD_DIR)/sys/$(SUBDIR64)
538USR_MISC_DIR_64		= $(USR_MOD_DIR)/misc/$(SUBDIR64)
539USR_DACF_DIR_64		= $(USR_MOD_DIR)/dacf/$(SUBDIR64)
540USR_PCBE_DIR_64		= $(USR_MOD_DIR)/pcbe/$(SUBDIR64)
541
542USR_DRV_DIR		= $(USR_DRV_DIR_$(CLASS))
543USR_EXEC_DIR		= $(USR_EXEC_DIR_$(CLASS))
544USR_FS_DIR		= $(USR_FS_DIR_$(CLASS))
545USR_SCHED_DIR		= $(USR_SCHED_DIR_$(CLASS))
546USR_STRMOD_DIR		= $(USR_STRMOD_DIR_$(CLASS))
547USR_SYS_DIR		= $(USR_SYS_DIR_$(CLASS))
548USR_MISC_DIR		= $(USR_MISC_DIR_$(CLASS))
549USR_DACF_DIR		= $(USR_DACF_DIR_$(CLASS))
550USR_PCBE_DIR		= $(USR_PCBE_DIR_$(CLASS))
551
552USR_MOD_DIRS_32		= $(USR_DRV_DIR_32) $(USR_EXEC_DIR_32)
553USR_MOD_DIRS_32		+= $(USR_FS_DIR_32) $(USR_SCHED_DIR_32)
554USR_MOD_DIRS_32		+= $(USR_STRMOD_DIR_32) $(USR_SYS_DIR_32)
555USR_MOD_DIRS_32		+= $(USR_MISC_DIR_32) $(USR_DACF_DIR_32)
556USR_MOD_DIRS_32		+= $(USR_PCBE_DIR_32)
557
558#
559#
560#
561include $(SRC)/Makefile.psm
562
563#
564#       Set ownership on links.
565#
566CHOWNLINK=
567$(CH)CHOWNLINK= ; $(CHOWN) $(OWNER) $@
568CHGRPLINK=
569$(CH)CHGRPLINK= ; $(CHGRP) $(GROUP) $@
570
571#
572#	The "-r" on the remove may be considered temporary, but is required
573#	while the replacement of the SUNW,SPARCstation-10,SX directory by
574#	a symbolic link is being propagated.
575#
576INS.slink1= $(RM) -r $@; $(SYMLINK) $(PLATFORM) $@ $(CHOWNLINK) $(CHGRPLINK)
577INS.slink2= $(RM) -r $@; $(SYMLINK) ../$(PLATFORM)/$(@F) $@ $(CHOWNLINK) $(CHGRPLINK)
578INS.slink3= $(RM) -r $@; $(SYMLINK) $(IMPLEMENTED_PLATFORM) $@ $(CHOWNLINK) $(CHGRPLINK)
579INS.slink4= $(RM) -r $@; $(SYMLINK) ../$(PLATFORM)/include $@ $(CHOWNLINK) $(CHGRPLINK)
580INS.slink5= $(RM) -r $@; $(SYMLINK) ../$(PLATFORM)/sbin $@ $(CHOWNLINK) $(CHGRPLINK)
581INS.slink6= $(RM) -r $@; $(SYMLINK) ../../$(PLATFORM)/lib/$(MODULE) $@ $(CHOWNLINK) $(CHGRPLINK)
582
583ROOT_PLAT_LINKS		 = $(PLAT_LINKS:%=$(ROOT_PLAT_DIR)/%)
584ROOT_PLAT_LINKS_2	 = $(PLAT_LINKS_2:%=$(ROOT_PLAT_DIR)/%)
585USR_PLAT_LINKS		 = $(PLAT_LINKS:%=$(USR_PLAT_DIR)/%)
586USR_PLAT_LINKS_2	 = $(PLAT_LINKS_2:%=$(USR_PLAT_DIR)/%)
587
588#
589#	Collection of all relevant, delivered kernel modules.
590#
591KMODS	= $(DRV_KMODS) $(EXEC_KMODS) $(FS_KMODS) $(SCHED_KMODS) $(TOD_KMODS) \
592	  $(STRMOD_KMODS) $(SYS_KMODS) $(MISC_KMODS) $(NLMISC_KMODS) \
593	  $(MACH_KMODS) $(CPU_KMODS) $(GENUNIX_KMODS) \
594	  $(GSS_KMODS) $(MMU_KMODS) $(DACF_KMODS) $(EXPORT_KMODS) \
595	  $(IPP_KMODS) $(CRYPTO_KMODS) $(CRYPTO_EK_KMODS) $(PCBE_KMODS) \
596	  $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS))
597
598LINT_KMODS = $(DRV_KMODS) $(EXEC_KMODS) $(FS_KMODS) $(SCHED_KMODS) \
599	  $(TOD_KMODS) $(STRMOD_KMODS) $(SYS_KMODS) $(MISC_KMODS) \
600	  $(MACH_KMODS) $(GSS_KMODS) $(DACF_KMODS) $(IPP_KMODS) \
601	  $(CRYPTO_KMODS) $(PCBE_KMODS) \
602	  $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS))
603
604THIS_YEAR:sh=	/bin/date +%Y
605$(OBJS_DIR)/logsubr.o	:= CPPFLAGS += -DTHIS_YEAR=$(THIS_YEAR)
606$(OBJS_DIR)/logsubr.ln	:= CPPFLAGS += -DTHIS_YEAR=$(THIS_YEAR)
607
608#
609#	Files to be compiled with -xa, to generate basic block execution
610#	count data.
611#
612#	There are several ways to compile parts of the kernel for kcov:
613#               1)  Add targets to BB_FILES here or in other Makefiles
614#                       (they must in the form of $(OBJS_DIR)/target.o)
615#               2)  setenv BB_FILES '$(XXX_OBJS:%=$(OBJS_DIR)/%)'
616#               3)  setenv BB_FILES '$(OBJECTS)'
617#
618#       Do NOT setenv CFLAGS -xa, as that will cause infinite recursion
619#       in unix_bb.o
620#
621BB_FILES =
622$(BB_FILES)	:= XAOPT = -xa
623
624#
625#	The idea here is for unix_bb.o to be in all kernels except the
626#	kernel which actually gets shipped to customers.  In practice,
627#	$(RELEASE_BUILD) is on for a number of the late beta and fcs builds.
628#
629CODE_COVERAGE=
630$(RELEASE_BUILD)CODE_COVERAGE:sh=	echo \\043
631$(CODE_COVERAGE)$(OBJS_DIR)/unix_bb.o   := CPPFLAGS     += -DKCOV
632$(CODE_COVERAGE)$(OBJS_DIR)/unix_bb.ln  := CPPFLAGS     += -DKCOV
633
634#
635#	Do not let unix_bb.o get compiled with -xa!
636#
637$(OBJS_DIR)/unix_bb.o	:= XAOPT =
638
639#
640#	MPSAS support
641#
642MPSAS_BUILD:sh=		echo \\043
643#
644# Privilege files
645#
646PRIVS_AWK = $(SRC)/uts/common/os/privs.awk
647PRIVS_DEF = $(SRC)/uts/common/os/priv_defs
648