⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 maint.texi

📁 一个C源代码分析器
💻 TEXI
📖 第 1 页 / 共 3 页
字号:
run all the test programs.  If a test program needs input, put the testdata in a file called @file{@var{test-program}.input}; it will be given tothe test program on its standard input.  If a test program wants to berun with arguments, put the arguments (all on a single line) in a filecalled @file{@var{test-program}.args}.@refill@item othersThe names of ``other'' programs associated with this section of thelibrary.  These are programs which are not tests per se, but are othersmall programs included with the library.  They are built by@w{@samp{make others}}.@refill@item install-lib@itemx install-data@itemx installFiles to be installed by @w{@samp{make install}}.  Files listed in@samp{install-lib} are installed in the directory specified by@samp{libdir} in @file{configparms} or @file{Makeconfig}(@pxref{Installation}).  Files listed in @code{install-data} areinstalled in the directory specified by @samp{datadir} in@file{configparms} or @file{Makeconfig}.  Files listed in @code{install}are installed in the directory specified by @samp{bindir} in@file{configparms} or @file{Makeconfig}.@refill@item distributeOther files from this subdirectory which should be put into adistribution tar file.  You need not list here the makefile itself orthe source and header files listed in the other standard variables.Only define @code{distribute} if there are files used in an unusual waythat should go into the distribution.@item generatedFiles which are generated by @file{Makefile} in this subdirectory.These files will be removed by @w{@samp{make clean}}, and they willnever go into a distribution.@item extra-objsExtra object files which are built by @file{Makefile} in thissubdirectory.  This should be a list of file names like @file{foo.o};the files will actually be found in whatever directory object files arebeing built in.  These files will be removed by @w{@samp{make clean}}.This variable is used for secondary object files needed to build@code{others} or @code{tests}.@end table@node Porting@appendixsec Porting the GNU C LibraryThe GNU C library is written to be easily portable to a variety ofmachines and operating systems.  Machine- and operating system-dependentfunctions are well separated to make it easy to add implementations fornew machines or operating systems.  This section describes the layout ofthe library source tree and explains the mechanisms used to selectmachine-dependent code to use.All the machine-dependent and operating system-dependent files in thelibrary are in the subdirectory @file{sysdeps} under the top-levellibrary source directory.  This directory contains a hierarchy ofsubdirectories (@pxref{Hierarchy Conventions}).Each subdirectory of @file{sysdeps} contains source files for aparticular machine or operating system, or for a class of machine oroperating system (for example, systems by a particular vendor, or allmachines that use IEEE 754 floating-point format).  A configurationspecifies an ordered list of these subdirectories.  Each subdirectoryimplicitly appends its parent directory to the list.  For example,specifying the list @file{unix/bsd/vax} is equivalent to specifying thelist @file{unix/bsd/vax unix/bsd unix}.  A subdirectory can also specifythat it implies other subdirectories which are not directly above it inthe directory hierarchy.  If the file @file{Implies} exists in asubdirectory, it lists other subdirectories of @file{sysdeps} which areappended to the list, appearing after the subdirectory containing the@file{Implies} file.  Lines in an @file{Implies} file that begin with a@samp{#} character are ignored as comments.  For example,@file{unix/bsd/Implies} contains:@refill@smallexample# BSD has Internet-related things.unix/inet@end smallexample@noindentand @file{unix/Implies} contains:@need 300@smallexampleposix@end smallexample@noindentSo the final list is @file{unix/bsd/vax unix/bsd unix/inet unix posix}.@file{sysdeps} has two ``special'' subdirectories, called @file{generic}and @file{stub}.  These two are always implicitly appended to the listof subdirectories (in that order), so you needn't put them in an@file{Implies} file, and you should not create any subdirectories underthem.  @file{generic} is for things that can be implemented inmachine-independent C, using only other machine-independent functions inthe C library.  @file{stub} is for @dfn{stub} versions of functionswhich cannot be implemented on a particular machine or operating system.The stub functions always return an error, and set @code{errno} to@code{ENOSYS} (Function not implemented).  @xref{Error Reporting}.A source file is known to be system-dependent by its having a version in@file{generic} or @file{stub}; every system-dependent function shouldhave either a generic or stub implementation (there is no point inhaving both).If you come across a file that is in one of the main source directories(@file{string}, @file{stdio}, etc.), and you want to write a machine- oroperating system-dependent version of it, move the file into@file{sysdeps/generic} and write your new implementation in theappropriate system-specific subdirectory.  Note that if a file is to besystem-dependent, it @strong{must not} appear in one of the main sourcedirectories.@refillThere are a few special files that may exist in each subdirectory of@file{sysdeps}:@comment Blank lines after items make the table look better.@table @file@item MakefileA makefile for this machine or operating system, or class of machine oroperating system.  This file is included by the library makefile@file{Makerules}, which is used by the top-level makefile and thesubdirectory makefiles.  It can change the variables set in theincluding makefile or add new rules.  It can use GNU @code{make}conditional directives based on the variable @samp{subdir} (see above) toselect different sets of variables and rules for different sections ofthe library.  It can also set the @code{make} variable@samp{sysdep-routines}, to specify extra modules to be included in thelibrary.  You should use @samp{sysdep-routines} rather than addingmodules to @samp{routines} because the latter is used in determiningwhat to distribute for each subdirectory of the main source tree.@refillEach makefile in a subdirectory in the ordered list of subdirectories tobe searched is included in order.  Since several system-dependentmakefiles may be included, each should append to @samp{sysdep-routines}rather than simply setting it:@smallexamplesysdep-routines := $(sysdep-routines) foo bar@end smallexample@need 1000@item SubdirsThis file contains the names of new whole subdirectories under thetop-level library source tree that should be included for this system.These subdirectories are treated just like the system-independentsubdirectories in the library source tree, such as @file{stdio} and@file{math}.Use this when there are completely new sets of functions and headerfiles that should go into the library for the system this subdirectoryof @file{sysdeps} implements.  For example,@file{sysdeps/unix/inet/Subdirs} contains @file{inet}; the @file{inet}directory contains various network-oriented operations which only makesense to put in the library on systems that support the Internet.@refill@item DistThis file contains the names of files (relative to the subdirectory of@file{sysdeps} in which it appears) which should be included in thedistribution.  List any new files used by rules in the @file{Makefile}in the same directory, or header files used by the source files in thatdirectory.  You don't need to list files that are implementations(either C or assembly source) of routines whose names are given in themachine-independent makefiles in the main source tree.@item configureThis file is a shell script fragment to be run at configuration time.The top-level @file{configure} script uses the shell @code{.} command toread the @file{configure} file in each system-dependent directorychosen, in order.  The @file{configure} files are often generated from@file{configure.in} files using Autoconf.A system-dependent @file{configure} script will usually add things tothe shell variables @samp{DEFS} and @samp{config_vars}; see thetop-level @file{configure} script for details.  The script can check for@w{@samp{--with-@var{package}}} options that were passed to thetop-level @file{configure}.  For an option@w{@samp{--with-@var{package}=@var{value}}} @file{configure} sets theshell variable @w{@samp{with_@var{package}}} (with any dashes in@var{package} converted to underscores) to @var{value}; if the option isjust @w{@samp{--with-@var{package}}} (no argument), then it sets@w{@samp{with_@var{package}}} to @samp{yes}.@item configure.inThis file is an Autoconf input fragment to be processed into the file@file{configure} in this subdirectory.  @xref{Introduction,,,autoconf.info, Autoconf: Generating Automatic Configuration Scripts},for a description of Autoconf.  You should write either @file{configure}or @file{configure.in}, but not both.  The first line of@file{configure.in} should invoke the @code{m4} macro@samp{GLIBC_PROVIDES}.  This macro does several @code{AC_PROVIDE} callsfor Autoconf macros which are used by the top-level @file{configure}script; without this, those macros might be invoked again unnecessarilyby Autoconf.@end tableThat is the general system for how system-dependencies are isolated.@iftexThe next section explains how to decide what directories in@file{sysdeps} to use.  @ref{Porting to Unix}, has some tips on portingthe library to Unix variants.@end iftex@menu* Hierarchy Conventions::       The layout of the @file{sysdeps} hierarchy.* Porting to Unix::             Porting the library to an average                                   Unix-like system.@end menu@node Hierarchy Conventions@appendixsubsec Layout of the @file{sysdeps} Directory HierarchyA GNU configuration name has three parts: the CPU type, themanufacturer's name, and the operating system.  @file{configure} usesthese to pick the list of system-dependent directories to look for.  Ifthe @samp{--nfp} option is @emph{not} passed to @file{configure}, thedirectory @file{@var{machine}/fpu} is also used.  The operating systemoften has a @dfn{base operating system}; for example, if the operatingsystem is @samp{sunos4.1}, the base operating system is @samp{unix/bsd}.The algorithm used to pick the list of directories is simple:@file{configure} makes a list of the base operating system,manufacturer, CPU type, and operating system, in that order.  It thenconcatenates all these together with slashes in between, to produce adirectory name; for example, the configuration @w{@samp{sparc-sun-sunos4.1}}results in @file{unix/bsd/sun/sparc/sunos4.1}.  @file{configure} thentries removing each element of the list in turn, so@file{unix/bsd/sparc} and @file{sun/sparc} are also tried, among others.Since the precise version number of the operating system is often notimportant, and it would be very inconvenient, for example, to haveidentical @file{sunos4.1.1} and @file{sunos4.1.2} directories,@file{configure} tries successively less specific operating system namesby removing trailing suffixes starting with a period.As an example, here is the complete list of directories that would betried for the configuration @w{@samp{sparc-sun-sunos4.1}} (without the@w{@samp{--nfp}} option):@smallexamplesparc/fpuunix/bsd/sun/sunos4.1/sparcunix/bsd/sun/sunos4.1unix/bsd/sun/sunos4/sparcunix/bsd/sun/sunos4unix/bsd/sun/sunos/sparcunix/bsd/sun/sunosunix/bsd/sun/sparcunix/bsd/sununix/bsd/sunos4.1/sparcunix/bsd/sunos4.1unix/bsd/sunos4/sparcunix/bsd/sunos4unix/bsd/sunos/sparcunix/bsd/sunosunix/bsd/sparcunix/bsdunix/sun/sunos4.1/sparcunix/sun/sunos4.1unix/sun/sunos4/sparcunix/sun/sunos4unix/sun/sunos/sparcunix/sun/sunosunix/sun/sparcunix/sununix/sunos4.1/sparcunix/sunos4.1unix/sunos4/sparcunix/sunos4unix/sunos/sparcunix/sunosunix/sparcunixsun/sunos4.1/sparcsun/sunos4.1sun/sunos4/sparcsun/sunos4sun/sunos/sparcsun/sunossun/sparcsunsunos4.1/sparcsunos4.1sunos4/sparcsunos4sunos/sparcsunossparc@end smallexampleDifferent machine architectures are conventionally subdirectories at thetop level of the @file{sysdeps} directory tree.  For example,@w{@file{sysdeps/sparc}} and @w{@file{sysdeps/m68k}}.  These containfiles specific to those machine architectures, but not specific to anyparticular operating system.  There might be subdirectories forspecializations of those architectures, such as@w{@file{sysdeps/m68k/68020}}. Code which is specific to thefloating-point coprocessor used with a particular machine should go in@w{@file{sysdeps/@var{machine}/fpu}}.There are a few directories at the top level of the @file{sysdeps}hierarchy that are not for particular machine architectures.@table @file@item generic@itemx stubAs described above (@pxref{Porting}), these are the two subdirectoriesthat every configuration implicitly uses after all others.@item ieee754This directory is for code using the IEEE 754 floating-point format,where the C type @code{float} is IEEE 754 single-precision format, and@code{double} is IEEE 754 double-precision format.  Usually thisdirectory is referred to in the @file{Implies} file in a machinearchitecture-specific directory, such as @file{m68k/Implies}.@item posixThis directory contains implementations of things in the library interms of @sc{POSIX.1} functions.  This includes some of the @sc{POSIX.1}functions themselves.  Of course, @sc{POSIX.1} cannot be completely

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -