xref: /illumos-gate/usr/src/uts/Makefile.uts (revision d58ceae2)
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 (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
24# Copyright (c) 2011 Bayard G. Bell. All rights reserved.
25# Copyright (c) 2011,2017 by Delphix. All rights reserved.
26# Copyright (c) 2013 Andrew Stormont.  All rights reserved.
27# Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
28# Copyright 2019 Joyent, Inc.
29#
30
31#
32#	This Makefile contains the common targets and definitions for
33#	all kernels. It is to be included in the Makefiles for specific
34#	implementation architectures and processor architecture dependent
35#	modules: i.e.: all driving kernel Makefiles.
36#
37#	Include global definitions:
38#
39include $(SRC)/Makefile.master
40
41#
42#	No text domain in the kernel.
43#
44DTEXTDOM =
45
46#
47#	Keep references to $(SRC)/common relative.
48COMMONBASE=	$(UTSBASE)/../common
49
50#
51#	Setup build-specific vars
52#	To add a build type:
53#		add name to ALL_BUILDS32 & ALL_BUILDS64
54#		set CLASS_name and OBJ_DIR_name
55#		add targets to Makefile.targ
56#
57
58#
59#	DEF_BUILDS is for def, lint, sischeck, and install
60#	ALL_BUILDS is for everything else (all, clean, ...)
61#
62# The NOT_RELEASE_BUILD noise is to maintain compatibility with the
63# gatekeeper's nightly build script.
64#
65DEF_BUILDS32				= obj32
66DEF_BUILDS64				= obj64
67DEF_BUILDSONLY64			= obj64
68$(NOT_RELEASE_BUILD)DEF_BUILDS32	= debug32
69$(NOT_RELEASE_BUILD)DEF_BUILDS64	= debug64
70$(NOT_RELEASE_BUILD)DEF_BUILDSONLY64	= debug64
71ALL_BUILDS32				= obj32 debug32
72ALL_BUILDS64				= obj64 debug64
73ALL_BUILDSONLY64			= obj64 debug64
74
75#
76#	For modules in 64b dirs that aren't built 64b
77#	or modules in 64b dirs that aren't built 32b we
78#	need to create empty modlintlib files so global lint works
79#
80LINT32_BUILDS	= debug32
81LINT64_BUILDS	= debug64
82
83#
84#	Build class (32b or 64b)
85#
86CLASS_OBJ32	= 32
87CLASS_DBG32	= 32
88CLASS_OBJ64	= 64
89CLASS_DBG64	= 64
90CLASS		= $(CLASS_$(BUILD_TYPE))
91
92#
93#	Build subdirectory
94#
95OBJS_DIR_OBJ32	= obj32
96OBJS_DIR_DBG32	= debug32
97OBJS_DIR_OBJ64	= obj64
98OBJS_DIR_DBG64	= debug64
99OBJS_DIR	= $(OBJS_DIR_$(BUILD_TYPE))
100
101#
102#	Create defaults so empty rules don't
103#	confuse make
104#
105CLASS_		= 64
106OBJS_DIR_	= debug64
107
108#
109#	Build tools
110#
111CC_sparc_32	= $(sparc_CC)
112CC_sparc_64	= $(sparcv9_CC)
113
114CC_i386_32	= $(i386_CC)
115CC_i386_64	= $(amd64_CC)
116CC_amd64_64	= $(amd64_CC)
117
118CC		= $(CC_$(MACH)_$(CLASS))
119
120AS_sparc_32	= $(sparc_AS)
121AS_sparc_64	= $(sparcv9_AS)
122
123AS_i386_32	= $(i386_AS)
124AS_i386_64	= $(amd64_AS)
125AS_amd64_64	= $(amd64_AS)
126
127AS		= $(AS_$(MACH)_$(CLASS))
128
129LD_sparc_32	= $(sparc_LD)
130LD_sparc_64	= $(sparcv9_LD)
131
132LD_i386_32	= $(i386_LD)
133LD_i386_64	= $(amd64_LD)
134LD_amd64_64	= $(amd64_LD)
135
136LD		= $(LD_$(MACH)_$(CLASS))
137
138LINT_sparc_32	= $(sparc_LINT)
139LINT_sparc_64	= $(sparcv9_LINT)
140
141LINT_i386_32	= $(i386_LINT)
142LINT_i386_64	= $(amd64_LINT)
143LINT_amd64_64	= $(amd64_LINT)
144
145LINT		= $(LINT_$(MACH)_$(CLASS))
146
147MODEL_32	= ilp32
148MODEL_64	= lp64
149MODEL		= $(MODEL_$(CLASS))
150
151#
152#	Build rules for linting the kernel.
153#
154LHEAD =	$(ECHO) "\n$@";
155
156# Note: egrep returns "failure" if there are no matches, which is
157# exactly the opposite of what we need.
158LGREP.2 =	if egrep -v ' (_init|_fini|_info) '; then false; else true; fi
159
160LTAIL =
161
162LINT.c =	$(LINT) -c -dirout=$(LINTS_DIR) $(LINTFLAGS) $(LINT_DEFS) $(CPPFLAGS)
163
164# Please do not add new erroff directives here.  If you need to disable
165# lint warnings in your module for things that cannot be fixed in any
166# reasonable manner, please augment LINTTAGS in your module Makefile
167# instead.
168LINTTAGS	= -erroff=E_INCONS_ARG_DECL2
169LINTTAGS	+= -erroff=E_INCONS_VAL_TYPE_DECL2
170
171LINTFLAGS_sparc_32	= $(LINTCCMODE) -nsxmuF -errtags=yes
172LINTFLAGS_sparc_64	= $(LINTFLAGS_sparc_32) -m64
173LINTFLAGS_i386_32	= $(LINTCCMODE) -nsxmuF -errtags=yes
174LINTFLAGS_i386_64	= $(LINTFLAGS_i386_32) -m64
175
176LINTFLAGS	= $(LINTFLAGS_$(MACH)_$(CLASS)) $(LINTTAGS)
177LINTFLAGS	+= $(C99LMODE)
178
179#
180#	Override this variable to modify the name of the lint target.
181#
182LINT_MODULE=	$(MODULE)
183
184#
185#	Build the compile/assemble lines:
186#
187EXTRA_OPTIONS		=
188AS_DEFS			= -D_ASM -D__STDC__=0
189
190ALWAYS_DEFS_32		= -D_KERNEL -D_SYSCALL32 -D_DDI_STRICT
191ALWAYS_DEFS_64		= -D_KERNEL -D_SYSCALL32 -D_SYSCALL32_IMPL -D_ELF64 \
192			-D_DDI_STRICT
193#
194# XX64	This should be defined by the compiler!
195#
196ALWAYS_DEFS_64		+= -Dsun -D__sun -D__SVR4
197ALWAYS_DEFS		= $(ALWAYS_DEFS_$(CLASS))
198
199#
200#	CPPFLAGS is deliberatly set with a "=" and not a "+=".  For the kernel
201#	the header include path should not look for header files outside of
202#	the kernel code.  This "=" removes the search path built in
203#	Makefile.master inside CPPFLAGS.  Ditto for AS_CPPFLAGS.
204#
205CPPFLAGS	= $(ALWAYS_DEFS) $(ALL_DEFS) $(CONFIG_DEFS) \
206		   $(INCLUDE_PATH) $(EXTRA_OPTIONS)
207ASFLAGS		+= -P
208AS_CPPFLAGS	= $(ALWAYS_DEFS) $(ALL_DEFS) $(CONFIG_DEFS) $(AS_DEFS) \
209		   $(AS_INC_PATH) $(EXTRA_OPTIONS)
210
211#
212#	Make it (relatively) easy to share compilation options between
213#	all kernel implementations.
214#
215
216# Override the default, the kernel is squeaky clean
217CERRWARN = -errtags=yes -errwarn=%all
218
219CERRWARN += -_gcc=-Wno-missing-braces
220CERRWARN += -_gcc=-Wno-sign-compare
221CERRWARN += -_gcc=-Wno-unknown-pragmas
222CERRWARN += -_gcc=-Wno-unused-parameter
223CERRWARN += -_gcc=-Wno-missing-field-initializers
224
225# gcc4 lacks -Wno-maybe-uninitialized
226CNOWARN_UNINIT = -_gcc4=-Wno-uninitialized \
227    -_gcc7=-Wno-maybe-uninitialized \
228    -_gcc8=-Wno-maybe-uninitialized
229
230# DEBUG v. -nd make for frequent unused variables, empty conditions, etc. in
231# -nd builds
232$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused
233$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-empty-body
234
235CERRWARN += -_smatch=-p=illumos_kernel
236include $(SRC)/Makefile.smatch
237
238#
239# Unfortunately, _IOWR() is regularly used with a third argument of 0,
240# so we have to disable all these smatch checks.
241#
242SMOFF += sizeof
243
244#
245# Ensure that the standard function prologue remains at the very start
246# of a function, so DTrace fbt will instrument the right place.
247#
248CFLAGS_uts_i386 += -_gcc7=-fno-shrink-wrap
249CFLAGS_uts_i386 += -_gcc8=-fno-shrink-wrap
250CFLAGS_uts_i386 += -_gcc9=-fno-shrink-wrap
251
252CSTD = $(CSTD_GNU99)
253
254CFLAGS_uts		=
255CFLAGS_uts		+= $(STAND_FLAGS_$(CLASS))
256CFLAGS_uts		+= $(CCVERBOSE)
257CFLAGS_uts		+= $(ILDOFF)
258CFLAGS_uts		+= $(XAOPT)
259CFLAGS_uts		+= $(CTF_FLAGS_$(CLASS))
260CFLAGS_uts		+= $(CERRWARN)
261CFLAGS_uts		+= $(CCNOAUTOINLINE)
262CFLAGS_uts		+= $(CCNOREORDER)
263CFLAGS_uts		+= $(CCNOAGGRESSIVELOOPS)
264CFLAGS_uts		+= $(CGLOBALSTATIC)
265CFLAGS_uts		+= $(EXTRA_CFLAGS)
266CFLAGS_uts		+= $(CSOURCEDEBUGFLAGS)
267CFLAGS_uts		+= $(CUSERFLAGS)
268CFLAGS_uts		+= $(CFLAGS_uts_$(MACH))
269
270#
271#	Declare that $(OBJECTS) and $(LINTS) can be compiled in parallel.
272#	The DUMMY target is for those instances where OBJECTS and LINTS
273#	are empty (to avoid an unconditional .PARALLEL).
274.PARALLEL:	$(OBJECTS) $(LINTS) DUMMY
275
276#
277#	Expanded dependencies
278#
279DEF_DEPS	= $(DEF_BUILDS:%=def.%)
280ALL_DEPS	= $(ALL_BUILDS:%=all.%)
281CLEAN_DEPS	= $(ALL_BUILDS:%=clean.%)
282CLOBBER_DEPS	= $(ALL_BUILDS:%=clobber.%)
283LINT_DEPS	= $(DEF_BUILDS:%=lint.%)
284MODLINTLIB_DEPS	= $(DEF_BUILDS:%=modlintlib.%)
285MODLIST_DEPS	= $(DEF_BUILDS:%=modlist.%)
286CLEAN_LINT_DEPS	= $(ALL_BUILDS:%=clean.lint.%)
287INSTALL_DEPS	= $(DEF_BUILDS:%=install.%)
288SYM_DEPS	= $(SYM_BUILDS:%=symcheck.%)
289SISCHECK_DEPS	= $(DEF_BUILDS:%=sischeck.%)
290SISCLEAN_DEPS	= $(ALL_BUILDS:%=sisclean.%)
291
292#
293#	Default module name
294#
295BINARY		= $(OBJS_DIR)/$(MODULE)
296
297#
298#	Default cleanup definitions
299#
300CLEANLINTFILES	= $(LINTS) $(MOD_LINT_LIB)
301CLEANFILES	= $(OBJECTS) $(CLEANLINTFILES)
302CLOBBERFILES	= $(BINARY) $(CLEANFILES)
303
304#
305#	Installation constants:
306#
307#		FILEMODE is the mode given to the kernel modules
308#		CFILEMODE is the mode given to the '.conf' files
309#
310FILEMODE	 = 755
311DIRMODE		 = 755
312CFILEMODE	 = 644
313
314#
315#	Special Installation Macros for the installation of '.conf' files.
316#
317#	These are unique because they are not installed from the current
318#	working directory.
319#
320# Sigh.  Apparently at some time in the past there was a confusion on
321# whether the name is SRC_CONFFILE or SRC_CONFILE.  Consistency with the
322# other names would indicate SRC_CONFFILE, but the voting is >180 Makefiles
323# with SRC_CONFILE and about 11 with SRC_CONFFILE.  Software development
324# isn't a popularity contest, though, and so my inclination is to define
325# both names for now and incrementally convert to SRC_CONFFILE to be consistent
326# with the other names.
327#
328CONFFILE		= $(MODULE).conf
329SRC_CONFFILE		= $(CONF_SRCDIR)/$(CONFFILE)
330SRC_CONFILE		= $(SRC_CONFFILE)
331ROOT_CONFFILE_32	= $(ROOTMODULE).conf
332ROOT_CONFFILE_64	= $(ROOTMODULE:%/$(SUBDIR64)/$(MODULE)=%/$(MODULE)).conf
333ROOT_CONFFILE		= $(ROOT_CONFFILE_$(CLASS))
334
335
336INS.conffile= \
337	$(RM) $@; $(INS) -s -m $(CFILEMODE) -f $(@D) $(SRC_CONFFILE)
338
339#
340# The CTF merge of child kernel modules is performed against one of the genunix
341# modules.  For Intel builds, all modules will be used with a single genunix:
342# the one built in intel/genunix.  For SPARC builds, a given
343# module may be
344# used with one of a number of genunix files, depending on what platform the
345# module is deployed on.  We merge against the sun4u genunix to optimize for
346# the common case.  We also merge against the ip driver since networking is
347# typically loaded and types defined therein are shared between many modules.
348#
349CTFMERGE_GUDIR_sparc	= sun4u
350CTFMERGE_GUDIR_i386	= intel
351CTFMERGE_GUDIR		= $(CTFMERGE_GUDIR_$(MACH))
352
353CTFMERGE_GENUNIX	= \
354	$(UTSBASE)/$(CTFMERGE_GUDIR)/genunix/$(OBJS_DIR)/genunix
355
356#
357# Used to uniquify a non-genunix module against genunix. $VERSION is used
358# for the label.
359#
360# For the ease of developers dropping modules onto possibly unrelated systems,
361# you can set NO_GENUNIX_UNIQUIFY= in the environment to skip uniquifying
362# against genunix.
363#
364NO_GENUNIX_UNIQUIFY=$(POUND_SIGN)
365CTFMERGE_GENUNIX_DFLAG=-d $(CTFMERGE_GENUNIX)
366$(NO_GENUNIX_UNIQUIFY)CTFMERGE_GENUNIX_DFLAG=
367
368CTFMERGE_UNIQUIFY_AGAINST_GENUNIX	= \
369	$(CTFMERGE) $(CTFMRGFLAGS) -L VERSION \
370	$(CTFMERGE_GENUNIX_DFLAG) -o $@ $(OBJECTS) $(CTFEXTRAOBJS)
371
372#
373# Used to merge the genunix module.
374#
375CTFMERGE_GENUNIX_MERGE		= \
376	$(CTFMERGE) $(CTFMRGFLAGS) -L VERSION -o $@ \
377	$(OBJECTS) $(CTFEXTRAOBJS) $(IPCTF_TARGET)
378
379#
380# We ctfmerge the ip objects into genunix to maximize the number of common types
381# found there, thus maximizing the effectiveness of uniquification.  We don't
382# want the genunix build to have to know about the individual ip objects, so we
383# put them in an archive.  The genunix ctfmerge then includes this archive.
384#
385IPCTF		= $(IPDRV_DIR)/$(OBJS_DIR)/ipctf.a
386
387#
388# Rule for building fake shared libraries used for symbol resolution
389# when building other modules.  -znoreloc is needed here to avoid
390# tripping over code that isn't really suitable for shared libraries.
391#
392BUILD.SO		= \
393	$(LD) -o $@ $(GSHARED) $(ZNORELOC) -h $(SONAME)
394
395#
396# SONAME defaults for common fake shared libraries.
397#
398$(LIBGEN)		:= SONAME = $(MODULE)
399$(PLATLIB)		:= SONAME = misc/platmod
400$(CPULIB)		:= SONAME = 'cpu/$$CPU'
401$(DTRACESTUBS)		:= SONAME = dtracestubs
402
403#
404#	Installation directories
405#
406
407#
408#	For now, 64b modules install into a subdirectory
409#	of their 32b brethren.
410#
411SUBDIR64_sparc		= sparcv9
412SUBDIR64_i386		= amd64
413SUBDIR64		= $(SUBDIR64_$(MACH))
414
415ROOT_MOD_DIR		= $(ROOT)/kernel
416
417ROOT_KERN_DIR_32	= $(ROOT_MOD_DIR)
418ROOT_BRAND_DIR_32	= $(ROOT_MOD_DIR)/brand
419ROOT_DRV_DIR_32		= $(ROOT_MOD_DIR)/drv
420ROOT_DTRACE_DIR_32	= $(ROOT_MOD_DIR)/dtrace
421ROOT_EXEC_DIR_32	= $(ROOT_MOD_DIR)/exec
422ROOT_FS_DIR_32		= $(ROOT_MOD_DIR)/fs
423ROOT_SCHED_DIR_32	= $(ROOT_MOD_DIR)/sched
424ROOT_SOCK_DIR_32	= $(ROOT_MOD_DIR)/socketmod
425ROOT_STRMOD_DIR_32	= $(ROOT_MOD_DIR)/strmod
426ROOT_IPP_DIR_32		= $(ROOT_MOD_DIR)/ipp
427ROOT_SYS_DIR_32		= $(ROOT_MOD_DIR)/sys
428ROOT_MISC_DIR_32	= $(ROOT_MOD_DIR)/misc
429ROOT_KGSS_DIR_32	= $(ROOT_MOD_DIR)/misc/kgss
430ROOT_SCSI_VHCI_DIR_32	= $(ROOT_MOD_DIR)/misc/scsi_vhci
431ROOT_PMCS_FW_DIR_32	= $(ROOT_MOD_DIR)/misc/pmcs
432ROOT_QLC_FW_DIR_32	= $(ROOT_MOD_DIR)/misc/qlc
433ROOT_EMLXS_FW_DIR_32	= $(ROOT_MOD_DIR)/misc/emlxs
434ROOT_NLMISC_DIR_32	= $(ROOT_MOD_DIR)/misc
435ROOT_MACH_DIR_32	= $(ROOT_MOD_DIR)/mach
436ROOT_CPU_DIR_32		= $(ROOT_MOD_DIR)/cpu
437ROOT_TOD_DIR_32		= $(ROOT_MOD_DIR)/tod
438ROOT_FONT_DIR_32	= $(ROOT_MOD_DIR)/fonts
439ROOT_DACF_DIR_32	= $(ROOT_MOD_DIR)/dacf
440ROOT_CRYPTO_DIR_32	= $(ROOT_MOD_DIR)/crypto
441ROOT_MAC_DIR_32		= $(ROOT_MOD_DIR)/mac
442ROOT_CC_DIR_32		= $(ROOT_MOD_DIR)/cc
443ROOT_KICONV_DIR_32	= $(ROOT_MOD_DIR)/kiconv
444
445ROOT_KERN_DIR_64	= $(ROOT_MOD_DIR)/$(SUBDIR64)
446ROOT_BRAND_DIR_64	= $(ROOT_MOD_DIR)/brand/$(SUBDIR64)
447ROOT_DRV_DIR_64		= $(ROOT_MOD_DIR)/drv/$(SUBDIR64)
448ROOT_DTRACE_DIR_64	= $(ROOT_MOD_DIR)/dtrace/$(SUBDIR64)
449ROOT_EXEC_DIR_64	= $(ROOT_MOD_DIR)/exec/$(SUBDIR64)
450ROOT_FS_DIR_64		= $(ROOT_MOD_DIR)/fs/$(SUBDIR64)
451ROOT_SCHED_DIR_64	= $(ROOT_MOD_DIR)/sched/$(SUBDIR64)
452ROOT_SOCK_DIR_64	= $(ROOT_MOD_DIR)/socketmod/$(SUBDIR64)
453ROOT_STRMOD_DIR_64	= $(ROOT_MOD_DIR)/strmod/$(SUBDIR64)
454ROOT_IPP_DIR_64		= $(ROOT_MOD_DIR)/ipp/$(SUBDIR64)
455ROOT_SYS_DIR_64		= $(ROOT_MOD_DIR)/sys/$(SUBDIR64)
456ROOT_MISC_DIR_64	= $(ROOT_MOD_DIR)/misc/$(SUBDIR64)
457ROOT_KGSS_DIR_64	= $(ROOT_MOD_DIR)/misc/kgss/$(SUBDIR64)
458ROOT_SCSI_VHCI_DIR_64	= $(ROOT_MOD_DIR)/misc/scsi_vhci/$(SUBDIR64)
459ROOT_PMCS_FW_DIR_64	= $(ROOT_MOD_DIR)/misc/pmcs/$(SUBDIR64)
460ROOT_QLC_FW_DIR_64	= $(ROOT_MOD_DIR)/misc/qlc/$(SUBDIR64)
461ROOT_EMLXS_FW_DIR_64	= $(ROOT_MOD_DIR)/misc/emlxs/$(SUBDIR64)
462ROOT_NLMISC_DIR_64	= $(ROOT_MOD_DIR)/misc/$(SUBDIR64)
463ROOT_MACH_DIR_64	= $(ROOT_MOD_DIR)/mach/$(SUBDIR64)
464ROOT_CPU_DIR_64		= $(ROOT_MOD_DIR)/cpu/$(SUBDIR64)
465ROOT_TOD_DIR_64		= $(ROOT_MOD_DIR)/tod/$(SUBDIR64)
466ROOT_FONT_DIR_64	= $(ROOT_MOD_DIR)/fonts/$(SUBDIR64)
467ROOT_DACF_DIR_64	= $(ROOT_MOD_DIR)/dacf/$(SUBDIR64)
468ROOT_CRYPTO_DIR_64	= $(ROOT_MOD_DIR)/crypto/$(SUBDIR64)
469ROOT_MAC_DIR_64		= $(ROOT_MOD_DIR)/mac/$(SUBDIR64)
470ROOT_CC_DIR_64		= $(ROOT_MOD_DIR)/cc/$(SUBDIR64)
471ROOT_KICONV_DIR_64	= $(ROOT_MOD_DIR)/kiconv/$(SUBDIR64)
472
473ROOT_KERN_DIR		= $(ROOT_KERN_DIR_$(CLASS))
474ROOT_BRAND_DIR		= $(ROOT_BRAND_DIR_$(CLASS))
475ROOT_DRV_DIR		= $(ROOT_DRV_DIR_$(CLASS))
476ROOT_DTRACE_DIR		= $(ROOT_DTRACE_DIR_$(CLASS))
477ROOT_EXEC_DIR		= $(ROOT_EXEC_DIR_$(CLASS))
478ROOT_FS_DIR		= $(ROOT_FS_DIR_$(CLASS))
479ROOT_SCHED_DIR		= $(ROOT_SCHED_DIR_$(CLASS))
480ROOT_SOCK_DIR		= $(ROOT_SOCK_DIR_$(CLASS))
481ROOT_STRMOD_DIR		= $(ROOT_STRMOD_DIR_$(CLASS))
482ROOT_IPP_DIR		= $(ROOT_IPP_DIR_$(CLASS))
483ROOT_SYS_DIR		= $(ROOT_SYS_DIR_$(CLASS))
484ROOT_MISC_DIR		= $(ROOT_MISC_DIR_$(CLASS))
485ROOT_KGSS_DIR		= $(ROOT_KGSS_DIR_$(CLASS))
486ROOT_SCSI_VHCI_DIR	= $(ROOT_SCSI_VHCI_DIR_$(CLASS))
487ROOT_PMCS_FW_DIR	= $(ROOT_PMCS_FW_DIR_$(CLASS))
488ROOT_QLC_FW_DIR		= $(ROOT_QLC_FW_DIR_$(CLASS))
489ROOT_EMLXS_FW_DIR	= $(ROOT_EMLXS_FW_DIR_$(CLASS))
490ROOT_NLMISC_DIR		= $(ROOT_NLMISC_DIR_$(CLASS))
491ROOT_MACH_DIR		= $(ROOT_MACH_DIR_$(CLASS))
492ROOT_CPU_DIR		= $(ROOT_CPU_DIR_$(CLASS))
493ROOT_TOD_DIR		= $(ROOT_TOD_DIR_$(CLASS))
494ROOT_FONT_DIR		= $(ROOT_FONT_DIR_$(CLASS))
495ROOT_DACF_DIR		= $(ROOT_DACF_DIR_$(CLASS))
496ROOT_CRYPTO_DIR		= $(ROOT_CRYPTO_DIR_$(CLASS))
497ROOT_MAC_DIR		= $(ROOT_MAC_DIR_$(CLASS))
498ROOT_CC_DIR		= $(ROOT_CC_DIR_$(CLASS))
499ROOT_KICONV_DIR		= $(ROOT_KICONV_DIR_$(CLASS))
500ROOT_FIRMWARE_DIR	= $(ROOT_MOD_DIR)/firmware
501
502ROOT_MOD_DIRS_32	= $(ROOT_BRAND_DIR_32) $(ROOT_DRV_DIR_32)
503ROOT_MOD_DIRS_32	= $(ROOT_BRAND_DIR_32) $(ROOT_DRV_DIR_32)
504ROOT_MOD_DIRS_32	+= $(ROOT_EXEC_DIR_32) $(ROOT_DTRACE_DIR_32)
505ROOT_MOD_DIRS_32	+= $(ROOT_FS_DIR_32) $(ROOT_SCHED_DIR_32)
506ROOT_MOD_DIRS_32	+= $(ROOT_STRMOD_DIR_32) $(ROOT_SYS_DIR_32)
507ROOT_MOD_DIRS_32	+= $(ROOT_IPP_DIR_32) $(ROOT_SOCK_DIR_32)
508ROOT_MOD_DIRS_32	+= $(ROOT_MISC_DIR_32) $(ROOT_MACH_DIR_32)
509ROOT_MOD_DIRS_32	+= $(ROOT_KGSS_DIR_32)
510ROOT_MOD_DIRS_32	+= $(ROOT_SCSI_VHCI_DIR_32)
511ROOT_MOD_DIRS_32	+= $(ROOT_PMCS_FW_DIR_32)
512ROOT_MOD_DIRS_32        += $(ROOT_QLC_FW_DIR_32)
513ROOT_MOD_DIRS_32        += $(ROOT_EMLXS_FW_DIR_32)
514ROOT_MOD_DIRS_32	+= $(ROOT_CPU_DIR_32) $(ROOT_FONT_DIR_32)
515ROOT_MOD_DIRS_32	+= $(ROOT_TOD_DIR_32) $(ROOT_DACF_DIR_32)
516ROOT_MOD_DIRS_32	+= $(ROOT_CRYPTO_DIR_32) $(ROOT_MAC_DIR_32)
517ROOT_MOD_DIRS_32	+= $(ROOT_CC_DIR_32)
518ROOT_MOD_DIRS_32	+= $(ROOT_KICONV_DIR_32)
519ROOT_MOD_DIRS_32	+= $(ROOT_FIRMWARE_DIR)
520
521USR_MOD_DIR		= $(ROOT)/usr/kernel
522
523USR_DRV_DIR_32		= $(USR_MOD_DIR)/drv
524USR_EXEC_DIR_32		= $(USR_MOD_DIR)/exec
525USR_FS_DIR_32		= $(USR_MOD_DIR)/fs
526USR_SCHED_DIR_32	= $(USR_MOD_DIR)/sched
527USR_SOCK_DIR_32		= $(USR_MOD_DIR)/socketmod
528USR_STRMOD_DIR_32	= $(USR_MOD_DIR)/strmod
529USR_SYS_DIR_32		= $(USR_MOD_DIR)/sys
530USR_MISC_DIR_32		= $(USR_MOD_DIR)/misc
531USR_DACF_DIR_32		= $(USR_MOD_DIR)/dacf
532USR_PCBE_DIR_32		= $(USR_MOD_DIR)/pcbe
533USR_DTRACE_DIR_32	= $(USR_MOD_DIR)/dtrace
534USR_BRAND_DIR_32	= $(USR_MOD_DIR)/brand
535
536USR_DRV_DIR_64		= $(USR_MOD_DIR)/drv/$(SUBDIR64)
537USR_EXEC_DIR_64		= $(USR_MOD_DIR)/exec/$(SUBDIR64)
538USR_FS_DIR_64		= $(USR_MOD_DIR)/fs/$(SUBDIR64)
539USR_SCHED_DIR_64	= $(USR_MOD_DIR)/sched/$(SUBDIR64)
540USR_SOCK_DIR_64		= $(USR_MOD_DIR)/socketmod/$(SUBDIR64)
541USR_STRMOD_DIR_64	= $(USR_MOD_DIR)/strmod/$(SUBDIR64)
542USR_SYS_DIR_64		= $(USR_MOD_DIR)/sys/$(SUBDIR64)
543USR_MISC_DIR_64		= $(USR_MOD_DIR)/misc/$(SUBDIR64)
544USR_DACF_DIR_64		= $(USR_MOD_DIR)/dacf/$(SUBDIR64)
545USR_PCBE_DIR_64		= $(USR_MOD_DIR)/pcbe/$(SUBDIR64)
546USR_DTRACE_DIR_64	= $(USR_MOD_DIR)/dtrace/$(SUBDIR64)
547USR_BRAND_DIR_64	= $(USR_MOD_DIR)/brand/$(SUBDIR64)
548
549USR_DRV_DIR		= $(USR_DRV_DIR_$(CLASS))
550USR_EXEC_DIR		= $(USR_EXEC_DIR_$(CLASS))
551USR_FS_DIR		= $(USR_FS_DIR_$(CLASS))
552USR_SCHED_DIR		= $(USR_SCHED_DIR_$(CLASS))
553USR_SOCK_DIR		= $(USR_SOCK_DIR_$(CLASS))
554USR_STRMOD_DIR		= $(USR_STRMOD_DIR_$(CLASS))
555USR_SYS_DIR		= $(USR_SYS_DIR_$(CLASS))
556USR_MISC_DIR		= $(USR_MISC_DIR_$(CLASS))
557USR_DACF_DIR		= $(USR_DACF_DIR_$(CLASS))
558USR_PCBE_DIR		= $(USR_PCBE_DIR_$(CLASS))
559USR_DTRACE_DIR		= $(USR_DTRACE_DIR_$(CLASS))
560USR_BRAND_DIR		= $(USR_BRAND_DIR_$(CLASS))
561
562USR_MOD_DIRS_32		= $(USR_DRV_DIR_32) $(USR_EXEC_DIR_32)
563USR_MOD_DIRS_32		+= $(USR_FS_DIR_32) $(USR_SCHED_DIR_32)
564USR_MOD_DIRS_32		+= $(USR_STRMOD_DIR_32) $(USR_SYS_DIR_32)
565USR_MOD_DIRS_32		+= $(USR_MISC_DIR_32) $(USR_DACF_DIR_32)
566USR_MOD_DIRS_32		+= $(USR_PCBE_DIR_32)
567USR_MOD_DIRS_32		+= $(USR_DTRACE_DIR_32) $(USR_BRAND_DIR_32)
568USR_MOD_DIRS_32		+= $(USR_SOCK_DIR_32)
569
570#
571#
572#
573include $(SRC)/Makefile.psm
574
575#
576#	The "-r" on the remove may be considered temporary, but is required
577#	while the replacement of the SUNW,SPARCstation-10,SX directory by
578#	a symbolic link is being propagated.
579#
580INS.slink1= $(RM) -r $@; $(SYMLINK) $(PLATFORM) $@
581INS.slink2= $(RM) -r $@; $(SYMLINK) ../$(PLATFORM)/$(@F) $@
582INS.slink3= $(RM) -r $@; $(SYMLINK) $(IMPLEMENTED_PLATFORM) $@
583INS.slink4= $(RM) -r $@; $(SYMLINK) ../$(PLATFORM)/include $@
584INS.slink5= $(RM) -r $@; $(SYMLINK) ../$(PLATFORM)/sbin $@
585INS.slink6= $(RM) -r $@; $(SYMLINK) ../../$(PLATFORM)/lib/$(MODULE) $@
586INS.slink7= $(RM) -r $@; $(SYMLINK) ../../$(PLATFORM)/sbin/$(@F) $@
587
588ROOT_PLAT_LINKS		 = $(PLAT_LINKS:%=$(ROOT_PLAT_DIR)/%)
589ROOT_PLAT_LINKS_2	 = $(PLAT_LINKS_2:%=$(ROOT_PLAT_DIR)/%)
590USR_PLAT_LINKS		 = $(PLAT_LINKS:%=$(USR_PLAT_DIR)/%)
591USR_PLAT_LINKS_2	 = $(PLAT_LINKS_2:%=$(USR_PLAT_DIR)/%)
592
593#
594# Collection of all relevant, delivered kernel modules.
595#
596# Note that we insist on building genunix first, because everything else
597# uniquifies against it.  When doing a 'make' from usr/src/uts/, we'll enter
598# the platform directories first.  These will cd into the corresponding genunix
599# directory and build it.  So genunix /shouldn't/ get rebuilt when we get to
600# building all the kernel modules.  However, due to an as-yet-unexplained
601# problem with dependencies, sometimes it does get rebuilt, which then messes
602# up the other modules.  So we always force the issue here rather than try to
603# build genunix in parallel with everything else.
604#
605PARALLEL_KMODS = $(DRV_KMODS) $(EXEC_KMODS) $(FS_KMODS) $(SCHED_KMODS) \
606		 $(TOD_KMODS) $(STRMOD_KMODS) $(SYS_KMODS) $(MISC_KMODS) \
607		 $(NLMISC_KMODS) $(MACH_KMODS) $(CPU_KMODS) $(GSS_KMODS) \
608		 $(MMU_KMODS) $(DACF_KMODS) $(EXPORT_KMODS) $(IPP_KMODS) \
609		 $(CRYPTO_KMODS) $(PCBE_KMODS) \
610		 $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS)) $(MAC_KMODS) \
611		 $(BRAND_KMODS) $(KICONV_KMODS) $(CC_KMODS) \
612		 $(SOCKET_KMODS)
613
614KMODS = $(GENUNIX_KMODS) $(PARALLEL_KMODS)
615
616$(PARALLEL_KMODS): $(GENUNIX_KMODS)
617
618LINT_KMODS = $(DRV_KMODS) $(EXEC_KMODS) $(FS_KMODS) $(SCHED_KMODS) \
619	  $(TOD_KMODS) $(STRMOD_KMODS) $(SYS_KMODS) $(MISC_KMODS) \
620	  $(MACH_KMODS) $(GSS_KMODS) $(DACF_KMODS) $(IPP_KMODS) \
621	  $(CRYPTO_KMODS) $(PCBE_KMODS) \
622	  $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS)) $(MAC_KMODS) \
623	  $(BRAND_KMODS) $(KICONV_KMODS) $(CC_KMODS) $(SOCKET_KMODS)
624
625#
626#	Files to be compiled with -xa, to generate basic block execution
627#	count data.
628#
629#	There are several ways to compile parts of the kernel for kcov:
630#               1)  Add targets to BB_FILES here or in other Makefiles
631#                       (they must in the form of $(OBJS_DIR)/target.o)
632#               2)  setenv BB_FILES '$(XXX_OBJS:%=$(OBJS_DIR)/%)'
633#               3)  setenv BB_FILES '$(OBJECTS)'
634#
635#       Do NOT setenv CFLAGS -xa, as that will cause infinite recursion
636#       in unix_bb.o
637#
638BB_FILES =
639$(BB_FILES)	:= XAOPT = -xa
640
641#
642#	The idea here is for unix_bb.o to be in all kernels except the
643#	kernel which actually gets shipped to customers.  In practice,
644#	$(RELEASE_BUILD) is on for a number of the late beta and fcs builds.
645#
646$(NOT_RELEASE_BUILD)$(OBJS_DIR)/unix_bb.o   := CPPFLAGS     += -DKCOV
647$(NOT_RELEASE_BUILD)$(OBJS_DIR)/unix_bb.ln  := CPPFLAGS     += -DKCOV
648
649#
650#	Do not let unix_bb.o get compiled with -xa!
651#
652$(OBJS_DIR)/unix_bb.o	:= XAOPT =
653
654#
655# Privilege files
656#
657PRIVS_AWK = $(SRC)/uts/common/os/privs.awk
658PRIVS_DEF = $(SRC)/uts/common/os/priv_defs
659
660#
661# USB device data
662#
663USBDEVS_AWK =	$(SRC)/uts/common/io/usb/usbdevs2h.awk
664USBDEVS_DATA =	$(SRC)/uts/common/io/usb/usbdevs
665
666
667#
668# If we're using the newer CTF tools, then we need to make sure that we
669# are building with the private -X option to ctfconvert which allows us
670# to fixup the struct cpu to account for machcpu.
671#
672$(BUILD_NEW_CTF_TOOLS)CTFCVTFLAGS += -X
673