OpenSolaris uts源代码的makefile结构

原创 2007年09月20日 14:12:00

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.

 

相关文章推荐

源代码到可执行代码的过程以及Makefile的编写

源代码到可执行代码的过程以及Makefile的编写1过程的三个步骤 预处理。C预处理扩展代码,插入所有用#include命令制定的文件,并扩展所有的用#define声明的宏。 编译。编译器产生源代码的...
  • men_wen
  • men_wen
  • 2016年09月18日 22:24
  • 394

FFmpeg源代码简单分析:makefile

本文记录FFmpeg的Makefile的源代码。Makefile用于编译FFmpeg的源代码。通过分析Makefile文件,可以了解FFmpeg的源代码生成的流程。有关Makefile这部分我本身基础...

ext2文件系统源代码之Makefile

大家好,最近我在看文件系统方面的东西,觉得基础的东西已经没问题了,所以今天我决定做一件对我自己来说比较有挑战性的事情,就是阅读ext2文件系统的源代码,以期能够真正初步完成ext2的理解,然后逐步理解...

高性能协程库State Thread Library源代码剖析之一Makefile详解

任何一个优秀的软件项目,都有一套合理高效的管理工具,无论c,c++还是java,要了解一个项目的全貌,比如由哪些模块组成,弄清项目是如何管理,组织的,便顺其自然。而且弄清楚模块之间的关系后,看代码更有...

Linux内核源代码中的Makefile分析

LinuxMakefileAnalysis   Linux, Kernel, Makefile Updated Nov 18, 2009 by mengning...@163.com ...

uts1.2+JNDI+JDK1.5+MySql

  • 2012年07月09日 19:16
  • 1.37MB
  • 下载

netcat源代码,带makefile

  • 2014年11月08日 08:01
  • 39KB
  • 下载

Docker基础: Linux内核命名空间之(4)uts namespace

作为开源Container技术代表的Docker,它跟Linux内核的Namespace和Cgroup两大特性密不可分。物有本末,事有终始。知所先后,则近道矣。理解Linux的这两大特性将有助于我们更...

多系统共存之多Windows+多Linux+opensolaris(unix)共存-(还可以+Mac OS X)

http://hi.baidu.com/wu4666/blog/item/bb957ca79bd8779cd04358c2.html 十几天前,开始初实验物理机中windows和Linux共...

源代码,makefile

  • 2011年10月09日 00:14
  • 24.5MB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:OpenSolaris uts源代码的makefile结构
举报原因:
原因补充:

(最多只允许输入30个字)