Node:Source Layout, Next:Porting, Up:Maintenance
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:
include ../Rules
The basic variables that a subdirectory makefile defines are:
subdir
stdio
.
This variable must be defined.
headers
stdio.h
.
routines
aux
strlen
(rather than
complete file names, such as strlen.c
). Use routines
for
modules that define functions in the library, and aux
for
auxiliary modules containing things like data definitions. But the
values of routines
and aux
are just concatenated, so there
really is no practical difference.
tests
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.
others
make others
.
install-lib
install-data
install
make install
. Files listed in
install-lib
are installed in the directory specified by
libdir
in configparms
or Makeconfig
(see Installation). Files listed in install-data
are
installed in the directory specified by datadir
in
configparms
or Makeconfig
. Files listed in install
are installed in the directory specified by bindir
in
configparms
or Makeconfig
.
distribute
distribute
if there are files used in an unusual way
that should go into the distribution.
generated
Makefile
in this subdirectory.
These files will be removed by make clean
, and they will
never go into a distribution.
extra-objs
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
others
or tests
.