/** @page build_sys Build system
@section overview Overview
Building an Etherboot image consists of three stages:
-# @ref compilation : Compiling all the source files into object files
-# @ref linking : Linking a particular image from selected object files
-# @ref finalisation : Producing the final output binary
Though this is a remarkably complex process, it is important to note
that it all happens automatically. Whatever state your build tree is
in, you can always type, for example
@code
make bin/rtl8139.dsk
@endcode
and know that you will get a floppy disk image with an RTL8139 driver
built from the current sources.
@section compilation Compilation
@subsection comp_overview Overview
Each source file (a @c .c or a @c .S file) is compiled into a @c .o
file in the @c bin/ directory. Etherboot makes minimal use of
conditional compilation (see @ref ifdef_harmful), and so you will find
that all objects get built, even the objects that correspond to
features that you are not intending to include in your image. For
example, all network card drivers will be compiled even if you are
just building a ROM for a 3c509 card. This is a deliberate design
decision; please do @b not attempt to "fix" the build system to avoid
doing this.
Source files are defined to be any @c .c or @c .S files found in a
directory listed in the Makefile variable #SRCDIRS. You therefore do
@b not need to edit the Makefile just because you have added a new
source file (although you will need to edit the Makefile if you have
added a new source directory). To see a list of all source
directories and source files that the build system currently knows
about, you can use the commands
@code
make srcdirs
make srcs
@endcode
Rules for compiling @c .c and @c .S files are defined in the Makefile
variables #RULE_c and #RULE_S. Makefile rules are automatically
generated for each source file using these rules. The generated rules
can be found in the @c .d file corresponding to each source file;
these are located in bin/deps/. For example, the rules
generated for drivers/net/rtl8139.c can be found in
bin/deps/drivers/net/rtl8139.c.d. These rules allow you to
type, for example
@code
make bin/rtl8139.o
@endcode
and have rtl8139.o be built from
drivers/net/rtl8139.c using the generic rule #RULE_c for
compiling @c .c files.
You can see the full list of object files that will be built using
@code
make bobjs
@endcode
@subsection comp_ar After compilation
Once all objects have been compiled, they will be collected into a
build library ("blib") in bin/blib.a.
@subsection comp_custom Customising compilation
The Makefile rules for a particular object can be customised to a
certain extent by defining the Makefile variable CFLAGS_@