# OpenSolaris uts源代码的makefile结构

### Makefile Layout

This discussion is intended to provide a step-by-step explanation of what targets exist and how they are built by the makefiles. I ignore the platform-specific module architecture because it is unlikely to be of significant interest except to hardware support engineers. The three main subtrees of interest are the kernel (uts), commands and daemons (cmd), and libraries (lib). The next three subsections cover these three subtrees in turn. There are also a handful of makefiles which apply to all builds:

usr/src/Makefile
This is the top-level makefile. It drives builds for various targets in each subdirectory. It is aware of the specific targets that need to be built in each subdirectory in order to perform a complete build, and itself knows how to create a skeleton proto area for later use by install and install_h targets.
usr/src/Makefile.lint
All linting from the top level is driven by this makefile. It contains long lists of directories known to be lint-clean and contains simple recursive rules for rebuilding each subdirectory's lint target. The actual linting is driven by the lower-level makefiles.
usr/src/Makefile.master
usr/src/Makefile.master.64
These two makefiles contain generic definitions, such as build and installation tools locations, template macros for compilers, linkers, and other tools to be used by other makefiles in defining rules, and global definitions such as the ISA and machine names that apply to this build. Makefile.master.64 contains definitions specific to 64-bit builds that override the generic definitions.
usr/src/Makefile.msg.targ
Common targets for building message catalogues are defined here. Message catalogues provide translations of messages for g11n purposes.
usr/src/Makefile.psm
This makefile defines the installation locations for platform-specific modules. These are analogous to the other kernel module install locations /kernel and /usr/kernel (see section 3.2.6 below for more information on kernel module installation).
usr/src/Makefile.psm.targ
Installation target definitions for platform-specific modules are defined here. This instructs the build system how to install files into the directories defined by Makefile.psm.
usr/src/Targetdirs
This is a set of definitions for the owner, group, and permissions of each directory that will be created by the installation process. It also contains information about special symbolic links to be installed for some 64-bit library versions.

#### 3.2.3.1 Kernel Makefile Layout

The driving makefile for any module is located in the leaf directory (build directory) where the module and its component objects are built. After a 'make clobber' operation, the makefile should be the only file remaining in that directory. There are two other types of makefiles in the tree: suffixed and non-suffixed. Common definitions and rules needed by all leaf makefiles are contained in the suffixed makefiles; these are included by leaf makefiles. Non-suffixed makefiles generally invoke multiple lower-level makefiles with the same target so that many modules can be built with a single make invocation.

uts/Makefile
uts/sparc/Makefile
uts/sun4u/Makefile
uts/intel/Makefile
uts/intel/ia32/Makefile
uts/i86pc/Makefile
These makefiles generally are cognizant of the components made in subdirectories and invoke makefiles in those sub- directories to perform the actual build. Some targets (or pseudo-targets) may be directly built at this level (such as the cscope databases).
uts/Makefile.uts
Contains common definitions for all possible architectures.
uts/Makefile.targ
Contains common targets for all possible architectures.
uts/common/Makefile.files
uts/sun/Makefile.files
uts/sparc/Makefile.files
uts/sun4/Makefile.files
uts/sun4u/Makefile.files
uts/intel/Makefile.files
uts/intel/ia32/Makefile.files
uts/i86pc/Makefile.files
These makefiles are divided into two sections. The first section defines the object lists which comprise each module. The second section defines the appropriate header search paths and other machine-specific global build parameters.
uts/common/Makefile.rules
uts/sun/Makefile.rules
uts/sparc/Makefile.rules
uts/sun4/Makefile.rules
uts/sun4u/Makefile.rules
uts/intel/Makefile.rules
uts/intel/ia32/Makefile.rules
uts/intel/amd64/Makefile.rules
uts/i86pc/Makefile.rules
The files provide build rules (targets) which allow make to function in a multiple directory environment. Each source tree below the directory containing the makefile has a build rule in the file.
uts/sun4/Makefile.sun4
uts/sun4u/Makefile.sun4u
uts/intel/Makefile.intel
uts/intel/ia32/Makefile.ia32
uts/i86pc/Makefile.i86pc
These makefiles contain the definitions specific (defaults) to the obvious implementation architecture''. These rules can be overridden in specific leaf node makefiles if necessary.
uts/sun4u/unix/Makefile
uts/i86pc/unix/Makefile
Main driving makefile for building unix.
uts/sun4u/MODULE/Makefile (for MODULE in cgsix, cpu, kb, ...)
Main driving makefile for building MODULE.
uts/sun4u/genunix/Makefile
uts/i86pc/genunix/Makefile
Main driving makefile for building genunix.

Issuing the command 'make' in the uts directory will cause all supported, modularized kernels and modules to be built.

Issuing the command 'make' in a uts/ARCHITECTURE directory (i.e.: uts/sparc) will cause all supported, implementation architecture''-independent modules for ARCHITECTURE to be built.

Issuing the command 'make' in a uts/MACHINE directory (i.e.: uts/sun4u) will cause that kernel and all supported, implementation architecture''- dependent modules for MACHINE to be built.

The makefiles are verbosely commented. It is desired that they should stay this way.

#### OpenSolaris源码

2013-01-25 19:00:25

#### Linux命名空间入门（一） UTS命名空间

2016-10-17 09:32:01

#### 工作日志——UTS数据库同步操作

2014-03-20 14:22:16

#### linux命名空间UTS 总结

2017-06-06 01:21:37

#### 数据库同步工具utscninfo

2016年07月23日 8.29MB 下载

#### 自己动手编译OpenSolaris内核

2007-06-18 14:16:00

#### OpenSolaris的下载地址

2007-09-19 09:40:00

#### [BKM]编译OpenSolaris系统

2007-08-20 17:44:00

#### 最近OpenSolaris很红火，但是到底哪个版本更适合你呢？

2008-02-02 14:26:00

#### OpenSolaris

2008-10-26 12:44:00