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