The process of building the library is driven by the makefiles, which
make heavy use of special features of GNU
make. The makefiles
are very complex, and you probably don’t want to try to understand them.
But what they do is fairly straightforward, and only requires that you
define a few variables in the right places.
The library sources are divided into subdirectories, grouped by topic.
The string subdirectory has all the string-manipulation functions, math has all the mathematical functions, etc.
Each subdirectory contains a simple makefile, called Makefile,
which defines a few
make variables and then includes the global
makefile Rules with a line like:
The basic variables that a subdirectory makefile defines are:
The name of the subdirectory, for example stdio. This variable must be defined.
The names of the header files in this section of the library, such as stdio.h.
The names of the modules (source files) in this section of the library.
These should be simple names, such as ‘strlen’ (rather than
complete file names, such as strlen.c). Use
modules that define functions in the library, and
auxiliary modules containing things like data definitions. But the
aux are just concatenated, so there
really is no practical difference.
The names of test programs for this section of the library. These should be simple names, such as ‘tester’ (rather than complete file names, such as tester.c). ‘make tests’ will build and run all the test programs. If a test program needs input, put the test data in a file called test-program.input; it will be given to the test program on its standard input. If a test program wants to be run with arguments, put the arguments (all on a single line) in a file called test-program.args. Test programs should exit with zero status when the test passes, and nonzero status when the test indicates a bug in the library or error in building.
The names of “other” programs associated with this section of the library. These are programs which are not tests per se, but are other small programs included with the library. They are built by ‘make others’.
Files to be installed by ‘make install’. Files listed in
‘install-lib’ are installed in the directory specified by
‘libdir’ in configparms or Makeconfig
(see Installation). Files listed in
installed in the directory specified by ‘datadir’ in
configparms or Makeconfig. Files listed in
are installed in the directory specified by ‘bindir’ in
configparms or Makeconfig.
Other files from this subdirectory which should be put into a
distribution tar file. You need not list here the makefile itself or
the source and header files listed in the other standard variables.
distribute if there are files used in an unusual way
that should go into the distribution.
Files which are generated by Makefile in this subdirectory. These files will be removed by ‘make clean’, and they will never go into a distribution.
Extra object files which are built by Makefile in this
subdirectory. This should be a list of file names like foo.o;
the files will actually be found in whatever directory object files are
being built in. These files will be removed by ‘make clean’.
This variable is used for secondary object files needed to build
|• Platform:||Adding platform-specific features.|